Skip to main content

Nagios NRPE

 

Downloading Nagios Core:

https://www.nagios.org/downloads/nagios-core/thanks/?t=1500128149

Installing Nagios Core:

Installation is really easy just follow the guide:

https://assets.nagios.com/downloads/nagioscore/docs/Installing_Nagios_Core_From_Source.pdf#_ga=2.210947287.396962911.1500126138-104828703.1500126138

Once its installed you need to add your hosts and the services.

L'ets create a host and a service:

vi /usr/local/nagios/etc/nagios.cfg
cfg_file=/usr/local/nagios/etc/hosts.cfg
cfg_file=/usr/local/nagios/etc/services.cfg
vim /usr/local/nagios/etc/servers/hosts.cfg
define host{
name                            linux-box               ; Name of this template
use                             generic-host            ; Inherit default values
check_period                    24x7        
check_interval                  5       
retry_interval                  1       
max_check_attempts              10      
check_command                   check-host-alive
notification_period             24x7    
notification_interval           30      
notification_options            d,r     
contact_groups                  admins  
register                        0                       ; DONT REGISTER THIS - ITS A TEMPLATE
}
vim /usr/local/nagios/etc/servers/servers.cfg
define service{
use                     generic-service
host_name               tecmint
service_description     CPU Load
check_command           check_nrpe!check_load
}
vi /usr/local/nagios/etc/objects/commands.cfg
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

Verify nagios config for errors

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Restart the service

service nagios restart
Remote host:

now lets install the NRPE plugins and add a few plugins to the config file.

To view the list of plugins you can install:

yum --enablerepo=epel -y list nagios-plugins*
yum install nrpe nagios-plugins-dns nagios-plugins-load nagios-plugins-swap nagios-plugins-disk nagios-plugins-procs
command[check_dns]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
vim /etc/nagios/nrpe.cfg

allowed_hosts=127.0.0.1,192.168.1.101,192.168.1.102

systemctl enable nrpe
systemctl restart nrpe

now to test if it works for the nagios server

check_nrpe -H 192.168.1.100