Configuring basic nagios server

From Notes_Wiki
Revision as of 12:32, 28 July 2022 by Saurabh (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Home > CentOS > CentOS 6.x > Monitoring tools > Nagios configuration > Configuring basic nagios server

Nagios is service monitoring tool which can periodically check status of various services and notify in case some service is not in proper state.


Installing nagios

We can install nagios using yum. Just use:

yum -y install nagios* --skip-broken

In case any specific plugin cannot be installed due to conflicts then that can be ignored by using -x option such as

yum -y install nagios* --skip-broken -xnagios-plugins-setuid


Configuring contact

Configure email server in case not already done so. Make sure that mails are getting delivered using 'mail <email_address>' command. Open 'contacts.cfg' file located in '/etc/nagios/objects' objects directory in CentOS 5.4. Change the email address of nagiosadmin to the email address tested before using mail command.


Disable selinux

For some reason SELinux interferes with nagios. So disable SELinux by using 'setenforce 0'. You might consider disabling SELinux in file /etc/sysconfig/selinux.


Setting nagios.conf for apache (httpd)

Open file '/etc/httpd/conf.d/nagios.conf' and see that nagios is accessible from at least admin stations. Also note the location of htpasswd.users file as this location is required in next step while creating user nagiosadmin and setting its password.


Setting httpd password

Use below command to configure password

htpasswd -c /etc/nagios/password nagiosadmin

The location of password file should be same as in /etc/httpd/conf.d/nagios.conf


Checking configuration is fine

We can use command 'nagios -v /etc/nagios/nagios.cfg' to see that nagios configuration is fine.


Enable nagios on system startup

We can use 'chkconfig nagios on' to enable nagios in run levels 3, 4 and 5


Start nagios for current session

We can start nagios for current session using command 'service nagios start'


Logging in into nagios

Open http://<server_ip>/nagios and give username as nagiosadmin and password setup in above setup to login.


Home > CentOS > CentOS 6.x > Monitoring tools > Nagios configuration > Configuring basic nagios server