Nagios-pluginAndNrpeThe quick deployment method is as follows:
1. Install nagios-plugin and nrpe on any monitored machine. The installation directory is the same as/usr/local/nagios or depends on your actual requirements, at the same time, it is best to have mysql on the monitored machine, so that the script for monitoring mysql will be compiled, one benefit of the two software in the same directory is that the two software can use each other's programs in the libexec directory.
Simple nagios-plugin installation
./Configure -- prefix =/usr/local/nagios -- with-nagios-user = nagios -- with-nagios-group = nagios -- with-mysql =/usr/local/mysql
Make
Make install
Simple installation of nrpe
. /Configure -- prefix =/usr/local/nagios -- with-nrpe-user = nagios -- with-nrpe-group = nagios -- with-nagios-user = nagios -- with-nagios- group = nagios
Make
Make install
Make install-xinetd
Make install-daemon-config
2. Modify/etc/xinetd. d/nrpe file. You only need to comment out only_from here. Of course, if you only have one invigilator, you can change the ip address to the ip address of your invigilator.
3. Modify nrpe. cfg file, because I want the listening ip addresses of each monitored server to bind to the ip address of the Local intranet Nic, so I will remove the comments in the line # server_address = 127.0.0.1.
Modify
Command [check_hda1] =/usr/local/nagios/libexec/check_disk-w 20%-c 10%-p/dev/hda1
Is
Command [check_disk] =/usr/local/nagios/libexec/check_disk-w 20%-c 10%
You can also write all the required monitoring resources here.
4. For packaging, the next task is to hit the nrpe file under the nagios directory and xinetd. d directory into a package as the basic package for distribution.
Tar zcvf nagios.tar.gz/usr/local/nagios/etc/xinetd. d/nrpe
5. Distribute the package and execute the configuration script. Distribute the prepared tar package and the following script to the server to be deployed and execute the script. Then, the monitored server is configured, of course, the following script can be adjusted based on your actual application. As for the distribution method, you can just use it. Generally, rsync, scp, and cfengine are used for unified configuration.
1 #! /Bin/bash
2
3 useradd-s/bin/false nagios
4 tar zxvf nagios.tar.gz-C/
5
6 IP = $ (grep IPADDR/etc/sysconfig/network-scripts/ifcfg-eth0 | awk-F' = ''{print $2 }')
7 sed-I-e's/ss = 127.0.0.1/ss = '$ {IP}'/'-e's/^ allowed. */&, 192.168.202.129, '$ {IP}'/usr/local/nagios/etc/nrpe. cfg
8 sed-I-e '7 a \ bind = '$ {IP}/etc/xinetd. d/nrpe
9 echo "nrpe 5666/tcp">/etc/services
10/etc/init. d/xinetd restart