Skip to content

Instantly share code, notes, and snippets.

@nowthatsamatt
Created December 27, 2013 18:18
Show Gist options
  • Select an option

  • Save nowthatsamatt/8150657 to your computer and use it in GitHub Desktop.

Select an option

Save nowthatsamatt/8150657 to your computer and use it in GitHub Desktop.
This'll install Nagios 4 on Ubuntu 12.04.
apt-get update && apt-get upgrade -y
apt-get install -y libgd2-xpm-dev apache2 php5 libnet-snmp-perl libperl5.14 libpq5 libradius1 libsensors4 libsnmp-base libsnmp15 libtalloc2 libtdb1 libwbclient0 samba-common samba-common-bin smbclient snmp whois libmysqlclient15-dev libssl-dev daemon
cd /usr/local/src
wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.2.tar.gz
wget http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.14/nrpe-2.14.tar.gz
tar -xzvf https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
tar -xzvf http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.2.tar.gz
tar -xzvf http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.14/nrpe-2.14.tar.gz
useradd -m -s /bin/bash nagios
passwd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd www-data
# install nagios
cd /usr/local/src/nagios-4.0.2
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-commandmode
make install-config
make install-webconf
# install nagios-plugins
cd /usr/local/src/nagios-plugins-1.5
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
# install nrpe
cd /usr/local/src/nrpe-2.14
./configure --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu
make
cp /usr/local/src/nrpe-2.14/src/check_nrpe /usr/local/nagios/libexec/
# create login credentials
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
# back up the old init script for reference
mkdir /root/nagios-backups && cp /etc/init.d/nagios /root/nagios-backups/
# put the following code in here https://gist.github.com/nowthatsamatt/8150610
vim /etc/init.d/nagios
# start up the required services
service apache2 restart
service nagios start
# make it easy to see the config in /etc
cd /etc && ln -s /usr/local/nagios/etc nagios
# configure nagios to start on boot
ln -s /etc/init.d/nagios /etc/rc2.d/S20nagios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment