1. Copy the required script to the Nagios script directory and set the permissions
Cp-fr./ganglia-3.7.1/contrib/check_ganglia.py/usr/local/nagios/libexec//usr/local/nagios/libexec/ 755/usr/local/nagios/libexec/check_ganglia.py
2. Add a Check_ganglia command
Edit the Commands.cfg file and add the following:
# ' check_ganglia ' command definition define command {command_name check_ganglia command_line $USER 1$/check_ganglia.py-h $HOSTNAME $-M $ARG 1$-W $ARG 2$-c $ARG 3$}
3.check_ganglia.py How to use:
./check_ganglia.py-h
Check_gmond:option-h requires argument
usage:check_ganglia-h|--host=-m|--metric=-w|--warning=-c|--critical= [-s|--server=] [-p|--port=]
-H: Specifies the nodes of the monitor
-m specifies the metric of the monitor
-W Specify wanning value
-C Specify error value
-s Specifies ganglia server
-P Specify port
/usr/local/nagios/libexec/check_ganglia.py-h puppet.sa.beyond.com-m load_one-w 1-c 2
4. Configure monitoring according to the script usage method
Define Service {use Beyond-service host_name test.sa.beyond.com service_description check_load_one Check_c Ommand check_ganglia!load_on!1!2}define Service {use beyond-service host_name test.sa.beyond.com service_description check_load_five check_ Command check_ganglia!load_five!0.9!1}define Service {use beyond-service host_name test.sa.beyond.com service_description check_load_fifteen che Ck_command check_ganglia!load_fifteen!1!2}
5. Open the Nagios interface to see the effects
6. Add ganglia to Nagiosui on the map
If the host and service names are consistent in ganglia and nagios, then only the built-in Nagios macros can be used to refer the Action_url of any service back to the ganglia graph.php file so that the user clicks the action in Nagiosui _url to request a service, you can get the data of this service in Ganglia icon form.
For example: A service Load_one we can use the following statement to get ganglia data
Http://203.130.45.173:9100/ganglia/graph.php?c=beyond&h=puppet.sa.beyond.com&m=load_one&r=hour &z=large
C indicates the cluster the host is located in
H means that the host can use the Nagios built-in macro hostname to pass
M means that metric can use the Nagios built-in macro Servicedesc to pass
Since there is no concept of clustering in Nagios, automatic macros are required to pass the cluster of the host. Nagios custom macros begin with an underscore, as shown below
Finally for unified management, you can add the template to the Action_url
Restart Nagios. will see the icon on the Nagios UI, and when clicked in, it is ganglia's chart
<wiz_tmp_tag id= "Wiz-table-range-border" contenteditable= "false" style= "Display:none;" >
From for notes (Wiz)
Ganglia using Nagios alarms