Running diagnostics by using the apdiag command

The apdiag utility collects various logs, commands output, and configuration files from the system for diagnosing issues.

As apuser or any other user with the same permissions, you can enter the list or collect version of the command on any node.

The apdiag list command gives you the information on all available options (components or symptoms) that you can use for restricting log collection.

With the apdiag collect command you can choose to collect the information for all components, a group of components listed in a file, component sets, or a group of components based on a pre-defined symptom. You can also restrict log collection to a specific time frame or specific hardware. Some options are provided as a fail-safe mechanism, that allow apdiag to run in case of system issues.

Following are the available symptoms with situations when they should be run:

db_crash
The database crashed, and it is known that a database component has caused the crash.
crash
The database crashed, and it is not known which component (such as hardware, network, storage etc.) caused the crash. The crash symptom is a super-set of db_crash. The crash symptom will collect logs of all hardware components, network, storage etc in addition to logs collected for db_crash symptom.
db_deadlock
A deadlock is detected in the database.
db_hang
The database is in a hung state and it is known that some database component is causing it.
hang
The database is in hung state and it is not known what component (such as hardware, network, storage etc) caused the hang. The hang symptom is super set of db_hang. The hang symptom will collect logs of all hardware components, network, storage etc in addition to logs collected for db_hang symptom.
db_perf
There is a performance issue with the database and it is known that some database component is causing it.
perf
There is a performance issue with the database and it is not known which component (such as hardware, network, storage etc) is causing the performance issue. The perf symptom is a super-set of db_perf. The perf symptom will collect logs of all hardware components, network, storage etc in addition to logs collected for db_perf symptom.
hdd_errors
There are issues with node HDDs.
outofmemory
The database operation reports out of memory errors.

After identifying the symptoms in your environment, you can run apdiag collect --symptoms [SYMPTOM [SYMPTOM ...]].

The default collection history of db2support is 2 days. If you want to increase the collection history, for example, to 14 days. then additional option --comp-param database/support:' -H 14d' can be passed to apdiag

Examples

  • Collect db_hang symptom-related logs:
    apdiag collect --symptoms db_hang
  • Collect logs related to HA:
    apdiag collect --sets ha_logs
  • Collect logs related to HA excluding docker components:
    apdiag collect --sets ha_logs --minus-components docker
  • Collect dump schema for given schemas:
    apdiag collect --sets dumpschema --schemas <schema1> <schema2>
  • Collect FSN log level 1 for only hadomain1.fsn1 (for IBM® Integrated Analytics System only):
    apdiag collect --components hw/fsn/log_level1 --fsns hadomain1.fsn1
  • Collect database logs that were modified after certain time:
    apdiag collect --components database/log --atime '2017-08-25 16:38:00'
  • Collect logs and append a suffix to the collected directory:
    apdiag collect --sets ha_logs --suffix pmr123
  • Collect database logs but skip the core files:
    apdiag collect --components database/log --skip-cores
  • Collect logs for multiple components:
    apdiag collect --components database/conf host/mount
  • Ignore the required space check:
    apdiag collect --components database/log --ignore-space-check
  • Collect logs for the components that are listed in the specified file:
    apdiag collect --comp-file /tmp/my_component_list.txt
  • Provide multiple --symptoms, --sets and --components on a single command line:
    apdiag collect --symptoms hang crash --sets ha_logs --components host/mount
  • Collect diagnostics related to DSX:
    apdiag collect --set dsx_logs --node node0101 --headnode node0101