Friday, August 3, 2012

Setup nagios

Nagios Server

add rpmforge into the server repo

# yum install nagios nagios-nrpe nagios-plugins nagios-plugins-nrpe perl-Nagios-Plugin
# chkconfig nagios on
# chkconfig nrpe on

Edit the /etc/httpd/conf.d/nagios.conf to remove the SSL and user authentication
# vim /etc/httpd/conf.d/nagios.conf


  1  ScriptAlias /nagios/cgi-bin "/usr/lib64/nagios/cgi"
  2
  3  <Directory "/usr/lib64/nagios/cgi">
  4  #  SSLRequireSSL
  5     Options ExecCGI
  6     AllowOverride None
  7     Order allow,deny
  8     Allow from all
  9  #   AuthName "Nagios Access"
 10  #   AuthType Basic
 11  #   AuthUserFile /etc/nagios/htpasswd.users
 12  #   Require valid-user
 13  </Directory>
 14
 15  Alias /nagios "/usr/share/nagios"
 16
 17  <Directory "/usr/share/nagios">
 18  #  SSLRequireSSL
 19     Options None
 20     AllowOverride None
 21     Order allow,deny
 22     Allow from all
 23  #   AuthName "Nagios Access"
 24  #   AuthType Basic
 25  #   AuthUserFile /etc/nagios/htpasswd.users
 26  #   Require valid-user
 27  </Directory>
-----------------------------------------------------------------------------------

Edit /etc/nagios/cgi.cfg
# vim /etc/nagios/cgi.cfg


 use_authentication=0
 use_ssl_authentication=0
----------------------------------------------------------------------------------
# vim  /etc/nagios/objects/server.cfg



define hostgroup{
        hostgroup_name  linux-server
        alias           Linux Servers
        members         localhost,my-dns2
        }


define host{
        use                     linux-server
        host_name               my-dns2
        alias                   my-dns2
        address                 my-dns2.offgamers.lan
        }

define service{
        use                     local-service
        host_name               my-dns2
        service_description     Swap
        check_command           check_nrpe!check_swap
        }




# vim  /etc/nagios/nagios.cfg

add the location of the hosts file in the object folder


Format: cfg_file=<file_name>
Example: cfg_file=/usr/local/nagios/etc/hosts.cfg
                cfg_file=/usr/local/nagios/etc/services.cfg
                cfg_file=/usr/local/nagios/etc/commands.cfg





Nagios Client


# yum install nagios-nrpe nagios-plugins nagios-plugins-nrpe perl-Nagios-Plugin
# chkconfig nrpe on

# vim /etc/nagios/nrpe.cfg
allowed_hosts=127.0.0.1,172.30.10.218

at the bottom, edit the check command to suit your environment
----------------------------------------------------------------------------------





If you start Nagios server having error
use
# nagios -v /etc/nagios/nagios.cfg 
to check whats wront




Nagios Option available

http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html

No comments:

Post a Comment