Centerity – Development of check “MaxDB Data Area usage” v2

This page describes the development of checking the “Data Area usage” of a MaxDB database by Centerity.

Versions used :
Centerity Monitor Enterprise Edition : 3.9.5
MaxDB database : 7.9.08.32
Linux : RedHat 6
Perl : 5.10.1
Nagios check_maxdb script : 0.50

The Perl script that will be used to check the “Data Area usage” of a MaxDB database, is based on Nagios check_maxdb script (check_maxdb.pl), created by Mark Rittinghaus. The original script can also be downloaded here : check_maxdb_original.pl

I have made following modifications to the original script :
* Usage of username / password (-n $o_host -d $o_dbname -u $o_user) replaced by Xuser file ($dbmcli -U c), so there ’s no need for hard-coded passwords.
* Added function A, to check the status of AUTOSAVE.
The script can be downloaded here : check_maxdb.pl

MaxDB database server setup

Copy check_maxdb.pl to the MaxDB database server, to the directory where all Nagios custom checks are located.

Update check_maxdb.pl with local settings (in variable $dbmcli the path for the dmcli command must be specified) :
my $dbmcli = “/usr/sapdb/clients/MaxDB/bin/dbmcli”;

Add following custom check to your Nagios config file, probably located in /usr/local/nagios/etc/conf.d :
command[maxdb_data_area_check]= <directory location>maxdb_data_area_check

Add check_maxdb.pl to crontab schedule, to run each 5 minutes. The output will be written to a logfile :
*/5 * * * * <OS user to administer MaxDB database>  <directory location>/check_maxdb.pl -t D -w <warning value for check>  -c <critical value for check> > <directory location>/<Database SID>_MaxDB_Data_Area_usage.log 2>&1

Check that Xuser entry for control user exists for the OS user specified in above crontab entry :
Logon as the OS user
$ dbmcli -U c
If no connection to the MaxDB database is made, the Xuser entry for the OS user does not exist. It can be added via :
$ xuser -U c -u CONTROL,<password> -d <database name> -n <server name> -S INTERNAL set

The logfile that will be created by crontab job, will have content like :
OK: Data Area used 2.53% (355MB/14000MB)

Next script maxdb_data_area_check must be created, this script is called by Centerity and reads the log file.


This script can be downloaded here : maxdb_data_area_check

To check the service on the MaxDB database server (see Nagios: How to Enable check_nrpe Command Line Arguments for the original post) :

Modify nagios user in /etc/passwd : change /sbin/nologin to /bin/bash

Logon to database server as nagios user.

$ /usr/local/nagios/libexec/check_nrpe -H <ip address of database server> -c maxdb_data_area_check
OK: Data Area used 2.53% (355MB/14000MB)

Note : in case of error message “CHECK_NRPE: Error – Could not complete SSL handshake” :
* add ip address of database server to allowed_hosts in file /usr/local/nagios/etc/nrpe.cfg
* restart nrpe service

MaxDB database server setup is ready now, let’s configure Centerity !

Centerity setup

In Centerity, create service SDB – MaxDB Data Area usage

Tab General :

Tab Commands :

Final result in Centerity Monitor :

When you see a message like “NRPE: Unable to read output”, probably MaxDB database is OFFLINE. To check this, additional check “SDB – MaxDB status” has been defined, as you can see here :

Evaluation

Pros :
* MaxDB Xuser file is used, no need for hard-coded password for MaxDB database user.

Cons :
* Additional scheduling is needed on the database server
* Warning and critical values for the “Data Area usage” must be maintained on database server instead of Centerity.

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *