Nagios Automated Script for Ubuntu

#! /bin/bash

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install openssh-server build-essential libgd2-xpm-dev apache2 php-pear rrdtool librrds-perl php5-gd php5-common php5 libapache2-mod-php5
sudo gedit/etc/apache2/apache2.configure

sudo /etc/init.d/apache2 restart

sudo useradd -m nagios
sudo passwd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
sudo usermod -a -G nagcmd www-data

sudo mkdir downloads
cd downloads
tar -xvf nagios-3.4.4.tar.gz
tar -xvf nagios-plugins-1.4.16.tar.gz

cd nagios
./configure –with-command-group=nagcmd
sed -i ‘s:for file in includes/rss/;:for file in includes/rss/.;:g’ ./html/Makefile
sed -i ‘s:for file in includes/rss/extlib/;:for file in includes/rss/extlib/.
;:g’ ./html/Makefile
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
make install-exfoliation
make install-classicui
mkdir /usr/local/nagios/etc
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

cd /home/ourquiza/downloads
cd nagios-plugins-1.4.16
./configure –with-nagios-user=nagios –with-nagios-group=nagios
make all
make install
ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
chown nagios.nagcmd /usr/local/nagios/var/rw
chmod g+rwx /usr/local/nagios/var/rw
chmod g+s /usr/local/nagios/var/rw
/etc/init.d/nagios restart
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s