Monitor MaxDB state

Monitor MaxDB state

It’s quite simple to get vital information from a MaxDB database all you have to do is run the command “info state” when connected to dbmcli:

# ./dbmcli -d MAXDB -u DBADMIN,PASSWD
./dbmcli on MAXDB>info state
OK
END
Name                    | Value

 

Data           (KB)     = 17682104
Perm Data      (KB)     = 17681528
Temp Data      (KB)     = 576
Data        (Pages)     = 2210263
Perm Data   (Pages)     = 2210191
Temp Data   (Pages)     = 72
Data            (%)     = 30
Perm Data       (%)     = 30
Temp Data       (%)     = 0
Log            (KB)     = 11008
Log         (Pages)     = 1376
Log             (%)     = 4
Sessions                = 31
Sessions        (%)     = 31
Data Cache      (%)     = 100
Converter Cache (%)     = 0
Data Max       (KB)     = 58719360
Log Max        (KB)     = 305872
Data Max    (Pages)     = 7339920
Log Max     (Pages)     = 38234
Sessions Max            = 100
Database Full           = No
Connect Possible        = Yes
Command Monitoring      = Off
Database Monitoring     = On
Kernel Trace            = Off
Autosave                = On
Bad Indexes             = 0
Log Full                = No
Bad Devspaces           = 0
Data Cache OMS      (%) = 0
Data Cache OMS Log  (%) = 0

---
./dbmcli on MAXDB>

You can easily retrieve that information with a custom script to monitor your database with nagios’ nrpe client for example.
Just to show you a quick example of script, this is what I did when I had an issue an application using MaxDB database.
(I had to be alerted if some unusual thresholds were exceeded).

#!/bin/ksh
MAXDB_BIN="/Database/MaxDB/Software/programs/bin"
DB_NAME="MAXDB"
DB_PASS="DBADMIN,PASSWD"
# thresholds
MAX_DATA=50 # % data
MAX_TDATA=10 # % tempo data
MAX_LOG=50 # % log
MAX_SESS=50 # % sessions
echo "info state" | ${MAXDB_BIN}/dbmcli -d ${DB_NAME} -u ${DB_PASS} > /tmp/db_state.log
P_DATA=$(grep -E '^Data *\(\%\)' /tmp/db_state.log |awk -F"=" '{print $2}'|sed 's/ //g')
P_TDATA=$(grep -E '^Temp Data *\(\%\)' /tmp/db_state.log |awk -F"=" '{print $2}'|sed 's/ //g')
P_LOG=$(grep -E '^Log *\(\%\)' /tmp/db_state.log |awk -F"=" '{print $2}'|sed 's/ //g')
P_SESS=$(grep -E '^Sessions *\(\%\)' /tmp/db_state.log |awk -F"=" '{print $2}'|sed 's/ //g')
# if one of the parameters is higher than the thresholds an email is sent.
if [[ ${P_DATA} -gt ${MAX_DATA} ]] || [[ ${P_TDATA} -gt ${MAX_TDATA} ]] || [[ ${P_LOG} -gt ${MAX_LOG} ]] || [[ ${P_SESS} -gt ${MAX_SESS} ]]; then
echo "Data : ${P_DATA} %, Temp Data : ${P_TDATA} %, Log : ${P_LOG} %, Sessions : ${P_SESS} %" |mail -s "MaxDB alerte on `hostname`" myemail@mydomain.com
fi

Leave Comment

Your email address will not be published. Required fields are marked *