Architecture:
Nagios is the same as ganglia can be monitoring software, but there are two different, the advantage of ganglia is real-time on the monitoring cluster of the machine's indicators, such as CPU, memory, disk, temperature and other data, summarized into a variety of graphical interface, and provide callable data. And in the event of a problem, the alarm prompt function, relatively weak.
Nagios has the advantage of being able to provide powerful alarm alerts when problems arise, but in time monitoring, the functionality is weak, and even using the Nrpe plug-in is not enough to provide powerful machine monitoring, so combine the two together. Realize monitoring, alarm function.
Environment Introduction:
1. The ganglia is already installed in the server, the installation process reference: http://9480860.blog.51cto.com/9470860/1746122
2. Nagios is already installed on the server and the installation process is described in: http://9480860.blog.51cto.com/9470860/1746124
Installation ideas:
The ganglia interface is invoked through Nagios to obtain monitoring metrics for the entire server. If the set of indicators is exceeded, the alarm will be given.
Installation process:
the combination of 1.Ganglia and Naios
# CP ganglia-3.6.0/contrib/check_ganglia.py/usr/local/nagios/libexec/# Chown nagios.nagios check_ganglia.py #/usr/ local/nagios/libexec/check_ganglia.py
2. Modify the Gmetad configuration so that its shared monitoring data
# vim /usr/local/ganglia/etc/gmetad.conf trusted_hosts 127.0.0.1 192.168.235.138 cjx## vim check_ganglia.py Modify the alarm script try: s = socket.socket (Socket.af_inet, socket. Sock_stream) s.connect ((ganglia_host,ganglia_port)) parser = gparser (host, metric) value = parser.parse (S.makefile ("R")) s.close () Except exception, err: print "checkganglia unknown: error while getting value \"%s\ "" % (Err) sys.exit (3) if critical > warning: if value >= critical: print "checkganglia critical: %s is %.2f" % (metric, value ) Sys.exit (2) elif value >= warning: print "checkganglia warning: %s is %.2f" % (metric, value) sys.exit (1) else: print "checkganglia ok: %s is %.2f" % (Metric, value) &nbsP; sys.exit (0) else: if critical >= value: print " checkganglia critical: %s is %.2f " % (metric, value) sys.exit (2) elif warning >= value: print "checkganglia warning: %s is %.2f " % (metric, value) sys.exit (1) else: print " checkganglia ok: %s is %.2f " % (metric, value) sys.exit (0) // Alarm scripts require special attention to format, otherwise error prompts are displayed # python check_ganglia.py -h cjx -m load_one -w 10 -c 100
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" height= "" Width= "554" alt= "" Spacer.gif "/>
3. increase the command to detect ganglia
# vim/etc/nagios/objects/commands.cfg # ' check_ganglia ' command definitiondefine command{command_name check_ga Nglia command_line $USER 1$/check_ganglia.py-h $HOSTADDRESS $-M $ARG 1$-W $ARG 2$-c $ARG 3$}
4. Defining Ganglia Templates
# vim templates.cfg define service{ name ganglia-service ; the name of this service template use generic-service hostgroup_ name gangliaservers service_groups gangliametrics register 0 }
5.
[[email protected] objects]# vim hosts.cfg define host{ Use linux-server host_name cjx alias manager address 127.0.0.1 icon_image server.gif statusmap_image server.gd2 2d_coords 200,300 3d_coords 200,300,100 }define hostgroup{ hostgroup_name ganglia-servers ; the name of the hostgroup alias ganglia servers ; long name of the group members *; }~
5. Defining Services
[Email protected] objects]# Vim service.cfg define Servicegroup {#servicegroup_name Ganglia-metricsservicegroup_name Gangliametricsalias Ganglia metrics}define Service {use Ganglia-servicehost_name Cjxhostgroup_name Ganglia-serversservice_description Load_onecheck_command check_ganglia!load_one!4!5} define Service{host_name Cjxhostgroup_name ganglia-serversuse ganglia-serviceservice_description Disk_freecheck_command check_ganglia!disk_ free!0.2!0.1}//define the service must define the host, main group, service groups, or error, warning errors will appear, and the Internet is not good to find the answer
6. Add the file path to the nagios master configuration file
[Email protected] objects]# CD. # vim/etc/nagios/nagios.cfg Cfg_file=/etc/nagios/objects/hosts.cfgcfg_file=/etc/nagios/objects/service.cfg
7. verify that the configuration is correct
#/usr/local/nagios/bin/nagios-v/etc/nagios/nagios.cfg
8. Restart the Nagios service
# Service Nagios Restart
9. Open the Nagios-web page to see the relevant information
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7C/A2/wKioL1bUJwji6OWIAAEjiEPiElQ821.png "style=" float: none; "title=" QQ picture 20160229190616.png "alt=" Wkiol1bujwji6owiaaejiepielq821.png "/>
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7C/A3/wKiom1bUJpOCsuIMAAERNv1mqPM366.png "style=" float: none; "title=" QQ picture 20160229190635.png "alt=" Wkiom1bujpocsuimaaernv1mqpm366.png "/>
Look at the Web page quietly at this time.
This article is from the "9470860" blog, please be sure to keep this source http://9480860.blog.51cto.com/9470860/1746129
Nagios Plugin Ganglia Plugin