I decided to write this post because I am currently implementing a massive Nagios installation.
Which includes two Data Centres and two offices.
My next post will be on how to configure a server to be monitored by Nagios.
Centos 6 Easier way to install Nagios Server
Install Epel Repository GPG key
# rpm --import http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6
Install Epel Repository Package
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
Search and Install Nagios Packages
Required Packages:
nagios.x86_64
nagios-plugins.x86_64
nagios-plugins-all.x86_64
httpd.x86_64
Install the packages
# yum install httpd.x86_64 nagios.x86_64 nagios-plugins.x86_64 nagios-plugins-all.x86_64 -y
Note: on my brand new system I had 78 packages installed.
It might be different on your system, depends on how many packages you already have installed.
Configuring Apache
# chkconfig --level 35 httpd on
# service httpd start
Test Apache Install
Open your broser and navigate to your server IP address to test Apache works
If it doesn't we need to open up the firewall
# vi /etc/sysconfig/iptables
Add the line below:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
Save the file and restart iptables
# service iptables restart
Test acessing your Nagios IP address once again
http://192.168.1.23
Note: If you see the Apache Test Page your Apache is working fine
Replace 192.168.1.23 with your server's IP address
Setup Nagios Apache Virtual Host
# cd /etc/httpd/conf.d/
# vi nagios.conf
The file should look as per below:
ScriptAlias /nagios/cgi-bin/ "/usr/lib64/nagios/cgi-bin/"
<Directory "/usr/lib64/nagios/cgi-bin/">
# SSLRequireSSL
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios/passwd
Require valid-user
</Directory>
Alias /nagios "/usr/share/nagios/html"
<Directory "/usr/share/nagios/html">
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios/passwd
Require valid-user
</Directory>
Restart Apache
# service httpd restart
Set an User Name and Password to protect Nagios access
# htpasswd -c /etc/nagios/passwd nagiosadmin
New password: TYPE in a Password
Re-type new password: Type the same password again
Test the Nagios web Interface access
http://192.168.1.23/nagios/
Type in: nagiosadmin and your password
Note: If you see the Nagios Web Interface, things are looking good and Nagios is installed correctly.
We need to start Nagios service
# chkconfig --level 35 nagios on
Start Nagios
# service nagios start
Navigate to the Nagios web Interface at: http://192.168.1.23/nagios/
Enter username and password and click on: * Services
Note: by Now you should see the localhost being monitored and some default services.
Httpd service will display a warning: HTTP WARNING: HTTP/1.1 403 Forbidden
Note: Just create an empty index.html page.
# touch /var/www/html/index.html
That should take care of the warning.
Nagios 3.4.4 looks a a lot better than previous versions.
That is it folks, that was easy.
by Renato de Oliveira
No comments:
Post a Comment