Using the DirX Diag Tool

DirX Audit provides the customized DirX Diag tool to collect information about the system and the DirX Audit installation. The tool can be used to create diagnosis files that can be sent to support for analysis.

Usage Prerequisites

The DirX Diag tool has the following prerequisites:

  • The tool supports the Microsoft Windows and GNU/Linux operating systems. A command shell (the Windows command prompt or a UNIX shell) must be available to run the tools.

  • The Java Virtual Machine (JVM) must be set up correctly. You must use the same JVM version that the other DirX Audit components use. If the tool is installed from the DirX Audit installer, the correct JVM will be used automatically. When the tool is installed from a standalone package, you must set the system path to contain the bin folder of the JVM and set the JAVA_HOME system environment variable to point to the JVM folder.

Installation Location

The customized DirX Diag tool is located in the following folder:

install_path/tools/dirxdiag

The sub-folder bin contains the binary of the tool. The name of the binary is dxtdirxdiag.bat for Windows and dxtdirxdiag.sh for UNIX.

Common Syntax and Usage

The general usage of the tools is:

dxtdirxdiag
[-c <config_file>]
[-o <output_file>]
[-i <install_path>]
[-tenantid <tenantID>]
[ <config_set_1> [<config_set_2> …​ ] ]

You can always run the tool with the parameter -h to get the usage help information and examples.

Explanation of parameters:

-c <config_file>

Specifies the configuration file to be used. The configuration file must be in XML format and follow the schema defined in install_path/bin/config.xsd. If this parameter is missing, the default install_path/bin/config.xml is used. A configuration file can contain several configuration sets.

-o <output_file>

Defines the output file name. The syntax for the default file name is:
diagnosis_yyyyMMdd_HHmm_<setname1>_<setname2>…​.zip

Here is an example of the default output file name that was created during a run on 30/11/2022 at 4:31 p.m. is:
diagnosis_20221130_1631_default.zip

-i <install_path>

DirX Diag can use parameters from various sources. Per default, .ini files are searched in the current directory.

-tenantid <tenantID>

The tenantID specifies the identifier of a configured tenant for which the diagnosis will be executed. If omitted, the diagnosis will run on all tenants.

<config_set_1> [<config_set_2> …​ ]

A configuration file can contain several configuration sets. If no configuration set is specified, default is assumed. The number of sets to be executed is not limited. Following configuration sets are available in default configuration file:

  • broker – collects information about the DirX Audit Message Broker logs and configuration

  • db – collects information about the DirX Audit Database configuration

  • default – collects information about the DirX Audit installation and configuration

  • manager – collects information about the DirX Audit Manager logs and configuration

  • server – collects information about the DirX Audit Server logs, core and tenant configuration and configured routes

  • system_info – collects system information

A dirxdiag.log file about the DirX Diag execution is added to generated ZIP.
This feature is configurable via Java Logging, see install_path/app/logging.properties for details.

Examples

In the following example, the DirX Diag tool runs the default configuration set for all tenants and creates a ZIP file named diagnosis_YYYYMMDD_HHmm_default.zip in the current working directory.

dxtdirxdiag.bat

In the following example, the DirX Diag tool runs the default and manager configuration set for a specific tenant and creates a ZIP file in the current working directory.

dxtdirxdiag.bat -tenantid f4ba80a6-648c-4868-90f6-06cd5b1f0a0e manager

In the following example, the DirX Diag tool runs the default, manager and server configuration sets for a specific tenant and creates a ZIP file named diag2.zip in the current working directory.

dxtdirxdiag.bat -o diag2.zip -tenantid f4ba80a6-648c-4868-90f6-06cd5b1f0a0e manager server

In the following example, the DirX Diag tool runs the system_info configuration set for all tenants and creates a ZIP file in the current working directory.

dxtdirxdiag.bat system_info

Configuration Details

Configuration File

Configuration files are in XML format using the scheme install_path/bin/config.xsd to check the validity and giving hints for XML editors.

Example of configuration file:

<diagnosis xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="config.xsd" version="1.0">

    <!-- DirX Audit Message Broker -->
    <set name="broker">
        <addSet name="default"/>

        <!-- File list -->
        <addDirList path="${install.path.comp.message_broker}" recursive="true"/>

        <!-- configuration -->
        <addPath path="${install.path.comp.message_broker}/bin/service" fileMask="wrapper.conf" recursive="true"/>
        <addPath path="${install.path.comp.message_broker}/conf" fileMask="*" recursive="false"/>
        <addFile path="${install.path.comp.message_broker}/webapps/admin/WEB-INF/webconsole-embedded.xml"/>

        <!-- log files -->
        <addPath path="${install.path.comp.message_broker}/data" fileMask="*.log" recursive="false" notOlderThanDays="2"/>

    </set>

    <set ...
        <!-- Just another set -->
    </set>
    ...

<diagnosis>

A configuration file consists of one or more configuration sets you can select via command line parameters.
Each configuration set consists of configuration elements.

Configuration Elements

Each set in a configuration file can contain one or more of the following configuration elements. These configuration elements define one or more files to be added to the zip file.

addSystemInformation – adds system information into a file

Collects and adds system information into the file system_info.txt.
Optional parameter osName (see below).

Example:
<addSystemInformation/>

addOutput – allows running any command. The output is written to a file.

Required parameter command specifies the command to be executed.
You can add parameters to the command by using the <param value="…​"/> sub-elements.
Optional parameter osName lets you restrict the command execution to a specific operating system (see below).
Filename: command_<number>_<command>.txt

Example:

<addOutput osName="Windows" command="net">
   <param value="start"/>
</addOutput>

Executes the command net start on Windows platforms. The output is written to the file command_1_net.txt which is zipped to the output file.

addDirList – directory listing

Adds a list of all files and directories under the defined path into a file.
You can use placeholders (see below) and wildcards * and ? in the path definition.
Optional parameters are fileMask, recursive and osName (see below).
Filename: dir_list_<number>.txt

Example:

<addDirList path="${DIRXIDENTITY_INST_PATH}/ids-j-*/" recursive="true"/>

addFile – adds a single file

Adds a specific file to the zip file.
You can specify a path that can contain place holders (see below) and wildcards * and ?. Optional parameter osName (see below).

Example:

<addFile path="${DIRXIDENTITY_INST_PATH}/ids-j-*/bin/idmsvc.ini"/>

This definition adds all idmsvc.ini files from all directories that start with ids-j- to the zip file.

addPath – adds a collection of files

Adds a collection of files to the zip file.
You can specify a path that can contain place holders (see below) and wildcards * and ?.
Optional parameters are fileMask, recursive, osName and notOlderThanDays (see below).

Example:

<addPath path="${DIRXIDENTITY_INST_PATH}/ids-j-*/bin/" fileMask="*.bat" recursive="false"/>

This definition adds all files with the extension .bat in all directories that start with ids-j- to the zip file.

addSet – executes an existing set

Adds an already defined set to the current one. Meaning, that all items from the specified set will be added to the current set.
Required parameter name specifies the name of the set, which is to be inserted.
The specified set must be defined within the config file, otherwise the command will be skipped.

The sets can contain addSet operations and refer to each other, creating a tree-like structure of an arbitrary depth. However, each set will be executed at most once. Therefore, if there are mutliple addSet operations of the same set, the set will be executed exactly once, and any subsequent calls to the same set will be ignored.
This functionality restriction prevents the creation of cycles of reference.

Example:
<addSet name="system_info"/>

This definition executes a set named system_info. If such set does not exist, the program skips the operation.

addSql – executes a SQL query and adds the output to a file

The parameters are:

  • dbType – required – type of database. Supported values are: "DXT_DATA", "DXT_CONFIG", "DXT_HISTORY".

  • dbServerType – optional – specifies the database server type. Supported values are: "mssql", "oracle", "postgresql".
    If omitted, the query will be executed on all databases regardless of their server type.

  • query – required, if queryFile is not specified – the SQL query to be executed.

  • queryFile – required, if query is not specified – path to a file that contains the SQL query to be executed.

  • output – optional – name to be added to the filename of the query output file. The output file name will be: dirxdiag_sql_<output>_<number>_<tenantId>.csv

  • queryLimit – optional – limits the number of rows returned by the query. The default is 1000, if omitted.

The queries can contain placeholders. In the case of queryFile parameter, the ${<placeholder>} will be replaced in the file content.
In the case of query parameter, the ${<placeholder>} syntax must be escaped with additional $ in order to work.
The syntax for adding parameters is used in provided example.

Example:

<addSql dbType="DXT_DATA" dbServerType="mssql" queryFile="${install.path}/conf/sql/query.sql" output="example_output" queryLimit="5000">
    <params>
        <param name="PLACEHOLDER">value</param>
        <param name="ANOTHER_PLACEHOLDER">another_value</param>
    </params>
</addSql>

General attributes

Every configuration element <add…​> can contain (optional) parameters.

osName – restricts the element to a specific operating system.

Recommended values are: "Windows" and "Linux", but in fact you can type any prefix of the system property "os.name".
For example: "Windows Server" matches any Windows Server only while "Windows" matches any Windows system.
The value of this property is shown when you use <addSystemInformation/>.

recursive – indicates whether you want to include or exclude sub directories.

If you omit it, sub directories are included by default.

fileMask – allows defining a file mask using wildcards * and ?.
Omitting the parameter is equivalent to *.* and * meaning any file.

notOlderThanDays – allows exclusion of files that are older (last modified) than current datetime minus the given number of days.

Placeholders

You can use placeholders in any attribute value string. For example ${XXX} is replaced by value of XXX.
An attribute value string can contain an unlimited number of placeholders. Placeholders cannot be sinked-in. Currently there is no escape character to represent ${.

Example:
<addDirList path="${install.path.comp.message_broker}"/>
is replaced by
<addDirList path="C:\Program Files\Atos\DirX Audit\message_broker"/>

The value is searched in

  1. Specific INI files under the defined path
    If the parameter -i <install_path> is supplied, then the placeholders are searched in the content of these INI files (in this order, at least one must exist):

    1. <install_path>/conf/installation.ini

    2. <install_path>/conf/configuration.ini

    3. <install_path>/configuration.ini

  2. Specific INI files in the current working directory
    Placeholders are searched in content of the previously listed INI files in the current working directory (if they exist).

  3. System variables
    Placeholders are searched in the list of system variables: system.getProperty()
    Example: ${java.runtime.version}

  4. Environment variables
    Placeholders are searched in the list of environment variables: Runtime.getEnv()
    Example: ${tomcat_home}