Installing and Configuiring Nagio’s

Installing and Configuiring Nagio’s for Network and Server Monitoring

Nagios screenshot 8 f3156

I am very impressed with the power Nagios displays in network monitoring. It may not be easy to set it up perfectly but I have not run across any limitations with it so far. so I am willing to share my setup and config files to save someone else a lot of time in finding a good way to organize and configure there layout.

Centos 64 bit,

Lets first create or set a 2gb swap file:

dd if=/dev/zero of=/swap bs=1024 count=2097152 mkswap /swap && chown root. /swap && chmod 0600 /swap && swapon /swap echo /swap swap swap defaults 0 0 >>

/etc/fstab echo vm.swappiness = 0 >> /etc/sysctl.conf && sysctl -p

Install Nagios

rpm -Uvh -Uvh -y install nagios nagios-plugins-all nagios-plugins-nrpe nrpe php httpdchkconfig httpd on ; chkconfig nagios on

No lets setup a nagios Password for the Control Panel:

htpasswd -c /etc/nagios/passwd nagiosadmin# keep the username “nagiosadmin”  the same to avoid any further issues

Install NRPE on Clients

rpm -Uvh rpm -Uvh yum -y install nagios nagios-plugins-all nrpe chkconfig nrpe on


nano /etc/nagios/nrpe.cfg

log_facility=daemon pid_file=/var/run/nrpe/ server_port=5666 nrpe_user=nrpe nrpe_group=nrpe allowed_hosts= dont_blame_nrpe=1 debug=0 command_timeout=60 connection_timeout=300 include_dir=/etc/nrpe.d/ command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10 command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20 command[check_disk]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/vda command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w 5 -c 10 -s Z command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w 150 -c 200 command[check_procs]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$

Configuire IP Tables to accept traffic from all Monitoring Servers and nothing else:

iptables -N NRPE iptables -I INPUT -s 0/0 -p tcp --dport 5666 -j NRPE iptables -I NRPE -s -j ACCEPT iptables -A NRPE -s 0/0 -j DROP /etc/init.d/iptables save

Start NRPE

 service nrpe start

Configuiring the Monitoring server  (Nagios)

I wish to first say that in my defualt config on centos 6 all my config files are in /etc/nagios.  In my setup i have left those in there but added the real ones in /var/local/nagios and included the location in the real files ( you do not need to do this)

First edit the main /etc/nagios .   Then comment out the original folders and main files defualt location and add the folders where you want the configs to be.

nano /etc/nagioscfg_file=/etc/nagios/objects/commands.cfg
# Definitions for monitoring the local (Linux) host


Config files i believe is alot of work to really post on one website.   So instead i have created a virtual network for testing and i will give you access to my files.

You can view and download my sample configs from

Published on: Aug 26, 2020

Categories: Linux Server's