Homepage

Nagios

Prerequisites
Run all steps from this document with root permissions. The following command can be run to switch to a root shell.
>su – root
***  This will prompt for root user password. After entering the same the prompt will change to root.
#
Issue the command “pwd” to check the present directory
#pwd
Install the dependency packages and applications
#yum install -y wget httpd php gcc glibc glibc-common gd gd-devel make net-snmp
To start with I will detail the steps for installing the Nagios Core package from the source to a linux fedora distribution.
Step 1
You could download the source package from the links given above or by running the command given below.
Run the following commands in your terminal:
To change the directory to temporary folder
#cd /tmp
This will download Nagios core package and the required plugins.
Step 2
Creating User accounts and Group
#useradd nagios
#groupadd nagcmd
#usermod -a -G nagcmd nagios

Step 3
Extracting the downloaded packages
#tar zxvf nagios-3.4.1.tar.gz
#tar zxvf nagios-plugins-1.4.15.tar.gz
Step 4
Once you extract the file you will get a folder with the name “nagios”.  Change to the directory and configure.
#cd nagios
#./configure --with-command-group=nagcmd
#make all
#make install
#make install-init
#make install-config
#make install-commandmode
#make install-webconf

#cp -R contrib/eventhandlers/  /usr/local/nagios/libexec/
#chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers

For verifying the configuration:
#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
This should give zero errors and zero warnings before restarting the nagios service.
Starting the Nagios service
#/etc/init.d/nagios start
Starting the Web service
#/etc/init.d/httpd start
Create a Default User for Web Access.
Add a default user for Web Interface Access:
#htpasswd –c /usr/local/nagios/etc/htpasswd.users nagiosadmin
*** You will be prompted for a password for the account
Nagios Plugin Installation
After extracting the plugin file with the tar command as explained earlier.
#cd /tmp/nagios-plugins-1.4.15
#./configure --with-nagios-user=nagios --with-nagios-group=nagios
#make
#make install

Nagios Service Setup
The following commands will register the Nagios daemon to be run upon system startup.
#chkconfig --add nagios
#chkconfig --level 35 nagios on
#chkconfig --add httpd
#chkconfig --level 35 httpd


Web Access:
After completing the steps followed above and verifying the configurations without any errors or warnings, you should be able to access the Nagios tool GUI with web by issuing the command in the url of your browser. Edit the section of the IP with the IP of your system.
**** Log in with the credentials you chose while adding the “nagiosadmin” user to the “htpasswd.users” file.

 snmpwalk -v2c -c "smnp_on_router" x.x.x.x mi | less
 snmpwalk -v2c -c "smnp_on_router" x.x.x.x mi | less

Configuration of Nagios for monitoring your critical services and devices:
Here I will introduce you to the main configuration files which are required for making the configuration changes for making the tool ready as per our requirement.


How configure VirtualHost


<Directory "/etc/www">
        Options Indexes FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
</Directory>
NameVirtualHost 172.16.254.30:80
<VirtualHost 172.16.254.30:80>
        ServerName nagios.gmail.com
        DocumentRoot /usr/local/nagios/share
        ServerAdmin loemvechheka@gmail.com
</VirtualHost>



4 comments: