Documentation forServer & Application Monitor
Monitoring your applications and environment is a key capability of SolarWinds Observability Self-Hosted (formerly Hybrid Cloud Observability) and is available in the Essentials edition. Server & Application Monitor (SAM) is also available in a standalone module.

IBM DB2

This SAM application monitor template assesses the performance of an IBM DB2 database by retrieving performance data from the built-in SYSIBMADM tables.

This template is compatible with the SolarWinds Platform Agent for Linux.

Prerequisites

IBM DB2 9.7 or later is installed on the target server.

Install the required version of IBM DB2 ODBC Driver on the SAM Server and create a new data source to the target DB2 database server.

Access to SYSIBMADM tables in the IBM DB2 database.

Credentials

Database user name and password.

Configure SSL/TLS for the DB2 ODBC driver

See IBM documentation for reference.

Prepare the database server

To prepare the IBM DB2 database server:

  1. Execute the following commands in the Command Editor:

UPDATE DBM CFG USING DFT_MON_BUFPOOL ON

UPDATE DBM CFG USING DFT_MON_LOCK ON

UPDATE DBM CFG USING DFT_MON_STMT ON

UPDATE DBM CFG USING DFT_MON_UOW on

  1. Use the GRANT EXECUTE ON FUNCTION statement to grant privileges for the SYSPROC.MON_GET_TABLE function to user, where user is the username that SAM will utilize to monitor the IBM DB2 database, as shown in this example:
    GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_TABLE TO user
  2. Restart the database server.

Configuration for SolarWinds Platform agent for Linux monitoring

Here are prerequisites for the following steps:

  • IBM DB2 is installed on a Linux-based computer.
  • A user account exists on the server and in the IBM DB2 database.

To run commands, you will need the instance users for the database. The instance user connects to the DB and should have the sqllib directory set up.

  1. Log in to the Linux-based computer with administrator privileges.

  2. Use the following command to install the unixODBC package:

    yum -y install unixODBC

  3. Update the ODBC config files by adding the following settings to /etc/odbcinst.ini:
    [DB2]
    Description = DB2 Driver
    Driver = /opt/ibm/db2/V10.5/lib64/libdb2.so
    FileUsage = 1
    DontDLClose = 1

    Verify that libdb2.so has the correct file path.

  4. Add the following settings to /etc/odbc.ini:
    [dbname]
    Driver = DB2

    The drivers should match in both files.

  5. Connect locally to the database with the instance user credentials. For example:
    isql -v dbname UserID Password
  6. Log in to the DB2 database with the user credentials for the instance, and open the DB2 command line tool.
  7. Enable the required following setting used by the SAM IBM DB2 template:
    UPDATE DBM CFG USING DFT_MON_BUFPOOL ON
    UPDATE DBM CFG USING DFT_MON_LOCK ON
    UPDATE DBM CFG USING DFT_MON_STMT ON
    UPDATE DBM CFG USING DFT_MON_UOW on
  8. Use the GRANT EXECUTE ON FUNCTION statement to grant privileges for the SYSPROC.MON_GET_TABLE function to user, where user is the username, as shown in this example:
    GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_TABLE TO user

Configure DB2 on AIX devices

Important: Do not install the 64-bit ODBC drivers; instead, use 32-bit drivers to support Python distributed on the SolarWinds Platform agent.

  • Install the IBM DB2 ODBC Driver (© 2021 IBM Corp.; www.ibm.com/support) on AIX devices. The commands use the following driver bundle:
    v11.1.1fp1_aix64_odbc_cli_32.tar.gz.
  • Install the ODBC driver manager package and dependencies from AIX Open Source Packages.
    • info-6.4-1.aix5.1.ppc.rpm
    • libiconv-1.15-1.aix5.1.ppc.rpm
    • libtool-ltdl-1.5.26-2.aix5.1.ppc.rpm
    • readline-7.0-3.aix5.1.ppc.rpm
    • libffi-3.1.1.aix5.1.ppc.rpm (not a direct dependency, but needed by the SAM monitor plugin)
  • The gunzip utility is part of the AIX 5L™ default installation.
  • Verify that the IBM rpm.rte package exists in the /usr/bin/rpm directory

Configure ODBC for AIX

  1. Log in to the AIX-based computer with administrator privileges.

  2. Install the Red Hat Package Manager (RPM) files from the AIX Open Source Package.

    Run the following command as root: rpm -ivh unixODBC-2.3.4-1.aix5.1.ppc.rpm

    To install all dependencies, run the following command that expects the dependencies are in the same directory:.
    rpm -ivh *.rpm

  3. Install the DB2 ODBC driver. The example code creates a directory odbc_cli_32 in the /opt directory.

    gunzip v11.1.1fp1_aix64_odbc_cli_32.tar.gz

    tar -x -f v11.1.1fp1_aix64_odbc_cli_32.tar -C /opt

  4. Add the following lines to /opt/freeware/etc/odbcinst.ini:
    [DB2]
    Description = DB2 Driver
    Driver = /opt/odbc_cli_32/clidriver/lib/libdb2.so
    FileUsage = 1
    DontDLClose = 1

    Verify libdb2 has the correct file path.

  5. Add the following settings to /opt/freeware/etc/odbc.ini:

    [dbname]

    Description = IBM DB2 ODBC data source

    Driver = DB2

    DMEnvAttr = SQL_ATTR_UNIXODBC_ENVATTR={/opt/odbc_cli_32/clidriver}

    • In [dbname], enter the name of the database to be monitored.
    • DMEnvAttr value depends on the installation directory for the DB2 ODBC CLI driver.
  6. Run the following command as root. It allows the unixODBC manager driver to find the DB2 ODBC file.

    ar -X32 x libdb2.a shr.o

    mv shr.o libdb2.so

  7. Verify that the SAM python plugin can connect to the DB2 database to monitor it. Save the following script as verifyodbc.py.
    The script is written for SolarWinds Platform agents in the default location /opt/SolarWinds/Agent.

    Important: If you are not using the default port, add server hostname and port number to the connection string.

    import sys

    sys.path.insert(0, "/opt/SolarWinds/Agent/bin/Plugins/SharedPythonLibs")

    import pypyodbc

    # Set Database, Uid, and Pwd to the database name, username, and user password to access said database respectively.

    # In this example, database name, username, and the user's password are TEST, UserID, and Password respectively.

    try:

    conn_str = 'Driver={DB2};Database=TEST;Uid=UserID;Pwd=Password;'

    conn = pypyodbc.connect(conn_str, ansi=True)

    conn.close()

    except Exception as ex:

    print(ex)

    print("Failure")

  8. Run the script using the following command:
    /opt/SolarWinds/Agent/bin/python2 verifyodbc.py
  9. (Recommended) Configure the utilities in the DB2 ODBC CLI bundle. Create the db2cli.ini configuration file in /opt/odbc_cli_32/clidriver/cfg/db2cli.ini:

    Replace TEST with your database name.


    TEST
    Database=TEST
    dbalias=TEST
    Protocol=TCPIP
    Hostname=123.0.0.1
    ServiceName=50000

Configure and assign the SAM IBM DB2 template to your Linux/Unix-based computer with the instance user credentials.

  1. Click Settings > All Settings > SAM Settings > Manage Templates.
  2. Search for an IBM DB2 template. SolarWinds recommends creating a copy of the template. Select a template based on version and click Copy.
  3. Modify the settings of the template and component monitors based on the metrics you want to monitor.
  4. To enter credentials, select the component monitor check boxes and click Assign Credentials.
  5. Enter the credentials for the instance user account and click OK.
  6. Modify connection strings for monitors to match your DB. Use one of the following methods:

    • Specify the actual DB and driver:
      Driver={DB2};Database=TESTDB;Hostname=${IP};Port=50000;Protocol=TCPIP;Uid=${USER};Pwd=${PASSWORD};
    • Specify the existing data source in odbc.ini:
      DSN=testdb;Uid=${USER};Pwd=${PASSWORD};

Component monitors

Click here for an overview about SAM application monitor templates and component monitors. SAM API Poller templates are also available.

Components without predetermined threshold values provide guidance such as "Use the lowest threshold possible" or "Use the highest threshold possible" to help you find a threshold appropriate for your application.

Database Used Space (MB)

This component monitor returns the used space, in MB, of the current database.

By default, this monitor returns a value for the database named, SAMPLE. To change the database, find the following parameter in the ODBC driver string and replace SAMPLE with your database name:

Database=SAMPLE;

Log File Used Space in Specified Database (MB)

This component monitor returns the used space, in MB, of the log file in the specified database.

By default, this monitor returns a value for the database named, SAMPLE. To change the database, replace SAMPLE with your database name in the following SQL query:

WHERE DB_NAME = 'SAMPLE'

Log File Free Space in Specified Database (MB)

This component monitor returns the free space, in MB, of the log file in the specified database.

By default, this monitor returns the value for the database named, SAMPLE. To change the database, replace SAMPLE with your database name in the following SQL query:

WHERE DB_NAME = 'SAMPLE'

Average Buffer Total Hit Ratio (%)

This component monitor returns the average Total Hit Ratio (index, XDA, and data reads) for all buffers. To see the Hit Ratio for all buffers, you should manually execute the following SQL command:

SELECT * FROM SYSIBMADM.BP_HITRATIO

If you want to see the Hit Ratio for a specific buffer, you can use the following SQL construction:

SELECT REAL(AVG(TOTAL_HIT_RATIO_PERCENT))
FROM SYSIBMADM.BP_HITRATIO
WHERE BP_NAME = 'IBMDEFAULTBP'

The returned value should be as high as possible.

Average Data Hit Ratio (%)

This component monitor returns the average Data Hit Ratio for all buffers. To see the Hit Ratio for all buffers, you should manually execute the following SQL command:

SELECT * FROM SYSIBMADM.BP_HITRATIO

If you want to see the Hit Ratio for a specific buffer, you can use the following SQL construction:

SELECT REAL(AVG(DATA_HIT_RATIO_PERCENT))
FROM SYSIBMADM.BP_HITRATIO
WHERE BP_NAME = 'IBMDEFAULTBP'

The returned value should be as high as possible.

Average Index Hit Ratio (%)

This component monitor returns the average Index Hit Ratio for all buffers. To see the Hit Ratio for all buffers, you should manually execute the following SQL command:

SELECT * FROM SYSIBMADM.BP_HITRATIO

If you want to see the Hit Ratio for a specific buffer, you can use the following SQL construction:

SELECT REAL(AVG(INDEX_HIT_RATIO_PERCENT))
FROM SYSIBMADM.BP_HITRATIO
WHERE BP_NAME = 'IBMDEFAULTBP'

The returned vale should be as high as possible.

Number of Locks Held in Specified Database

This component monitor returns the number of Locks currently held in the specified database.

By default, this monitor returns the value for the database named, SAMPLE. To change the database, replace SAMPLE with your database name in the following SQL query:

WHERE DB_NAME = 'SAMPLE'

The returned value should be as low as possible.

Average Read Time (ms)

This component monitor returns the average read time from the database in milliseconds. The returned value should be as low as possible.

Connected applications to Specified Database

This component monitor returns the number of connected applications to the specified database.

By default, this monitor returns the value for the database named, SAMPLE. To change the database, replace SAMPLE with your database name in the following SQL query:

WHERE DB_NAME = 'SAMPLE'

Number of Long Running Queries

This component monitor returns the number of Long Running Queries. You should set the threshold according to your environment.

Number of Table Scans

This component monitor returns the number of table scans currently in progress in the specified database.

Table with the Biggest Table Scans Value

This component monitor returns the table name with the Biggest Value of Table Scans and the value itself.

Used Space of the Biggest Table (MB)

This component monitor returns the name of the Biggest Table and its size, in MB.