Differences

This shows you the differences between two versions of the page.

Link to this comparison view

how-to-install-nagios-on-centos-6 [2014-07-01 01:30:33] (current)
shaun.reitan created
Line 1: Line 1:
 +====== How to install Nagios on CentOS 6 ======
 +
 +Nagios is a powerful monitoring system that monitors your servers and/or services and alerts staff if a problem should arise.  The system is plugable which gives administrators the ability to write their own or use hundreds of pre written plugins to monitor their infrastructure.
 +
 +===== Installation =====
 +
 +==== Install required packages ====
 +
 +<code console>
 +yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
 +yum -y install nagios nagios-plugins-all
 +</code>
 +
 +==== Create blank index.html ====
 +
 +If you do not do this you will get a warning from nagios when it checks itself to make sure apache is running.
 +
 +<code console>
 +touch /var/www/html/index.html
 +</code>
 +
 +==== Set services to start on boot ====
 +
 +<code console>
 +chkconfig httpd on
 +chkconfig nagios on
 +</code>
 +
 +==== Change nagiosadmin password ====
 +
 +By default the web interface is password protected, the default user is nagiosadmin so we'll change this users password.  You can change this username too but it requires you to modify the nagios configuration files to match.
 +
 +<code console>
 +htpasswd -c /etc/nagios/passwd nagiosadmin
 +</code>
 +
 +==== Change default contact address ====
 +
 +By default alerts will be sent to nagios@localhost.  You can change this by editing /etc/nagios/objects/contacts.cfg and changing this address
 +
 +==== Start Services ====
 +
 +<code console>
 +service httpd start
 +service nagios start
 +</code>
 +
 +==== Web Interface ====
 +
 +You can now open your browser and goto your server's hostname or ip address prefixed with /nagios.  You will be prompted for a username and password.  The username is nagiosadmin unless you changed it, and the password is what you set above.
 +
 +Example: http://192.168.1.1/nagios
 +
 +===== Monitoring a remote server =====
 +
 +We will now create a configuration file to monitor an additional host.  We will monitor ICMP and SSH
 +
 +Create and edit a file in /etc/nagios/conf.d/server1.domain.cfg
 +
 +<code>
 +define host {
 +   use                   linux-server
 +   host_name       server1.domain.com
 +   alias                 server1.domain.com
 +   address           10.0.0.1
 +   }
 +
 +define service {
 +   use                           generic-service
 +   host_name               server1.domain.com
 +   service_description  PING
 +   check_command      check_ping!100.0,20%!500.0,60%
 +   }
 +
 +define service {
 +   use                           generic-service
 +   host_name               server1.domain.com
 +   service_description  SSH
 +   check_command      check_ssh
 +   }
 +</code>
 +
 +Next you need to reload nagios
 +
 +<code console>
 +service nagios reload
 +</code>
 +
 +