LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Blogs > Kashif Aziz Awan
User Name
Password

Notices

Rate this Entry

Adding Linux client to Nagios server

Posted 06-07-2013 at 07:44 AM by kashifazizawan
Updated 06-12-2013 at 05:33 AM by kashifazizawan (add more information)

Adding Linux client to Nagios server
Kashif Aziz Awan
kashifaziz@ciit.net.pk
June 7, 2013 www.fb.com/kashifazizawan

Now let us add some clients to monitor by Nagios server.
Add the EPEL repository to install “nagios-plugins” and “nrpe” packages in client systems.

[root@client ~]# wget http://dl.fedoraproject.org/pub/epel...6-8.noarch.rpm
[root@client ~]# rpm -ivh epel-release-6-8.noarch.rpm

Install “nrpe” and “nagios-plugins” packages in client systems to be monitored.

[root@client ~]# yum install -y nrpe nagios-plugins-all openssl
Configure Client
[root@client ~]# vim /etc/nagios/nrpe.cfg
## Line 81 - Add the Nagios server IP ##
allowed_hosts=127.0.0.1 192.168.1.200


command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
#command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda2
command[check_sda3]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda3
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 250 -c 275 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 20% -c 10%
command[check_swap]=/usr/lib/nagios/plugins/check_swap -w 20% -c 10%


Start nrpe service

[root@client ~]# /etc/init.d/nrpe start
Starting nrpe: [ OK ]
[root@client ~]# chkconfig nrpe on

To add the clients to be monitored through nagios server, open the “nagios.cfg” file in nagios server and uncomment the following lines.

[root@server ~]# vim /etc/nagios/nagios.cfg
## Line 52 - Uncomment ##
cfg_dir=/etc/nagios/servers


Create a directory called “servers” under “/etc/nagios/”.
[root@server ~]# mkdir /etc/nagios/servers

Create config file to the client to be monitored.
[root@server ~]# vim /etc/nagios/servers/clients.cfg
define host{
use linux-server,host-pnp
host_name ClientName ;
alias Server Name
address 192.168.1.10 ;
parents switch name;
icon_image linux40.png
icon_image_alt image
vrml_image linux40.png
statusmap_image linux40.gd2
}
define service{
use generic-service,srv-pnp
host_name ClientName
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
define service{
use generic-service
host_name ClientName
service_description SSH
check_command check_ssh
notifications_enabled 0
}
define service{
use generic-service
host_name ClientName
service_description CPU Load
check_command check_nrpe!check_load
}
define service{
use generic-service
host_name ClientName
service_description Current Users
check_command check_nrpe!check_users
}
define service{
use generic-service
host_name ClientName
service_description /dev/sda3 Free Space
check_command check_nrpe!check_sda3
}
define service{
use generic-service`
host_name ClientName
service_description Total Processes
check_command check_nrpe!check_total_procs
}
define service{
use generic-service
host_name ClientName
service_description Zombie Processes
check_command check_nrpe!check_zombie_procs
}
define service{
use generic-service
host_name ClientName
service_description Swap Usage
check_command check_nrpe!check_swap
}


Add client file to the following file:
[root@server ~]# vim /etc/nagios/nagios.cfg
cfg_file=/etc/nagios/servers/clients.cfg

Restart nagios service.
[root@server ~]# /etc/init.d/nagios restart
Running configuration check...done.
Stopping nagios: .done.
Starting nagios: done.

Now open the nagios admin console in the browser and navigate to “hosts” section in the left pane. You will see the newly added client will be visible there. Click on the host to see if there is anything wrong or alerts.
Posted in Uncategorized
Views 1046 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 10:06 AM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration