Pages

Unixbhaskar's Blog

Saturday, February 6, 2010

Installing Nagios made easy

Installing nagios by hand is good but not recommended.Instead use a small script to do the job for you...because being an system admin you have lot of thing to take care...so the time will be crucial factor. But having said I have had no intention to make it a point that you automate whatever you want. Sometime the automation has the adverse effect on system.You do automation when it must require and need.

I do not issue any guarantee that this will work for you.

So the script for installing Nagios and it's plugins from source is below...u can also enhance it if you want...

#!/bin/bash
# This script will install Nagios from source along with the plugins.
dir=/usr/local/nagios
wget -c http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.6.tar.gz
wget -c http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz
mkdir -p $dir
grep -i “red hat” /etc/issue>/dev/null2>&1
if [ `echo $? ` = 0 ];then
useradd nagios
else
groupadd nagios
useradd -G nagios nagios
fi
tar xzf nagios-plugins-1.4.11.tar.gz
cd nagios-plugins-1.4.11
./configure –prefix=/usr/local/nagios –enable-redhat-pthread-workaround
make
make install
cd ..
tar xzf nagios-3.0.6.tar.gz
cd nagios-3.0.6
./configure –prefix=/usr/local/nagios
make install
make install-init
make install-config
make install-commandmode
make install-webconf
# make sure xinetd is installed.
echo ” nrpe 5666/tcp #nrpe” >> /etc/services
chown -R nagios.nagios /usr/local/nagios
service xinetd [...]

But one word caution for heaven's sake please investigate manually or put some mechanism within the script to check that everything done as required.

Hope this will help.

Bhaskar Chowdhury
Google Talk: unixbhaskar Skype: unixbhaskar Y! messenger: unixbhaskar
DiggLinkedinWordpressTwitterTechnoratiStumbleuponReddit

No comments:

Post a Comment