Last active
January 3, 2016 12:38
-
-
Save mabrizio/8463922 to your computer and use it in GitHub Desktop.
Ubuntu + Nagios recipe
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
# inspired by: http://wellsie.net/p/248/ | |
sudo apt-get update | |
sudo apt-get dist-upgrade | |
sudo apt-get install libgd2-xpm-dev apache2 apache2-mpm-prefork \ | |
apache2-threaded-dev apache2-utils apache2.2-bin \ | |
apache2.2-common libapache2-mod-php5 php5 gcc g++ \ | |
make daemon libnet-snmp-perl libperl5.14 libpq5 \ | |
libradius1 libsensors4 libsnmp libcgi-pm-perl \ | |
librrds-perl libgd-gd2-perl | |
sudo useradd -m -s /bin/bash nagios | |
sudo passwd nagios | |
sudo groupadd nagcmd | |
sudo usermod -a -G nagcmd nagios | |
sudo usermod -a -G nagcmd www-data | |
# nagios | |
wget http://downloads.sourceforge.net/project/nagios/nagios-4.x/nagios-4.0.2/nagios-4.0.2.tar.gz | |
tar xzvf nagios-4.0.2.tar.gz | |
cd nagios-4.0.2 | |
./configure --with-command-group=nagcmd | |
make all | |
sudo make install | |
sudo make install-init | |
sudo make install-commandmode | |
sudo make install-config | |
sudo make install-webconf | |
sudo cp /etc/init.d/nagios /etc/init.d/nagios.old | |
git clone https://gist.github.com/8463854.git | |
cd 8463854 | |
cat etc-init.d-nagios.sh | sudo tee /etc/init.d/nagios | |
# nagios-plugins | |
wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz | |
tar xzvf nagios-plugins-1.5.tar.gz | |
cd nagios-plugins-1.5 | |
./configure --with-nagios-user=nagios --with-nagios-group=nagios | |
make | |
make install | |
# shell alias | |
# tcsh | |
echo "alias nverif sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg" | tee -a ~/.cshrc | |
source ~/.cshrc | |
# bash | |
echo 'alias nverify="/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg"' | tee -a ~/.bash_aliases | |
# Nagios Remote Plugin Executor | |
wget http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz | |
tar -xzvf nrpe-2.15.tar.gz | |
cd nrpe-2.15 | |
./configure --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu | |
make | |
sudo install -o nagios -g nagios src/check_nrpe /usr/local/nagios/libexec/ | |
# apache | |
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin | |
sudo service apache2 restart | |
sudo service nagios start | |
service nagios status | |
sudo ln -s /etc/init.d/nagios /etc/rc2.d/S20nagios | |
sudo reboot | |
# nagiosgraph | |
wget http://downloads.sourceforge.net/project/nagiosgraph/nagiosgraph/1.4.4/nagiosgraph-1.4.4.tar.gz | |
tar -xzvf nagiosgraph-1.4.4.tar.gz | |
cd nagiosgraph-1.4.4 | |
sudo ./install.pl --check-prereq | |
# if everything looks fine: | |
./install.pl --layout standalone --prefix /usr/local/nagiosgraph | |
# everything by default except the last two options: | |
Path of Nagios commands file? /usr/local/nagios/etc/objects/commands.cfg | |
Modify the Apache configuration? [n] y | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment