Created
May 17, 2013 04:55
-
-
Save kevinbin/5597007 to your computer and use it in GitHub Desktop.
nagios & nagios plugin install script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Any Failing Command Will Cause The Script To Stop | |
set -e | |
# Treat Unset Variables As Errors | |
set -u | |
NAGIOS_VERSION=3.5.0 | |
PLUGIN_VERSION=1.4.16 | |
echo "***** Starting Nagios Quick-Install: " `date` | |
echo "***** Installing pre-requisites" | |
yum -y install httpd gcc glibc glibc-common gd gd-devel php | |
echo "***** Setting up the environment" | |
useradd -m nagios | |
echo "nagios" |passwd --stdin nagios | |
groupadd nagcmd | |
usermod -a -G nagcmd nagios | |
usermod -a -G nagcmd apache | |
echo "***** Getting the Nagios Source $NAGIOS_VERSION and Plug-Ins $PLUGIN_VERSION" | |
cd /usr/local/src | |
wget -c http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-$NAGIOS_VERSION.tar.gz | |
wget -c http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-$PLUGIN_VERSION.tar.gz | |
tar xzf nagios-$NAGIOS_VERSION.tar.gz | |
tar xzf nagios-plugins-$PLUGIN_VERSION.tar.gz | |
echo "***** Installing Nagios" | |
cd /usr/local/src/nagios | |
./configure --with-command-group=nagcmd | |
make all | |
make install | |
make install-init | |
make install-config | |
make install-commandmode | |
make install-webconf | |
echo "***** Setting up htpasswd auth" | |
htpasswd -nb nagiosadmin nagios > /usr/local/nagios/etc/htpasswd.users | |
service httpd restart | |
echo "***** Setting up Nagios Plug-Ins" | |
cd /usr/local/src/nagios-plugins-$PLUGIN_VERSION | |
./configure --with-nagios-user=nagios --with-nagios-group=nagios | |
make | |
make install | |
echo "***** Fixing SELinux" | |
if [[ `getenforce` == Enforcing ]]; then | |
chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/ | |
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/ | |
fi | |
echo "***** Starting Nagios" | |
chkconfig --add nagios | |
chkconfig nagios on | |
service nagios start | |
echo "***** Done: " `date` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment