Monitoring Petals ESB with Nagios

Introduction

Nagios is a complete infrastructure monitoring solution.

Get more details about Nagios.

The integration of Petals ESB and Nagios is based on getting information about the JVM. This is done using SNMP probes.

Installation

Nagios installation

The Nagios integration was experienced on a Linux distribution "Ubuntu Maverick Meerkat (10.10)".

Nagios 3 is available through the default Ubuntu repository. So, just install the package "nagios3" using the standard way.

Enabling the SNMP agents of the Petals ESB JVMs

As the monitoring tools can use SNMP probes to get information from the JVM running Petals ESB, we need to enable the SNMP agent of the JVM of each Petals ESB node. On each Petals node, in the environment configuration file, uncomment the system properties relative to the SNMP agent:

# Uncomment following lines to enable SNMP agent of the JVM
PETALS_JAVA_OPTS="$PETALS_JAVA_OPTS -Dcom.sun.management.snmp.port=16161"
PETALS_JAVA_OPTS="$PETALS_JAVA_OPTS -Dcom.sun.management.snmp.interface=0.0.0.0"
PETALS_JAVA_OPTS="$PETALS_JAVA_OPTS -Dcom.sun.management.snmp.acl.file=/etc/petals-esb/default-snmp.acl"

Adjust your SNMP port, interface and ACL.

Caution, if Petals ESB runs with a user different from root, you need to use a port upper than 1024. To use a port lower than 1024 with a Petals ESB launches with a standard user, refers to the utility privbind (available in standard Ubuntu repository).
To use the same port on the same machine for several java processes, refers to snmpd used as proxy.
Caution, the ACL file should be accessible (read and write: 'chmod 600 xxx') only by the user running the JVM process.
If you use OpenJDK as Java virtual machine, you can't enable the SNMP agent. It is missing because of a non-free implementation. Move to the JVM provided by Oracle.

Nagios configuration

JVM host template

A best practice to monitor Java application is to create a template 'JVM host'.

According to our environement defined above, create the file 'jvm-host-nagios2.cfg' in the directory '/etc/nagios3/conf.d' with the followin content:

define host{
        use                generic-host
        name                            jvm-host    ; The name of this host template
        notifications_enabled           1       ; Host notifications are enabled
        event_handler_enabled           1       ; Host event handler is enabled
        flap_detection_enabled          1       ; Flap detection is enabled
        failure_prediction_enabled      1       ; Failure prediction is enabled
        process_perf_data               1       ; Process performance data
        retain_status_information       1       ; Retain status information across program restarts
        retain_nonstatus_information    1       ; Retain non-status information across program restarts
        check_command                   check-host-alive
        max_check_attempts              10
        notification_interval           0
        notification_period             24x7
        notification_options            d,u,r
        contact_groups                  admins
        register                        0       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
# Specific attributes
        _snmp_port            161    ; Listening port of the JVM SNMP agent
        }

Nagios commands definition to interact with a SNMP agent

We recommand to define specific Nagios command to interact with the Java virtual machine MIB.

According to our environement defined above, create the file 'jvm.cfg' in the directory '/etc/nagios-plugins/config' with the following content:

# 'jvm_heapused' command definition
define command{
    command_name    jvm_heapused
    command_line    /usr/lib/nagios/plugins/check_snmp -H '$HOSTADDRESS$' -p '$HOSTSNMPPORT$' -C '$ARG1$' -P '$ARG2$' -o 1.3.6.1.4.1.42.2.145.3.163.1.1.2.11.0 -w :'$ARG3$' -c :'$ARG4$' -l load
    }

# 'jvm_heapmax' command definition
define command{
    command_name    jvm_heapmax
    command_line    /usr/lib/nagios/plugins/check_snmp -H '$HOSTADDRESS$' -p '$HOSTSNMPPORT$' -C '$ARG1$' -P '$ARG2$' -o 1.3.6.1.4.1.42.2.145.3.163.1.1.2.13.0 -w :'$ARG3$' -c :'$ARG4$' -l load
    }

Next coming soon

Contributors
No contributors found for: authors on selected page(s)
HOSTSNMPPORT

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.