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:
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 }
define host{ use linux-box ; Inherit default values from a template host_name linux-server-01 ; The name we're giving to this server alias CentOS 6 ; A longer name for the server address 192.168.1.100 ; IP address of Remote Linux host }
vim /usr/local/nagios/etc/servers/servers.cfg
define service{ use generic-service host_nametecmintlinux-server-01 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