To setup a minimal CentOS 6 64-bit Nagios server:
1] Setup CentOS 6 64-bit as in guide (http://blog.malaya-digital.org/setup-a-minimal-centos-6-0-64-bit-setup-with-networking/).
2] "yum update"
3] "vi /etc/sysconfig/selinux" and set "SELINUX=disabled".
4] "setenforce 0"
5] "shutdown -r now"
6] "rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm"
7] "yum install nagios nagios-plugins nagios-plugins-all nagios-plugins-nrpe php php-pear mod_ssl net-snmp net-snmp-utils sendmail"
8] To create the default Nagios user and assign a password to it:
htpasswd /etc/nagios/passwd nagiosadmin
9] To check Nagios configuration file for errors:
nagios -v /etc/nagios/nagios.cfg
10] Open port 443 for secure web access.
11] "usermod -a -G nagios apache"
12] "chkconfig nagios on"
13] "chkconfig httpd on"
14] "chkconfig sendmail on"
15] "service sendmail restart"
16] Edit /etc/httpd/conf/httpd.conf, and appropriately configure "ServerName". Also, edit /etc/httpd/conf.d/nagios.conf , and uncomment all "SSLRequireSSL" lines.
17] "service httpd restart"
18] Edit /etc/nagios/nagios.cfg, and uncomment "cfg_dir=/etc/nagios/servers".
19] Append to /etc/nagios/objects/commands.cfg:
define command{
command_name check_nrpe
command_line /usr/lib64/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
20] "mkdir /etc/nagios/servers"
21] "chown root:nagios /etc/nagios/servers"
22] "service nagios restart"
23] Open https://(IP or hostname of Nagios server)/nagios . Enter the credentials for the nagiosadmin user.
To configure a CentOS 6 64-bit Nagios NRPE client:
1] "yum update"
2] "vi /etc/sysconfig/selinux" and set "SELINUX=disabled".
3] "setenforce 0"
4] "shutdown -r now"
5] "rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm"
6] "yum install nagios-plugins-nrpe nagios-plugins-all nagios-nrpe openssl"
7] Edit /etc/yum.conf and append this to the "[main]" section:
exclude=nagios*
8] Edit /etc/nagios/nrpe.cfg . Look for:
allowed_hosts=127.0.0.1
Add the IP of your Nagios server. And add the IP of the Nagios client. Eg:
allowed_hosts=127.0.0.1,10.1.34.53,10.1.34.32
Also look for:
server_address=127.0.0.1
Assign the IP of your Nagios client. Eg:
server_address=10.1.34.32
9] "chown nrpe:nrpe /etc/nagios/nrpe.cfg"
10] Add to /etc/services :
nrpe 5666/tcp # NRPE
11] "chkconfig nrpe on"
12] "service nrpe restart"
13] open port 5666/tcp
14] To check if NRPE is working on the Nagios client(substitute the IP of the Nagios client; this command is to be executed on the client):
/usr/lib64/nagios/plugins/check_nrpe -H 10.1.34.32
15] You can also check NRPE daemon from the Nagios server(substitute the IP of the Nagios client; this command is to be executed on the server):
/usr/lib64/nagios/plugins/check_nrpe -H 10.1.34.32
16] Make sure the "COMMAND DEFINITIONS" in the /etc/nagios/nrpe.cfg file in the client are in order. They can be found near the end of the file.
17] "service nrpe restart"
18] Edit /etc/nagios/objects/templates.cfg in the Nagios server, and add the following(you may need to make adjustments in order to reconcile the settings described in this step to the /etc/nagios/nrpe.cfg settings in the client):
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
}
19] Add a file to /etc/nagios/servers in the Nagios server(eg: "/etc/nagios/servers/linux-nagios-client.cfg" ; you can use any filename you like, just make sure it has a ".cfg" extension). It should look like this (substitute appropriate values for host_name, alias, and address)
define host{
use linux-box
host_name linux-nagios-client
alias CentOS 6
address 10.1.34.32
}define service{
use generic-service
host_name linux-nagios-client
service_description Current Load
check_command check_nrpe!check_load
}define service{
use generic-service
host_name linux-nagios-client
service_description Current users
check_command check_nrpe!check_users
}define service{
use generic-service
host_name linux-nagios-client
service_description Root Partition
check_command check_nrpe!check_hda1
}define service{
use generic-service
host_name linux-nagios-client
service_description Total Processes
check_command check_nrpe!check_total_procs
}define service{
use generic-service
host_name linux-nagios-client
service_description Zombie Processes
check_command check_nrpe!check_zombie_procs
}define service{
use generic-service
host_name linux-nagios-client
service_description SSH
check_command check_nrpe!check_ssh
}define service{
use generic-service
host_name linux-nagios-client
service_description Swap Usage
check_command check_nrpe!check_swap
}define service{
use generic-service
host_name linux-nagios-client
service_description Ping
check_command check_ping!100.0,20%!500.0,60%
}
20] Restart Nagios on the Nagios server:
service nagios restart
21] Open http://(IP or hostname of Nagios server)/nagios . Enter the credentials for the nagiosadmin user.

9 Comments to 'Setup a minimal CentOS 6 64-bit Nagios server + Configure a CentOS 6 64-bit Nagios NRPE client'
April 12, 2012
[...] 12th, 2012 | UncategorizedAuthor: admin NOTE: I tried this on my Nagios setup as described here: http://blog.malaya-digital.org/setup-a-minimal-centos-6-64-bit-nagios-server-configure-a-centos-6-64… 1] "yum install perl-Net-XMPP" 2] Download notify_via_jabber , and save it to [...]
June 28, 2012
I think you have a syntax error at step 19:
define service{
use generic-service
host_name linux-nagios-client
service_description /dev/hda1 Current users
check_command check_nrpe!check_users
}
services_description should be without /dev/hda1 I believe
Otherwise, great guide! Made my day setting up Nagios for the first time
June 28, 2012
Hi. Thank you for pointing the error. It’s a typographical error, thus Nagios will still run with it. It will make Nagios not pretty, though. So it is better that we had that fixed.
July 20, 2012
Hi. Thanks for great tutorial.
October 2, 2012
Great tutorial.
This link doesn’t work since the package is updated to 6-7
“rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm”
Use this instead.
“rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm“
October 6, 2012
Hi,
Thanks for such good tutorial
December 6, 2012
Great tutorial!
January 25, 2013
Hey,
Thank you for your guide………….
April 5, 2013
Thanks for posting a great tutorial
Leave a comment