Friday 11 July 2014

Part2 :BigData Cluster Monitoring (Ganglia Metric configuration with Nagios)

Ganglia Metric configuration with Nagios
In order to set up ganglia metrics with nagios,do the following steps;

1. Download the Ganglia Metrics script (https://github.com/ganglia/ganglia-web/wiki/Nagios-Integration).Note the script requires PHP CLI binary
To test invoke PHP from the command line e.g. php --version or php5 --version. If you get something back you are good to go. Otherwise
Under Ubuntu install using apt-get:
sudo apt-get install php5-cli
2. You have to have Ganglia Web package installed and you have to configure it (conf.php) so that it pulls data off a server that aggregates data off of servers you want to monitor. By default Ganglia Web connects to localhost. Default local for ganglia-webfrontend on Ubuntu is /usr/share/ganglia-web-frontend.
Change following variables if your set up is different
sudo vi conf.php
$ganglia_ip = "127.0.0.1";
$ganglia_port = 8652;

3. Once you have Ganglia Web installed adjust the path in the check_ganglia_metric.php script to point to it e.g. it defaults to
$GANGLIA_WEB="/usr/share/ganglia-webfrontend" {for Ubuntu}
4. Now execute the script you downloaded above ie. php check_ganglia_metric.php. You should see
  Usage:  check_ganglia_metric.phps <hostname> <metric> <less|more|equal|notequal> <critical_value> ie.

5) At this point try to run an actual test e.g.
    check_ganglia_metric.php localhost disk_free less 10
If that succeeded you are now ready to configure Nagios
6) Now configure the Nagios Plugin config file
sudo vi /etc/nagios-plugins/config/ganglia.cfg

Add the following
# check Ganglia metrics
define command {
command_name check_ganglia
command_line /usr/lib/nagios/plugins/config/check_ganglia_metric.php localhost $ARG1$ $ARG2$ $ARG3$
}
7) Now you can use it in a service check. For instance say you want to be alerted if 1-minute load average went over 5 you would add following directive

define service{
use  generic-service         ; Name of service template to use
host_name                       localhost
service_description             Ganglia Checking
check_command                    check_ganglia!load_one!more|5
        }
   
8) Restart Nagios server.

9) Now click on the Ganglia-Checking service from Nagios webUI 

No comments:

Post a Comment