Monitoring SAP HANA

Since Checkmk 1.5, it is possible to monitor SAP HANA. 

LAST TESTED ON CHECKMK 2.3.0P1

Table of Contents


In this manual, we will explain all configuration options for SAP Hana. Especially the options of sap_hana.cfg if the use of the Agent Bakery is not possible. The easiest way to get the Plugin working is to use the Agent Bakery:

SetupAgentsWindows, Linux, Solaris, AIX Agent RulesSAP HANAAdd Rule

SAP HANA Config example

Please don't modify sap_hana.cfg if you're using the Agent Bakery.

Example: Credentials = User and password / RUNAS = instance / SID = XYZ

/etc/check_mk/sap_hana.cfg
USER=kdeadm
PASSWORD=xyz
RUNAS=instance
SID=XYZ


Example: Credentials = User and password / RUNAS = agent / SID = XYZ

/etc/check_mk/sap_hana.cfg
USER=kdeadm
PASSWORD=xyz
RUNAS=agent
SID=XYZ

Example: Credentials = USERSTOREKEY / RUNAS = instance or agent / SID = XYZ

/etc/check_mk/sap_hana.cfg
USERSTOREKEY=xxx
RUNAS=instance
SID=XYZ


The configuration of the SID in the sap_hana.cfg is optional. The agent plugin detects the SID automatically.


Example: Credentials for Connect (ODBC interface)

With Werk #10937 (Checkmk 2.0) we introduced a new check to monitor the status of SAP HANA Connect. It supports HANA V1.0 and HANA 2.0. In order to get the needed data from SAP HANA, you need to update the agent plugin "mk_sap_hana" as well. 


Screenshot of Credentials for Connect (ODBC interface) seleceted. User set to obdc and password set as explicit.


/etc/check_mk/sap_hana.cfg
...
PASSWORD_CONNECT="123"
USER_CONNECT="hana"
...


Difference between RUNAS=agent and RUNAS=instance

++ credentials='-u SAP_MON -p Hana4us1'
++ '[' agent = agent ']'
+++ /usr/sap/KDE/HDB00/exe/hdbsql -C '-F;' -x -a -n localhost -i 00 '-u SAP_MON -p Hana4us1' 'SELECT Name, Status, Value FROM M_SYSTEM_OVERVIEW Where NAME='\''Version'\'' or NAME='\''All Started'\'' '

With RUNAS=agent the Checkmk Agent tries to execute the mk_sap_hana Plugin


su - hp1adm -c '/usr/sap/HP1/HDB00/exe/hdbsql -C -F\; -x -a -n localhost -i 00 -u SAPCMK -p CMK#123 "SELECT Name, Status, Value FROM M_SYSTEM_OVERVIEW Where NAME='\''Version'\'' or NAME='\''All Started'\''"'

 With RUNAS=instance the Checkmk Agent connects with the SAP instance user to the database

Debugging

Execute plugin manually

For testing and diagnosis, you can execute the plugin manually. You need to set 'MK_CONFDIR' so that mk_sap_hana can find the configuration file which is stored in /etc/check_mk

MK_CONFDIR=/etc/check_mk /usr/lib/check_mk_agent/plugins/mk_sap_hana


Debug Log

The mk_sap_hana Plugin provides a detailed log. Therefore, you can use --debug. Please redirect the output to a file for a better overview.

MK_CONFDIR=/etc/check_mk /usr/lib/check_mk_agent/plugins/mk_sap_hana --debug


SQL Statements

For debugging, it can be useful to execute some SQL-Statements manually. Please check out the debug log for more information.

Here is one example of SAP HANA Status:

su - <INSTANCE_USER>
/usr/sap/KDE/HDB00/exe/hdbsql -C '-F;' -x -a -n localhost -i 00 '-u BECHTLE_MON -p Hana4us1' 'SELECT Name, Status, Value FROM M_SYSTEM_OVERVIEW Where NAME='\''Version'\'' or NAME='\''All Started'\'' '