IBM Db2 Monitoring

Skip Prerequisites, Web and LPAR2RRD tabs in case of configuring Virtual Appliance, Docker or a Container

Follow installation procedure for your operating system platform
IBM Db2 monitoring schema
It will be released in LPAR2RRD 7.60 (Jan 2022), let us know if you want to test it before

LPAR2RRD obtains data through ODBC modules

Prerequisites

Only Linux is supported, no AIX neither Solaris were tested so far.
You can skip it in case you use Xorux Virtual Appliance 7.60 which already contains ibm_data_server_driver_for_odbc_cli_linuxx64_v11.5.
  1. Install Perl DBI and DBD::DB2 modules as per www.ibm.com/support/pages/db2-perl-database-interface-luw
    Get from above page driver package of requested version (like ibm_data_server_driver_package_linuxx64_v11.5.tar.gz) and put it into /tmp
    # under root user
    umask 022
    cd /tmp
    tar xvfz /tmp/ibm_data_server_driver_package_linuxx64_v11.5.tar.gz
    cd /tmp/dsdriver
    ./installDSDriver
    . ./db2profile
    export DB2_HOME=/tmp/dsdriver
    export DB2LIB=/tmp/dsdriver/lib
    cpan DBD::DB2
    rm -rf dsdriver ibm_data_server_driver_package_linuxx64_v11.5.tar.gz
    exit # of the root shell
    
  2. Install IBM Db2 ODBC CLI driver as per www.ibm.com/support/pages/db2-odbc-cli-driver-download-and-installation-information
    Get from above page ODBC driver package of requested version (like ibm_data_server_driver_for_odbc_cli_linuxx64_v11.5.tar.gz) and put it into /tmp
    #  under lpar2rrd user
    su - lpar2rrd
    umask 022
    cd /home/lpar2rrd
    mkdir db2_cli_odbc_driver
    cd db2_cli_odbc_driver
    tar xvfz /tmp/ibm_data_server_driver_for_odbc_cli_linuxx64_v11.5.tar.gz
    rm /tmp/ibm_data_server_driver_for_odbc_cli_linuxx64_v11.5.tar.gz
    
  3. Edit /home/lpar2rrd/lpar2rrd/etc/lpar2rrd.cfg and set proper path
    cd /home/lpar2rrd/lpar2rrd
    vi etc/lpar2rrd.cfg
    
    # IBM Db2 settings, put the path to the odbc driver
      DB2_CLI_DRIVER_INSTALL_PATH=/home/lpar2rrd/db2_cli_odbc_driver/odbc_cli/clidriver/
    

Connectivity check

Allow access from the LPAR2RRD host to IBM Db2 host.
Make sure you are using correct port.
Default port for IBM Db2 sessions is 25010.
$ perl /home/lpar2rrd/lpar2rrd/bin/conntest.pl 192.168.1.1 25010
  Connection to "192.168.1.1" on port "25010" is ok

Create DB user for LPAR2RRD

Create a database user with these privileges on each database on the host machine.
  1. Create system user lpar2rrd if there isn't one:
    www.ibm.com/docs/en/db2/11.1?topic=unix-creating-group-user-ids-db2-database-installation

  2. Grant privileges to the user in the database.
    GRANT createtab,bindadd,connect ON DATABASE TO USER lpar2rrd;
    GRANT EXECUTE ON FUNCTION  SYSPROC.* TO USER lpar2rrd;
    GRANT EXECUTE ON PROCEDURE SYSPROC.* TO USER lpar2rrd;
    GRANT SELECT ON TABLE SYSIBMADM.DB2_MEMBER TO USER lpar2rrd;
    CREATE SCHEMA lpar2rrd;
    

Attach IBM Db2 to LPAR2RRD

  • Add each database through the UI LPAR2RRD UI ➡ Settings icon ➡ IBM Db2 ➡ New :
    IBM Db2 configuration

  • Make sure cron jobs for IBM Db2 are in place (upgrade script might do it for you automatically)
    Skip this step if you install the Virtual Appliance - it is already taken care of.
    $ crontab -l | grep "load_db2.sh"
    $
    
    Add following lines to crontab if necessary
    $ crontab -e
    
    # IBM Db2 support
    0,5,10,15,20,25,30,35,40,45,50,55 * * * *  /home/lpar2rrd/lpar2rrd/load_db2.sh > /home/lpar2rrd/lpar2rrd/load_db2.out 2>&1
    
  • Wait 30 minutes and then go to the web UI: http://<your web server>/lpar2rrd/
    Use Ctrl-F5 to refresh the web browser cache.


Install LPAR2RRD server

  • Download the latest LPAR2RRD server
    Upgrade your already running LPAR2RRD instance.

  • Install it:
    # su - lpar2rrd
    $ tar xvf lpar2rrd-7.XX.tar
    $ cd lpar2rrd-7.XX
    $ ./install.sh
    $ cd /home/lpar2rrd/lpar2rrd
    
  • Make sure all Perl modules are in place
    cd /home/lpar2rrd/lpar2rrd
    . etc/lpar2rrd.cfg; $PERL bin/perl_modules_check.pl
    
    If there is missing "LWP::Protocol::https" then check this docu to fix it

  • Enable Apache authorisation
    umask 022
    cd /home/lpar2rrd/lpar2rrd
    cp html/.htaccess www
    cp html/.htaccess lpar2rrd-cgi
    
  • Schedule to run it from lpar2rrd crontab (it might already exist there)
    $ crontab -l | grep load.sh
    $
    
    Add if it does not exist as above
    $ crontab -e
    
    # LPAR2RRD UI
    0,30 * * * * /home/lpar2rrd/lpar2rrd/load.sh > /home/lpar2rrd/lpar2rrd/load.out 2>&1 
    
    Assure there is just one such entry in crontab.

  • You might need to add lpar2rrd user into /var/adm/cron/cron.allow (/etc/cron.allow on CentOS 8) if crontab command fails
    Allow it for lpar2rrd user as root user.
    # echo "lpar2rrd" >> /var/adm/cron/cron.allow
    
  • Assure you have a cron jobs for IBM Db2 in place (upgrade script might do it automatically) Skip it on the Virtual Appliance, it is already there.
    $ crontab -l | grep "load_db2.sh"
    $
    
    Add it if it does not exist like above
    $ crontab -e
    
    # IBM Db2 support
    0,5,10,15,20,25,30,35,40,45,50,55 * * * *  /home/lpar2rrd/lpar2rrd/load_db2.sh > /home/lpar2rrd/lpar2rrd/load_db2.out 2>&1
    
  • Initial start from cmd line:
    $ cd /home/lpar2rrd/lpar2rrd
    $ ./load.sh
    
  • Go to the web UI: http://<your web server>/lpar2rrd/
    Use Ctrl-F5 to refresh the web browser cache.

Troubleshooting

  • If you have any problems with the UI then check:
    (note that the path to Apache logs might be different, search apache logs in /var)
    tail /var/log/httpd/error_log             # Apache error log
    tail /var/log/httpd/access_log            # Apache access log
    tail /var/tmp/lpar2rrd-realt-error.log    # STOR2RRD CGI-BIN log
    tail /var/tmp/systemd-private*/tmp/lpar2rrd-realt-error.log # STOR2RRD CGI-BIN log when Linux has enabled private temp
    
  • Test of CGI-BIN setup
    umask 022
    cd /home/lpar2rrd/lpar2rrd/
    cp bin/test-healthcheck-cgi.sh lpar2rrd-cgi/
    
    go to the web browser: http://<your web server>/lpar2rrd/test.html
    You should see your Apache, LPAR2RRD, and Operating System variables, if not, then check Apache logs for connected errors