Skip to main content

Opensource Network Monitoring System (NAGIOS)

NAGIOS Installation Guide

This is an open source software used for network and infrastructure monitoring. Nagios will monitor servers, switches, applications and services. It alerts the IT Administrator when something went wrong and also alerts back when the issues has been rectified.
Though the steps provided here are tested in CentOS 6.4, it may work on RHEL 6.4, Scientific Linux 6.4 and other RPM based distros.
In this tutorial i am gonna to use two systems as follows

Nagios server:
Operating system: CentOS 6.4
IP Address       : 192.168.1.100/24

Nagios client:
Operating System: CentOS 6.3
IP Address       : 192.168.1.101/24

First the install the prerequisites.
[root@server ~]# yum install -y gd gd-devel httpd php gcc glibc glibc-common
By default nagios is not found in CentOS official repository, so add the EPEL repository to install nagios.
[root@server ~]# wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
[root@server ~]# rpm -ivh epel-release-6-8.noarch.rpm
Now install nagios
[root@server ~]# yum install -y nagios*
Note: It is worked for me either the SELINUX or Firewall are disabled or enabled. All you need to do is allow the apache port through iptables.

Configure Nagios
Add the admin mail address in the nagios contact file to receive alerts from nagios server.
[root@server ~]# vi /etc/nagios/objects/contacts.cfg

### Line 35 - Edit the mail id ###
email                           root@localhost  ;
Edit the following lines in nagios config file
[root@server ~]# vi /etc/httpd/conf.d/nagios.conf

## Comment Lines 15 & 16 ##
#   Order allow,deny
#   Allow from all

## Uncomment and Change lines 17,18 & 19 as shown below ##
Order deny,allow
Deny from all
Allow from 127.0.0.1 192.168.1.0/24
Set nagiosadmin password
[root@server ~]# htpasswd /etc/nagios/passwd nagiosadmin
New password:
Re-type new password:
Updating password for user nagiosadmin
Start nagios and httpd services and let them to start automatically on every boot.
[root@server ~]# /etc/init.d/nagios start
Starting nagios: done.
[root@server ~]# /etc/init.d/httpd start
Starting httpd:                                            [  OK  ]
[root@server ~]# chkconfig nagios on
[root@server ~]# chkconfig httpd on
To allow nagios server through firewall, add the following two lines in iptables config file. This will let you to access the nagios webconsole from all clients.
[root@server ~]# vi /etc/sysconfig/iptables
 -A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT
 -A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT
Restart iptables
[root@server ~]# service iptables restart
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]
Open nagios administrator console and enter the nagiosadmin password as created before.


Click on the “Hosts” section in the left pane of the console. You will see the no of hosts to be monitored by Nagios server.



Adding clients to Nagios server
Now let us add some clients to monitor by Nagios server.
Add the EPEL repository to install “nagios-plugins” and “nrpe” packages in client systems.
[root@client ~]# wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
[root@client ~]# rpm -ivh epel-release-6-8.noarch.rpm
Install “nrpe” and “nagios-plugins” packages in client systems to be monitored.
[root@client ~]# yum install -y nrpe nagios-plugins-all openssl

Configure Clients
[root@client ~]# vi /etc/nagios/nrpe.cfg
 ## Line 81 - Add the Nagios server IP ##
allowed_hosts=127.0.0.1 192.168.1.100
Start nrpe service
[root@client ~]# /etc/init.d/nrpe start
Starting nrpe:                                             [  OK  ]
[root@client ~]# chkconfig nrpe on
To add the clients to be monitored through nagios server, open the “nagios.cfg” file in nagios server and uncomment the following lines.
[root@server ~]# vi /etc/nagios/nagios.cfg
## Line 52 - Uncomment ##
cfg_dir=/etc/nagios/servers
Create a directory called “servers” under “/etc/nagios/”.
[root@server ~]# mkdir /etc/nagios/servers
Create config file to the client to be monitored.
[root@server ~]# vi /etc/nagios/servers/clients.cfg
define host{

use                             linux-server

host_name                       client

alias                           client

address                         192.168.1.101

max_check_attempts              5

check_period                    24x7

notification_interval           30

notification_period             24x7

}
Restart nagios service.
[root@server ~]# /etc/init.d/nagios restart
 Running configuration check...done.
 Stopping nagios: .done.
 Starting nagios: done.
Now open the nagios admin console in the browser and navigate to “hosts” section in the left pane. You will see the newly added client will be visible there. Click on the host to see if there is anything wrong or alerts.




Now you can monitor the clients (hosts) as many as you added in the “clients.cfg” file. 



Comments

Popular posts from this blog

Cisco ASA 5510 with Dual ISP Redundancy

Cisco ASA 55XX with Dual ISP Redundancy This article will cover setting up redundant ISPs for outbound connectivity on an ASA 5510 (although the same should work on the 5520s and up as well).  It’s important to note that this covers   outbound   connectivity only.  The ASA does not have built in functionality to NAT multiple public IPs to a single internal IP – for that you’d need a router (how-to article soon!).  For an ASA to provide inbound redundancy to your servers you’d need to utilize two separate IPs for each server – one to be NAT’d to each public IP block. The information you’ll need to complete this task: ·           Primary ISP Subnet / Gateway ·           Secondary ISP Subnet / Gateway ·           A Public host to ping (i.e. 4.2.2.1) The Public host to ping is a device (read: cluster of devices) th...

Lenovo Ideapad V310-15ISK Wi-Fi issue on Ubuntu/fedora/CentOS

Go to terminal and RUN below command You can also copy & paste the below line on command prompt: # sudo tee /etc/modprobe.d/blacklist-ideapad.conf <<< "blacklist ideapad_laptop" # reboot. Link: https://askubuntu.com/questions/893668/qualcomm-atheros-wifi-lenovo-v310-ubuntu-16-04

Useful site for system & network admin

https://wintelguy.com/ Site Contents: MAC / WWN Lookup RAID Calculators DWPD, TBW, GB/day Calc. TB / TiB / GB / GiB Converter Backup Calculator Virtualization Calculators IP Subnet Calculator Network Throughput File Transfer Time Calculator WAN Latency DNS Lookup IP Locator eMail Tracer WHOIS Port Database Search Password Generator Power Unit Conversion Text Tools Cost Calculators