Monday, 5 March 2012

How to Install Nagios

#!/bin/bash
#By speed
#This is to install Nagios
#
#Script Must Run as root
if [[ $EUID -ne 0 ]]
then
            echo "This Script must be run as root User" 1>&2
            exit 1
fi
cd /usr/local/src
yum install -y wget

wget http://sourceforge.net/projects/nagios/files/nagios-3.x/nagios-3.3.1/nagios-3.3.1.tar.gz
wget http://sourceforge.net/projects/nagios/files/nagiosplug/1.4.15/nagios-plughins-1.4.15.tar.gz
#we need compiler because we don't have repositorys.
yum install -y httpd pho gcc glibc glibc-common gd gd-devel make mysql mysql-devel net-snmp
# here mysql mysql, netsnmp if you need to monitor mysql and switches etc....
useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios


tar zxvf nagios-3.3.1.tar.gz
tar zxvf nagios-plugins-1.4.15.tar.gz

cd nagios
#compile commands
./configure --with-command-group=nagcmd
make all
make install; make install-init; make install-config; make install-commandmode; maike install-webconf


cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/

chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers

cd ..
cd nagios-plugin*
./configure --with-nagios-user=nagios --with-nagios-group=nagios

make
make install
chkconfig --add nagios
chkconfig nagios on
chkconfig httpd on
exit 0

No comments:

Post a Comment