SAP Monitoring Plugins


What Are SAP Monitoring Plugins?

The SAP Monitoring Plugins are a collection of programs that allow you to monitor SAP Systems and Landscapes.

They are a sample implementation of the shared lib sap_moni.so which is freely available and give you the possibility to write own plugins or other tools.

The SAP Monitoring Plugins consists of five programs:

  • check_sap
  • check_sap_multiple
  • check_sap_multiple_no_thr
  • check_sap_system
  • check_sap_instance
  • Configuring SAP Monitoring Plugins?

    To configure the Plugins you need four files in /etc/sapmon

  • agent.cfg: Configures which datas will be collected from SAP-System
  • moni_tr.cfg: Helpfile for agent.cfg: Translates easy syntax
  • login.cfg: Logon-data to the systems
  • ssh_config: ssh_config file
  • /etc/sapmon/agent.cfg

    Configures which datas will be collected from SAP-System.
    It has a template syntax. You can choose between an easy syntax or advanced syntax.

  • Easy Syntax

    [TEMPLATE_]
    DESCRIPTION = Description of the Templates e.g. simple Template
    SYSTEM = SID e.g. BCE | BC? | B*
    APPL-SERVER = APPL-SERVER e.g. bcemain_BCE_26 | bce* | *
    VALUE = VALUE e.g. DIALOG_RESPONSE_TIME

    Example:
    [TEMPLATE_TEST]
    SYSTEM = BCE
    APPL-SERVER = *
    VALUE = DIALOG_RESPONSE_TIME

    The template named test collects the Dialog Response Time of all Applicationservers of the system BCE.
    The Pattern you can use as VALUE are defined in /etc/moni_tr.cfg


  • Advanced Syntax

    [TEMPLATE_]
    DESCRIPTION = Description of the Templates e.g. simple Template
    MONI_SET_NAME= MONISET e.g. "SAP ADMIN TEMPLATE"
    MONI_NAME= Monitor of the set e.g. "Operating System"
    MAX_TREE_DEPTH = n e.g. 3
    PATTERN_0=SID\Context\Monitorobject\Monitorattribute.g. BCE\bcemain_BCE_26\CPU\CPU_UTILIZATION
    PATTERN_=SID\Context\Monitorobject\Monitorattribute.g. BCE\bcemain_BCE_26\CPU\CPU_UTILIZATION


    The MONI_SET_NAME is the name of the moniset in SAP (TX RZ20); the MONI_NAME the name of the monitor in the moniset.
    The optional parameter MAX_TREE_DEPTH defines the depth of the loaded monitor (default 0 = entire monitor)
    The whole monitor will be downloaded. Thus we are only interested in a certain couple of values, we can limit the values through pattern.
    The pattern consists of a 4-Tupel: SID\Context\Monitorobject\Monitorattribut
    If a node matches the pattern it will appear, otherwise the node is deletet.

    Define your own monitor in TX RZ20: So only the relevant nodes are downloaded
  • /etc/sapmon/moni_tr.cfg

    The moni_tr.cfg defines the translation from the simple syntax to the advanced syntax.

    [TEMPLATE_TEST]
    SYSTEM = BCE
    APPL-SERVER = *
    VALUE = DIALOG_RESPONSE_TIME

    is translated to

    [TEMPLATE_TEST]
    MONI_SET_NAME="SAP ADMIN TEMPLATE"
    MONI_NAME="Dialog Overview"
    PATTERN_0="BCE\*\DIALOG\DIALOGRESPONSETIME"

    The entry in the moni_tr.cfg looks like:
    DIALOG_RESPONSE_TIME#SAP ADMIN TEMPLATE# Dialog Overview#DIALOG\DIALOGRESPONSETIME

    That means that for the VALUE=DIALOGRESPONSETIME the Monitor "Dialog Overview" from the monitorset "SAP ADMIN TEMPLATE" is loaded.
    The pattern is concatenated to \\rest: (DIALOG\DIALOGRESPONSETIME).

    You can easily enhance the moni_tr.cfg.

    /etc/sapmon/logon.cfg

    The connection to the R/3 system is an RFC-Connection.
    Thus this you need the system- and logon-data.

    [LOGIN_templatename]
    LOGIN=Arguments

    Arguments:
    -D -u -p -c |
    -d -u -p -c -h -s [ -l -t -g -x ]

    -d destination
    -D destination, uses saprfc.ini
    -u userid
    -p password
    -c client
    -l language
    -t Trace
    -h hostname
    -s system number
    -g gateway host
    -x gateway service


    You can decide if you want to use the saprfc.ini
    If you want to use the saprfc.ini: -D Destination -u user -p passwd -c client.
    The destination must exist in the saprfc.ini

    Otherwise: -d Destination -u user -p passwd -c client -h hostname -s system number

    Example:
    [LOGIN_BCE]
    LOGIN=-d BCE -u ag_t -p *** -h bcemain -s 26

    /etc/sapmon/sshconfig

    To start and stop an R/3-System ssh is used.
    If you don't have the possibility to see the output via X11-Forwarding, the commands are executed in background. Thus they are executed in background you can't enter a password.
    The sshconfig is used to disable the password prompt if it runs in background.

    Example:
    PasswordAuthentication no

    Configure a hostauthentification between nagios host (root) and SAP-host (sidadm)

    Configuring Nagios

    Now we can configure nagios. There is nothing special to do:

    We have our five plugins with the following commands:

  • check_sap Monitemplate RFC-Template
  • check_sap_multiple Monitemplate RFC-Template
  • check_sap_multiple_no_thr Monitemplate RFC-Template
  • check_sap_system SID RFC-Template
  • check_sap_instance APPL-Server RFC-Template

  • check_sap returns the data specified in the Monitemplate.
    check_sap_multiple returns the data specified in the Monitemplate. It can show several values
    check_sap_multiple_no_thr like check_sap_multiple. But you cannot change any thresholds. The advantage is that less space is used and you can show more nodes.
    check_sap_system returns the app-server of an system and their status. CCMS-Ping has to be installed.
    check_sap_instance returns standard data to the appserver. CCMS-Ping has to be installed.


  • Copy plugins to the plugin-directory
  • Add the monitored host to the nagios host-file

    define host{
    host_name bcemain
    alias bcemain_BCE_26
    address 10.17.72.234
    max_check_attempts 5
    notification_interval 30
    notification_period 24x7
    notification_options d,u,r
    }

    The alias must match the SAP name. Otherwise no SAP-Addons will be available
  • Add methods/plugins (checkcommands.cfg)

    # 'SAP Monitoring' command definition
    define command{
    command_name check_sap
    command_line $USER1$/check_sap $ARG1$ $ARG2$
    }
    ...
  • Link the methods to the hosts (services.cfg)

    define service{
    use generic-service
    host_name BCE
    service_description System BCE
    is_volatile 0
    check_period 24x7
    max_check_attempts 3
    normal_check_interval 300
    retry_check_interval 1
    contact_groups linux-admins
    notification_interval 300
    notification_period 24x7
    notification_options w,u,c,r
    check_command check_sap!dialog!BCE!
    }

  • You can use the tool create_cfg to create templates for standards of an app-server

    Enhanced Functionality

    You can not only get data from an R/3-System, you have some extra features in nagios.
    If the host-alias is an SAP-Alias (Appl.server_SID_Systemnr) you can start/stop R/3 systems. You can also open an ssh-connection to the host or open an SAPGUI. At last you can change the thresholds.

    After you clicked on the hostname, a menue opens where you can start/stop SAP-Systems or open a SAPGUI or a ssh-connection.
    You can change the thresholds after a click of the values.