Skip to content

Instantly share code, notes, and snippets.

@bmangesh
Created January 26, 2015 19:09
Show Gist options
  • Save bmangesh/8c16a837042635f4d0e2 to your computer and use it in GitHub Desktop.
Save bmangesh/8c16a837042635f4d0e2 to your computer and use it in GitHub Desktop.
Automated Installation of NAGIOS ON SERVER SIDE
#! /bin/bash
#Author : MANGESHKUMAR B. BHARSAKLE
#Date : 26,27 JAN 2015
#Automated Installation of NAGIOS ON SERVER SIDE
cd /tmp/
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.1.tar.gz
wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
echo " "
echo "Adding users"
echo " "
useradd nagios
groupadd nagcmd
usermod -aG nagcmd nagios
usermod -aG nagcmd apache
echo " "
echo "Unpacking sources"
echo " "
tar zxvf nagios-4.0.1.tar.gz
tar zxvf nagios-plugins-1.5.tar.gz
echo "Configuring and Making Nagios Core"
echo " "
cd nagios-4.0.1
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-commandmode
make install-config
make install-webconf
echo "-------------Configuration Done.............. "
###########################################################################################
cd /tmp/
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
echo " "
echo "Starting services"
echo " "
/etc/init.d/nagios start
/etc/init.d/httpd start
/etc/init.d/httpd restart
echo " "
echo "New password is for the nagiosadmin account. Please remember what you'll enter here! "
echo " "
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
echo "---------------------Password Set Successfully ------------------ "
############################################################################################
echo "Configuring and Making Nagios plugins"
echo " "
cd /tmp/nagios-plugins-1.5
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
echo " "
echo "Configuring startup services"
echo " "
chkconfig --add nagios
chkconfig --level 35 nagios on
chkconfig --add httpd
chkconfig --level 35 httpd on
echo " Starting Nagios Service"
service nagios restart
echo "Finished apparently. "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment