First, the server-side installation:
1 , build on the service side Lamp Environment
Yum install-y httpd php
2 , server-side installation Nagios Main program
Useradd-s/sbin/nologing
./configure--prefix=/usr/local/nagios--with-command-group=nagios
./configure when Perl command not found is found to install Perl this package, or make all will be error yum install-y perl
Make all
Make install, makeinstall-init;make install-config;make install-commandmode; make install-webconf
3 , server-side installation Nagios-plugins plug-in, monitoring with
./configure--prefix=/usr/local/nagios--with-nagios-user=nagios--with-nagios-group=nagios
make&& make Install
4 , server-side installation Nrpe, communication with the client
./configure--enable-ssl--with-ssl-lib
Make all
Makeinstall-plugin && make Install-daemon && makeinstall-daemon-config
Chown-rnagios:nagios/usr/local/nagios
5 , Nagios access control settings
Htpasswd-c/usr/local/nagios/etc/htpasswd.users Nagiosadmin
Enter the password two times, the login page will use this password
6 , restart Nagios httpd service
Use commands before restarting Nagios
/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg , no problem with detection, restart again
/etc/init.d/nagios Restart; /ETC/INIT.D/HTTPD restart
Second, the client installation:
1 , installation Nagios-plugins
Useradd-s/sbin/nologing Nagios
./configure –prefix=/usr/local/nagios
Make
Makeinstall
2 , installation Nrpe
./configure--enable-ssl--with-ssl-lib
Make all
Makeinstall-plugin && make Install-daemon && makeinstall-daemon-config
chown-rnagios:nagios/usr/local/nagios/
To start the client Nrpe command
/usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe.cfg-d
3 , client Nrpe settings
Vi/usr/local/nagios/etc/nrpe.cfg
Add the Nagios server-side IP address after the allowed_hosts=127.0.0.1 field
; server_address=127.0.0.1 This field do not change, keep the state of comments, Nrpe need to open the service on 0.0.0.0:5666
Iii. 6 steps for the Nagios server to monitor a client
1 , install Nrpe,nagios-plugins on both the server side and the client
2 , modify the allowed IP (IP on the server) in the client-defined monitoring project
3 , start the server side, Nrpe the client, start the command /usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe.cfg–d
After the client starts, it can execute the command/usr/local/nagios/libexec/check_nrpe-h 127.0.0.1 in the native machine, to detect, if the Nrpe version appears, the Nrpe on behalf of the machine is OK
/usr/local/nagios/libexec/check_nrpe–h Peer IP, to detect Nrpe communication is not good
4 , define the Check_nrpe command in server-side commands.cfg:
Define Command{
Command_name Check_nrpe
Command_line $USER 1$/check_nrpe-h $HOSTADDRESS $-c$arg1$
}
5 , in the server-side IP-corresponding configuration file, add the items that need to be monitored:
Define Service{
Use Local-service host_name 192.168.1.12
Service_description Sda1_monitor
Check_command Check_nrpe!check_u
Notifications_enabled 1
}
6 , in the server's main configuration file, refer to an IP corresponding configuration file, that is, in/usr/local/nagios/et/nagios.cfg about 35 lines in the location to add such a line:
cfg_file=/usr/local/nagios/etc/objects/192.168.223.132.cfg , or
cfg_dir=/usr/local/nagios/etc/192.168.223.0/ , the line above refers to a configuration file, and the following line refers to all of the configuration files in a directory
This article is from the "PC personal blog" blog, make sure to keep this source http://pc1990.blog.51cto.com/10541224/1676585
Nagios Monitoring Platform Setup-Installation Chapter