Pages

Install Nagios on CentOS 5.2

Nagios is a popular open source computer system and network monitoring software application. It watches hosts and services, alerting users when things go wrong and again when they get better.

1. Add user for nagios

[root@localhost ~]# useradd -s bin/false -d opt/nagios nagios
[root@localhost ~]# groupadd nagiroup
[root@localhost ~]# usermod -G nagiroup nagios
[root@localhost ~]# usermod -G nagiroup apache




2. Create directory and download nagios package from http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.3.tar.gz

[root@localhost ~]# cd /usr/local
[root@localhost local]# mkdir download
[root@localhost local]# cd download
[root@localhost download]# wget http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.3.tar.gz

3. Extract the package

[root@localhost download]# tar -zxvf nagios-3.0.3.tar.gz
[root@localhost download]# mv nagios-3.0.3 nagios
[root@localhost download]# cd nagios

4. Install nagios

[root@localhost nagios]# ./configure –prefix=/optnagios –with-command-group=nagioup
[root@localhost nagios]# make all

5. Install library



[root@localhost nagios-3.0.3]# make install

[root@localhost nagios-3.0.3]# make install-init

[root@localhost nagios-3.0.3]# make install-config

[root@localhost nagios-3.0.3]# make install-commandmode

6. Edit contact file for sending warning by mail



[root@localhost nagios-3.0.3]# vi /opt/nagios/etc/objects/contacts.cfg

define contact{

contact_name    nagiosadmin                 ; Short name of user

use                    generic-contact             ; Inherit default values from generic-contact template (defined above)

alias                   Nagios Admin               ; Full name of user

email                  sidiq23@gmail.com     ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ****** } define contactgroup{ contactgroup_name    admins alias                            Nagios Administrators members                     nagiosadmin }

7. Install nagios in to httpd file



[root@localhost nagios-3.0.3]# make install-webconf

8. Setting password for login nagios



[root@localhost nagios-3.0.3]# htpasswd -c /opt/nagios/etc/htpasswd.users nagiosadmin
Download Plugin di sini http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz

9. After nagios have been installed, we can install nagios plugin



[root@localhost downloads]# tar xzvf nagios-plugins-1.4.11.tar.gz

[root@localhost downloads]# cd nagios-plugins-1.4.11

10. Install nagios plugin



[root@localhost nagios-plugins-1.4.11]# ./configure –prefix=/opt/nagios -with-nagios-user=nagios-with-nagios-group=nagioup

[root@localhost nagios-plugins-1.4.11]# make

[root@localhost nagios-plugins-1.4.11]# make install

11. Adding service for booting



[root@localhost nagios-plugins-1.4.11]# chkconfig –add nagios

[root@localhost nagios-plugins-1.4.11]# chkconfig nagios on

12. For looking our configuration running



[root@localhost nagios-plugins-1.4.11]# /opt/nagios/bin/nagios -v /opt/nagios/etc/nagios.cfg

13. Running nagios service



[root@localhost nagios-plugins-1.4.11]# service nagios start

14. Change your permission for nagios folder



[root@localhost nagios-plugins-1.4.11]# chmod 755 /opt/nagios

Now, lets check installation using browser by type http://your_ip/nagios

If there is no error, first you will ask to login using your username and password



Well done! nagios installed on your machine



This is the detail service that run on my machine

No comments:

Post a Comment