Monitoring Petals ESB with Nagios

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (47)

View Page History
Nagios is a complete infrastructure monitoring solution.


[Get more details about Nagios.|http://www.nagios.org/]


The integration of Petals ESB and Nagios is based on getting information about the JVM. This is done using SNMP probes.
{info}Following examples are based on a Petals ESB topology composed of two nodes on the same host.{info}
h1. Installation


h2. Nagios installation

The Nagios integration was experienced on a Linux distribution "Ubuntu Maverick Meerkat (10.10)".
The Nagios integration was experienced on a Linux distribution "Ubuntu Quantal Quetzal (12.10)", using the Sun/Oracle JVM v1.6.0.43

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


h2. JVM host template

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

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

{code}
define host{
# Specific attributes
    _snmpport             161     ; Listening port of the JVM SNMP agent
_jmxport 9999 ; Listening port of the JVM JMX agent
        }
{code}

Interresting commands will be:

* jvm_heapused: to get the real heap memory used by the Petals ESB node,
* jvm_heapmaxused: to get the current allocated (commited) heap size. This value should be check against the heap max size at the JVM level to generate alarms.

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

{code}
# 'jvm_heapused' command definition
h2. Petals ESB host template

A best practice to monitor Petals ESB nodes is to create a template 'Petals ESB host' that inherites from the 'JVM host'.:

According to our environment defined above, create the file 'petals-esb-host-nagios2.cfg' in the directory '/etc/nagios3/conf.d' with the following content:

{code}
define host{
        use                             jvm-host
        name                            petals-esb-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
        _snmpport                       161     ; Listening port of the JVM SNMP agent
_snmpport 16161 ; Listening port of the JVM SNMP agent. Redefined because Petals is not started by 'root'
_jmxport 7700 ; Listening port of the JVM Petals JMX agent
        }
{code}



h2. Defining your Petals ESB hosts

For each Petals ESB node of your Petals ESB topology, create an instance of the template 'petals-esb-host'.:

According to our environment defined above, create the file 'petals-esb-host-node1.cfg' in the directory '/etc/nagios3/conf.d' with the following content:
{code}
define host{
        alias                   Petals ESB Node 1
        address                 127.0.0.1
        _snmpport               16161 ; This value should be set with the SNMP
; agent listener port of your Petals ESB node.
# Specific attributes: Uncomment to specify a value different from the default one
# _snmpport 16161 ; Listening port of the JVM SNMP agent
# _jmxport 7700 ; Listening port of the Petals JMX agent
        }
{code}
and create the file 'petals-esb-host-node2.cfg' in the directory '/etc/nagios3/conf.d' with the following content:
{code}
define host{
        use                     petals-esb-host            ; Name of host template to use
        host_name               petals-esb-node-2
        alias                   Petals ESB Node 2
        address                 127.0.0.1 192.168.1.25
        _snmpport               16162 ; This value should be set with the SNMP
; agent listener port of your Petals ESB node.
# Specific attributes: Uncomment to specify a value different from the default one
# _snmpport 16161 ; Listening port of the JVM SNMP agent
# _jmxport 7700 ; Listening port of the Petals JMX agent
        }
{code}
h2. Defining your Petals ESB topology as a Petals ESB host group

The Petals ESB topology can be considered as a Nagios host group composed of your Petals ESB nodes.:

So, according to our environment defined above, create the file 'petals-esb-hostgroup.cfg' in the directory '/etc/nagios3/conf.d' with the following content:

{code}
define hostgroup {
        hostgroup_name petals-esb
        alias           Petals The ESB
        members         petals-esb-node-1, petals-esb-node-2
        }
h2. Petals ESB host services

A best practice to monitor Petals ESB nodes is to create a template of services to associate to each Petals ESB nodes.
We group all Petals ESB host services:
{code}
define servicegroup{
servicegroup_name petals-services
alias Petals ESB Services
}
{code}

According to our environement defined above, create the file 'petals-esb-services.cfg' in the directory '/etc/nagios3/conf.d' with the following content:

A best practice to monitor Petals ESB nodes is to create a template of services to associate to each Petals ESB nodes:
{code}
# Define a service to check the disk space of the root partition# Define a service to check the disk space of the root partition partitions
# on the local machine. Warning if < 20% free, critical if
# Warning if < 20% free, critical if < 10% free space on partition.
# Adapt the last parameter of "check_disk" to check only the
# partitions where dynamic data (as log files, repository) are
# written by petals (/var/lib/petals-esb, /var/log/petals-esb).
# Probably two services will be required with different thresholds.
define service{
use generic-service
hostgroup_name petals-esb
service_description Disk Space
check_command check_all_disks!20%!10% check_disk!20%!10%!/var
}
servicegroups petals-services
}


# Define a service to check the load on the local machine.
define service{
service_description Current Load
check_command check_load!5.0!4.0!3.0!10.0!6.0!4.0
servicegroups petals-services
}

service_description Current heap memory
check_command jvm_heapused!public!2c!912680550!1020054732
servicegroups petals-services
}

service_description Current commited heap memory size
check_command jvm_heapmaxused!public!2c!912680550!1020054732
servicegroups petals-services
}
{code}
h2. Restart Nagios

Restart your Nagios service to take into account the configuration.:
{code}
sudo service nagios3 restart
{code}
{column}
{section}