Installing Nagios-3.5.0 in CentOS 6.4
This post is updated version of post “https://sharadchhetri.com/2013/02/27/installing-nagios-3-4-4-in-centos-6-3/”. We will use the new EPEL repo rpm i.e epel-release-6-8.noarch.rpm.(Today I found that in EPEL repo the nagios 3.5 is available and I tested it in my staging machine)
Rest of the steps are same
Download the EPEL repo in your system
yum install wget (use this command if you do not find wget command in your system)
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
For Directly installing the epel repo rpm with the below command.
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
Now installing the Nagios 3.5.0 and its dependencies in the system.
yum install nagios nagios-devel nagios-plugins* gd gd-devel httpd php gcc glibc glibc-common openssl
Bydefualt on doing yum install nagios, in cgi.cfg file, authorized user name nagiosadmin is mentioned and for htpasswd file /etc/nagios/passwd file is used.So for easy steps I am using the same name.
htpasswd -c /etc/nagios/passwd nagiosadmin G1veAlphanumericPassword
Note: Bydefault user is nagiosadmin and password also is nagiosadmin
Check the below given values in /etc/nagios/cgi.cfg
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
For provoding the access to nagiosadmin user in http, /etc/httpd/conf.d/nagios.conf file exist.
Below is the nagios.conf configuration for nagios server.
cat /etc/http/conf.d/nagios.conf
# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
# Last Modified: 11-26-2005
#
# This file contains examples of entries that need
# to be incorporated into your Apache web server
# configuration file. Customize the paths, etc. as
# needed to fit your system.ScriptAlias /nagios/cgi-bin/ “/usr/lib/nagios/cgi-bin/”
<Directory “/usr/lib/nagios/cgi-bin/”>
# SSLRequireSSL
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /etc/nagios/passwd
Require valid-user
</Directory>Alias /nagios “/usr/share/nagios/html”
<Directory “/usr/share/nagios/html”>
# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
Allow from 127.0.0.1
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /etc/nagios/passwd
Require valid-user
</Directory>
Start the httpd and nagios
/etc/init.d/httpd start
/etc/init.d/nagios start
Note: SELINUX and IPTABLE are disabled.
Access the nagios server by http://nagios_server_ip-address/nagios
Give the username = nagiosadmin and password which you have given to nagiosadmin user.
In my next post I have described about how to add server for monitoring in nagios server.Given below is the link.
How to install and configure nagios nrpe
phoenix says
A very good tutorial, thanks!
sharad chhetri says
Welcome.
Suggest you to install new nagios version 4.x. Here is the post
Right now, nagios 4 rpm is not available in reliable repositories