Installing Nagios on CentOS HowTo
January 28, 2019
System:
- CentOS release 5.5 (Final)
- Nagios 3.2
- Apache 2.2
Packages:
- nagios-3.2.3-3.el5.rf
- nagios-plugins-nrpe-2.12-1.el5.rf
- nagios-plugins-1.4.15-2.el5.rf
- nagios-devel-3.2.3-3.el5.rf
Others:
- httpd-2.2.3-43.el5.centos.3
Installation:
# yum install nagios nagios-plugins nagios-plugins-nrpe nagios-devel
Setup the password file:
# htpasswd -c /etc/nagios/htpasswd.users nagiosadmin New password: type_your_password Re-type new password: re-type_your_password Adding password for user nagiosadmin
And/or you may create a "guest" account. But this is up to you.
# htpasswd /etc/nagios/htpasswd.users guest New password: type_your_password Re-type new password: re-type_your_password Adding password for user guest
NOTE: "-c" option is the create option. Since you already created the file, make sure any other accounts you add are not with the create option. You'll wipe the file out if you do.
Setup the CGI file:
# vi /etc/nagios/cgi.cfg
# AUTHENTICATION USAGE use_authentication=1 # SYSTEM/PROCESS INFORMATION ACCESS authorized_for_system_information=nagiosadmin # CONFIGURATION INFORMATION ACCESS authorized_for_configuration_information=nagiosadmin # SYSTEM/PROCESS COMMAND ACCESS authorized_for_system_commands=nagiosadmin # GLOBAL HOST/SERVICE VIEW ACCESS authorized_for_all_services=nagiosadmin authorized_for_all_hosts=nagiosadmin # GLOBAL HOST/SERVICE COMMAND ACCESS authorized_for_all_service_commands=nagiosadmin authorized_for_all_host_commands=nagiosadmin
Save the file after editing.
Starting nagios:
# nagios -v /etc/nagios/nagios.cfg
Nagios Core 3.2.3 Copyright (c) 2009-2010 Nagios Core Development Team and Community Contributors Copyright (c) 1999-2009 Ethan Galstad Last Modified: 10-03-2010 License: GPL Website: www.nagios.org Reading configuration data... Read main config file okay... Processing object config file '/etc/nagios/objects/commands.cfg'... Processing object config file '/etc/nagios/objects/contacts.cfg'... Processing object config file '/etc/nagios/objects/timeperiods.cfg'... Processing object config file '/etc/nagios/objects/templates.cfg'... Processing object config file '/etc/nagios/objects/localhost.cfg'... ... ... ... Things look okay - No serious problems were detected during the pre-flight check
# service nagios start
Start httpd:
# service httpd start
Browse to:
localhost/nagios
After you supply the credentials, you should see the nagios web interface. You can browse through the links to the left, but the majority of them won't work because nothing is configured yet.