Nagios install

From Promoserv
Jump to: navigation, search

Installing Nagios Core on Centos 6

  • Install apache server and needed libraries.

sudo yum install httpd php

  • Add the rpmfusion repository, for downloading nagios (if you have a different Fedora version, then change the release number accordingly.


sudo rpm -Uvh epel-release-6*.rpm

  • Install nagios and plugins

sudo yum install nagios nagios-plugins nagios-plugins-all

  • Change the nagiosadmin password

htpasswd -c /etc/nagios/passwd nagiosadmin

  • Check the nagios configuration file, the command will check that the configuration is correctly made.

sudo nagios -v /etc/nagios/nagios.cfg

  • Start the nagios and the httpd services

sudo /etc/init.d/nagios start sudo /etc/init.d/httpd start

  • Log into nagios with your browser, use the address below (it is the localhost)


  • Use chkconfig to enable nagios and httpd to start at system start

sudo chkconfig nagios on sudo chkconfig httpd on

  • Check the SELINUX is disabled, if not then disable it.

sudo vim /etc/selinux/config

  • There should be the following line in the file


  • If you have to change the setting from enabled to disabled, then you have to reboot the machine to enforce the new setting.

  Adding new hosts/services to nagios

  • Open create a new configuration file in the conf.d folder

sudo vim /etc/nagios/conf.d/"name_of_the_new_conf_file"

  • Insert the host configurations to the file, a sample is provided below. Save the file after editing

define host {

       use                                   linux-server
       max_check_attempts      4
       alias                                 google

define service {

       use                                    generic-service
       service_description          PING
       check_command               check_ping!100.0,20%!500.0,60%
  • After configuring the file run nagios configuration check, this is important to do, because nagios will not start if the configuration is not correct

sudo nagios -v /etc/nagios/nagios.cfg

  • After checking the configuration, reload the nagios service

sudo /etc/init.d/nagios reload

Personal tools