Friday, February 15, 2013

Install Nagios on Linux


Install Nagios on Linux

Introduction:-
Nagios is a powerful monitoring system that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes. 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.

Nagios was designed for use with the Linux operating system, but it will also work under Unix and most Unix-based systems. Nagios runs periodic checks on user-specified resources and services. Resources that can be monitored include memory

Prerequisites:-
Make sure you've
installed the following packages on your Linux installation before continuing.
  • Apache
  • PHP
  • GCC compiler
  • GD development libraries
  • IP = 192.168.1.1
  • HOSTNAME = server.anup.co.in
  • Firewall and Selinux must be disabled.
1] Install gcc compiler, gd development libraries
[root@server ~]# yum install gd gd-devel gcc glibc glibc-common -y

2] Install http package for nagios web-interface
[root@server ~]# yum install httpd php -y

3] Create new user account and assign it password
[root@server ~]# useradd nagios
[root@server ~]# passwd nagios

[ Note = apache user already created ]

4] Create a new nagcmd group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group.

[root@server ~]# groupadd nagcmd
[root@server ~]# usermod -G nagcmd nagios
[root@server ~]# usermod -G nagcmd apache

5] Download nagios and plugins from following links.

Create a directory for storing the downloads.
[root@server ~]# mkdir /root/downloads
[root@server ~]# cd /root/downloads

Nagios Download Link =
[root@server downloads]# wget http://sourceforge.net/projects/nagios/files/nagios-3.x/nagios-3.3.1/nagios-3.3.1.tar.gz/download

Plugins Download Link =
[root@server downloads]# wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz/download

6] Now compile and install nagios

[root@server downloads]# tar -xvzf nagios-3.3.1.tar.gz
[root@server downloads]# cd nagios
[root@server nagios]# ./configure --with-command-group=nagcmd
[root@server nagios]# make all

7] Now install bineries, init script
[root@server nagios]# make install
[root@server nagios]# make install-init
[root@server nagios]# make install-config
[root@server nagios]# make install-commandmode

8] Install web config file for nagios web-interface
[root@server nagios]# make install-webconf
[root@server nagios]# cd

9] Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account – you’ll need it later.

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

10] Now compile and install nagios plugins

[root@server ~]# cd /root/downloads
[root@server downloads]# tar -xvzf nagios-plugins-1.4.15.tar.gz
[root@server downloads]# cd nagios-plugins-1.4.15
[root@server nagios-plugins-1.4.15]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
[root@server nagios-plugins-1.4.15]# make
[root@server nagios-plugins-1.4.15]# make install
[root@server ~]# cd

13] Start nagios service ( Add Nagios to the list of system services and have it automatically start when the system boots. )

[root@server ~]# chkconfig --add nagios
[root@server ~]# chkconfig nagios on

14] Verify the sample nagios configuration file

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

15] If there are no error start nagios and httpd (for nagios web-interface)service

[root@server ~]# service nagios start
[root@server ~]# service httpd restart

16] If you done this successfully then login to Nagios Web-interface

[ Note = You should now be able to access the Nagios web interface at the URL below. You'll be prompted for the username (nagiosadmin) and password you specified earlier. ]

URL is = http://<nagios server ip/nagios

Example = http://192.168.1.1/nagios

How to install Nagios Arana Theme ?

1] Move old Nagios theme into new folder.

[root@server ~]# mkdir /usr/local/nagios/share/old-theme
[root@server ~]# mv /usr/local/nagios/share/* old-theme

2] Download Arana Theme.

[root@server ~]# cd /usr/local/nagios/share
[root@server share]# wget http://kaz.dl.sourceforge.net/project/arana-nagios/arana_style-1.0for-Nagios3x-ENG.zip

[root@server share]# unzip arana_style-1.0for-Nagios3x-ENG.zip
[root@server share]# cd

3] Restart Nagios.

[root@server ~]# service nagios reload

No comments: