Bernard Li wrote:
> Can you explain a bit regarding how you integrate the Ganglia metrics
> into Nagios?  Is this automated?
>   

What you have to know is that Nagios is just an alerting engine. Real 
work for Nagios is done using Nagios plugins that provide the necessary 
checks. Nagios simply schedules these checks depending on the 
configuration and based on the return value of the script e.g. 0 for OK, 
1 for WARNING and 2 for CRITICAL, 3 for UNKNOWN etc. an alert is sent. 
So what you have to do is write a script that is aware of Ganglia 
metrics and is able to produce error codes. Since I couldn't get the 
python script to give me raw metrics I needed to install whole Ganglia 
suite on my Nagios box ie. gmond/gmetad with Web Interface. You also 
need to install PHP interpreter (php-cli RPM for those uninitiated) Then 
you do something like this


<?php

$ganglia_web="/var/www/html/ganglia";
include_once "$ganglia_web/conf.php";
include_once "$ganglia_web/get_context.php";
# This is important. You get cluster summary
$context = "cluster";
include_once "$ganglia_web/functions.php";
include_once "$ganglia_web/ganglia.php";
include_once "$ganglia_web/get_ganglia.php";

print_r ($metrics)

?>

Put this in a file then run

php stuff.php

And you get a nice array output of all Ganglia metrics. Then you just 
pick them out. For instance I have used swap_free and disk_free in the 
past. All you have to do is

$hostname = "host.domain.com";
print $metrics[$hostname]['swap_free']['VAL'];

and voila you get swap_free value :-). Then you just write something 
that checks against some value

if ( $metrics[$hostname]['swap_free']['VAL'] > $argv[2] ) {
    print ("SWAP OK");
    exit (0);
} else {
   print "SWAP CRITICAL";
   exit (2);
}

and you integrate this into Nagios. If I am motivated enough I'll write 
a generic Ganglia Nagios script :-).

Vladimir

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Ganglia-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-general

Reply via email to