Skip to content

Instantly share code, notes, and snippets.

@JMSwag
Created August 30, 2015 23:23
Show Gist options
  • Save JMSwag/411686d6cbd1021bd3b4 to your computer and use it in GitHub Desktop.
Save JMSwag/411686d6cbd1021bd3b4 to your computer and use it in GitHub Desktop.
add-apt-repository -y ppa:formorer/icinga
apt-get update
apt-get install -y icinga2 nagios-plugins postgresql icinga2-ido-pgsql apache2 pnp4nagios
service icinga2 start
cd /tmp
sudo -u postgres psql -c "CREATE ROLE icinga WITH LOGIN PASSWORD 'icinga'";
sudo -u postgres createdb -O icinga -E UTF8 icinga
sudo -u postgres createlang plpgsql icinga
echo 'local icinga icinga md5' >> /etc/postgresql/*/main/pg_hba.conf
echo 'host icinga icinga 127.0.0.1/32 md5' >> /etc/postgresql/*/main/pg_hba.conf
echo 'host icinga icinga ::1/128 md5\n' >> /etc/postgresql/*/main/pg_hba.conf
export PGPASSWORD=icinga
psql -U icinga -d icinga < /usr/share/icinga2-ido-pgsql/schema/pgsql.sql
icinga2 feature enable ido-pgsql
service icinga2 restart
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
service iptables save
icinga2 feature enable command
icinga2 feature enable perfdata
icinga2 feature enable graphite
echo 'perfdata_spool_dir = /var/spool/icinga2/perfdata' > /etc/pnp4nagios/npcd.cfg
usermod -a -G icingacmd www-data
service icinga2 restart
service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment