Nagios- Installation

From open-voip.org

Jump to: navigation, search

The following instructions will guid you how to install Nagios 3 on Fedora 9:

Contents

Nagios preparations

Install the following needed packages:

 yum install httpd php
 yum install gcc glibc glibc-common
 yum install gd gd-devel

Create nagios user with paswword "nagios":

 /usr/sbin/useradd -m nagios
 passwd nagios

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.

 /usr/sbin/groupadd nagcmd
 /usr/sbin/usermod -a -G nagcmd nagios
 /usr/sbin/usermod -a -G nagcmd apache

Downloading Nagios and Plugins

 cd /opt
 mkdir nagios
 cd nagios/
 wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz
 wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz

Installing Nagios

 su -
 cd /opt/nagios/
 tar -zxvf nagios-3.2.0.tar.gz
 cd nagios-3.2.0
 ./configure --with-command-group=nagcmd
 make all

Install binaries, init script, sample config files and set permissions on the external command directory

 make install
 make install-init
 make install-config
 make install-commandmode


First configurations

Change the nagiosadmin email to your email as follow:

  vi /usr/local/nagios/etc/objects/contacts.cfg
 define contact{
       contact_name                    nagiosadmin             ; Short name of user
       use                             generic-contact         ; Inherit default values from generic-contact template 
       alias                           Nagios Admin            ; Full name of user
       email                           amos.shahar@gmail.com   ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
       }

Configure The Web interface

Install the Nagios web config file in the Apache conf.d directory.

make install-webconf

Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account - you’ll need it later. We will use "nagios" password here:

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Restart Apache to make the new settings take effect.

 service httpd restart

Compile and Install the Nagios Plugins

 cd /opt/nagios
 tar -zxvf nagios-plugins-1.4.11.tar.gz
 cd nagios-plugins-1.4.11
 ./configure --with-nagios-user=nagios --with-nagios-group=nagios
 make
 make install

Start Nagios

Add Nagios to the list of system services and have it automatically start when the system boots.

 chkconfig --add nagios
 chkconfig nagios on

Verify and start Nagios

 /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
 service nagios start


Disable Selinux

verify if selinux enforced:

 getenforce

disable temporarly, edit the following file:

 setenforce 0

for prmanent solution:

 vi /etc/selinux/config

Change the following line:

 SELINUX=permissive

abd reboot

 init 6

Login to the Web Interface

make sure the iptable is stopped

 /etc/init.d/iptables stop
 /etc/init.d/httpd start

browse to the web:

 http://192.168.0.148/nagios
Personal tools