Pegasi Wiki

This wiki acts as a memo for our own work so why not share them? Feel free to browse and use out notes and leave a note while at it.

Nagios installation on CentOS 6.2

Nagios server

  • disable selinux
  • install packages and enable users
rpm -Uvh http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
yum -y install httpd php gd mod_ssl nagios*
htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
  • check that you have nagiosadmin user in /etc/nagios/cgi.cfg
  • edit /etc/nagios/objects/contacts.cfg to include your data, at least your email
service nagios restart
service httpd restart
  • test /nagios URL in your server

Nagiosgraph

service nagios start
service httpd start
  • test with your browser addresses
https://server/nagiosgraph/cgi-bin/showconfig.cgi
https://server/nagiosgraph/cgi-bin/show.cgi
  • edit file /etc/nagios/objects/templates.cfg and add to the end of file
define service {
       name graphed-service
       action_url /nagiosgraph/cgi-bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$' onMouseOver='showGraphPopup(this)' onMouseOut=
'hideGraphPopup()' rel='/nagiosgraph/cgi-bin/showgraph.cgi?host=$HOSTNAME$&service=$SERVICEDESC$&period=week&rrdopts=-w+450+-j
       register 0
       }
  • Add graphed functionality to your server object definition file /etc/nagios/objects/host.cfg
define service{
        use                             local-service,graphed-service
        host_name                       localhost
        service_description             PING
        check_command                   check_ping!100.0,20%!500.0,60%
        }
  • restart nagios and wait a few minutes

Nagios NRPE client installation

NRPE client enables Nagios to query and use plugins remotely from Linux and Windows servers. This one is about Linux client.

  • install software with yum
yum install nagios-nrpe nagios-plugins nagios-plugins-nrpe
  • use nrpe daemon or xinetd, this one uses daemonized nrpe
vi /etc/nagios/nrpe.cfg
  • fix allowed_hosts according to your environment
  • fix the check commands according to your environment (w = warning, c = critical limit)
command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib64/nagios/plugins/check_load -w 10,7,4 -c 20,15,10
#command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_rootv]=/usr/lib64/nagios/plugins/check_disk -w 10% -c 5% -p /dev/mapper/vg_myserver-rootv
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 350 -c 400
  • if you wish you can describe the service to /etc/services, needed if xinetd is used
nrpe            5666/tcp                        # Nagios NRPE
  • make iptables allow rules if necessary
iptables -I INPUT -p TCP --dport 5666 -s nagios-server-ip
service iptables save
  • start nrpe daemon
service nrpe start
  • do testing in client
/usr/lib64/nagios/plugins/check_nrpe -H localhost
/usr/lib64/nagios/plugins/check_nrpe -H localhost -c check_users
  • do testing in nagios server

/usr/lib64/nagios/plugins/check_nrpe -H client-ip

  • edit file /etc/nagios/objects/commands.cfg
define command{
        command_name check_nrpe
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
  • add the host to nagios server
vi /etc/nagios/objects/host.cfg
  • example data for /etc/nagios/objects/host.cfg
define host{
        use                     linux-server
        host_name               myhost
        alias                   My Virtual server
        address                 192.168.1.2
        }
define service{
        use                             local-service,graphed-service
        host_name                       myhost
        service_description             PING
        check_command                   check_ping!100.0,20%!500.0,60%
        }

define service{
        use                             local-service,graphed-service
        host_name                       myhost
        service_description             Root Partition
        check_command                   check_nrpe!check_rootv
        }

Leave a comment

Enter your comment:
Z E F Y N
 

  //check if we are running within the DokuWiki environment if (!defined("DOKU_INC")){ die(); } //place the needed HTML source codes BELOW this line