Sunday, 7 April 2013

NagiOS Server Monitoring Tool- LINUX


Quick installation steps:

Nagios is an enterprise-class open source computer/network monitoring software with on-going enhancements from its vibrant community made up of worldwide supporters.

User account and group ID:

[root@ranjith ~]# useradd -m nagios
[root@ranjith ~]# passwd nagios
[root@ranjith ~]# groupadd nagcmd
[root@ranjith ~]# usermod -a -G nagcmd nagios
[root@ranjith ~]# usermod -a -G nagcmd apache

Download the latest Nagios Core and Nagios Plugins source files or just use just uses wget to download as below,

Nagios Core:

[root@ranjith ~]# wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gz

compile and install the Nagios core:

[root@ranjith ~]# tar -zxvf nagios-3.2.3.tar.gz
[root@ranjith ~]# cd nagios-3.2.3

FYI: From next execution onwards, you may use tee command to duplicate output to a file for examination, which could be useful to trace errors that triggered when compiling source code.

[root@ranjith ~]# ./configure --with-command-group=nagcmd



Compile the Nagios source code (piping to tee command is optional)

[root@ranjith ~]# make all | tee make_all.nagios_core.log

Install the compiled binaries of Nagios Core:

[root@ranjith ~]# make install
[root@ranjith ~]# make install-init
[root@ranjith ~]# make install-config
[root@ranjith ~]# make install-commandmode

Edit contact.cfg file to update email address of nagiosadmin for receiving alerts:

[root@ranjith ~]# vi /usr/local/nagios/etc/objects/contacts.cfg

replace your personal email ID instead of "nagios@localhost".

Install Nagios web config file to Apache conf.d directory:

[root@ranjith ~]# make install-webconf



Create an user account for logging into the Nagios web interface:

[root@ranjith ~]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Restart Apache (httpd) to make the new settings take effect:

[root@ranjith ~]# service httpd restart

Add Nagios to System services and configure it to start up automatically when boots into runlevel 3 and 5:

[root@ranjith ~]# chkconfig --add nagios
[root@ranjith ~]# chkconfig --level 35 nagios on

Now, We need to install standard Nagios plugins which are used to monitor various computer/network status.

Nagios Plugins:

[root@ranjith ~]# wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz

let’s unpack:

[root@ranjith ~]# tar -zxvf nagios-plugins-1.4.15.tar.gz
[root@ranjith ~]# cd nagios-plugins-1.4.15

Run configure file to explicitly set ownership to nagios:nagios respectively:

[root@ranjith ~]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios

Ready to compile and install Nagios Plugins binary files:

[root@ranjith ~]# make
[root@ranjith ~]# make install

Verify the sample Nagios configuration files (the files used to define how and what services or hosts to monitor by Nagios Core via the various plugins):

Through the file: /usr/local/nagios/etc/nagios.cfg you can modify the useful options such LOG ROTATION METHOD, DEBUG LEVEL, AUTO-RESCHEDULING OPTION, SLEEP TIME, TIMEOUT VALUES, FLAP DETECTION THRESHOLDS and TIMEZONE OFFSET.

[root@ranjith ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Total Warnings: 0
Total Errors:   0



start up of Nagios:

[root@ranjith ~]# service nagios start



http://Your-server-IP/nagios ( kindly stop iptables )



To reset admin panel password:

[root@ranjith ~]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

If you face blank page on the browser! after the successfull reach on nagios home page.?

kindly check the error log:

script not found or unable to stat: somefile.cgi

FIX:

[root@ranjith html]# chcon -R -t httpd_sys_content_t /usr/local/nagios




Enjoy!!!

No comments:

Post a Comment