Installation tirée du site http://www.unixmen.com/install-and-configure-nagios-in-centos-6-4-rhel-6-4/
Serveur
yum install gd gd-devel gcc glibc glibc-common wget http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm rpm -Uvh epel-release-6-8.noarch.rpm yum install nagios*
Changer le courriel pour les notifications dans le fichier:
vi /etc/nagios/objects/contacts.cfg
Editer le fichier /etc/httpd/conf.d/nagios.conf pour specifier d’autre allow, deny pour une ip en particulier
Set nagiosadmin password
# htpasswd /etc/nagios/passwd nagiosadmin New password: Re-type new password: Updating password for user nagiosadmin
Start nagios and httpd services and let them to start automatically on every boot.
service nagios start service httpd start chkconfig nagios on chkconfig httpd on
Access Nagios admin console
Open nagios administrator console with URL http://nagios-server-ip/nagios and enter the username as nagiosadmin and its password which we created in the earlier steps.
Client
wget http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm rpm -Uvh epel-release-6-8.noarch.rpm yum install nrpe nagios-plugins-all openssl
Configure Monitoring targets
Edit /etc/nagios/nrpe.cfg file,
# vi /etc/nagios/nrpe.cfg
Add your Nagios server ip address
[...] ## Line 81 - Add the Nagios server IP ## allowed_hosts=127.0.0.1,ip_du_serveur_nagios [...]
Start nrpe service:
service nrpe start chkconfig nrpe on
Sur le serveur, il faut ajouter la definition du nouvel hote:
vi /etc/nagios/nagios.cfg
and uncomment the following lines.
## Line 52 - Uncomment ## cfg_dir=/etc/nagios/servers
Create a directory called “servers” under “/etc/nagios/”.
mkdir /etc/nagios/servers
Create config file to the client to be monitored:
vi /etc/nagios/servers/clients.cfg
define host{ use linux-server host_name client alias client address 192.168.1.100 max_check_attempts 5 check_period 24x7 notification_interval 30 notification_period 24x7 }
Finally restart nagios service.
# service nagios restart