pnp4nagios

#
# graph (server)
# TODO: BROKEN with Icinga 1.7.1?
#
apt-get install -y pnp4nagios

sed -i 's|/cgi-bin/nagios3|/icinga/cgi-bin|g' /etc/pnp4nagios/config.php

sed -i 's|/etc/nagios3/htpasswd.users|/etc/icinga/htpasswd.users|g' /etc/pnp4nagios/apache.conf

sed -i 's|process_performance_data=0|process_performance_data=1|g' /etc/icinga/icinga.cfg
sed -i 's|#broker_module=/usr/lib/icinga/idomod.so config_file=/etc/icinga/idomod.cfg|broker_module=/usr/lib/pnp4nagios/npcdmod.o config_file=/etc/pnp4nagios/npcd.cfg|g' /etc/icinga/icinga.cfg

sed -i 's|log_type = syslog|log_type = file|g' /etc/pnp4nagios/npcd.cfg
sed -i 's|log_level = 0|log_level = 2|g' /etc/pnp4nagios/npcd.cfg

sed -i 's|LOG_LEVEL = 0|LOG_LEVEL = 2|g' /etc/pnp4nagios/process_perfdata.cfg

cat < /etc/icinga/objects/pnptemplate.cfg
define host {
name pnp-hst
register 0
action_url /pnp4nagios/graph?host=$HOSTNAME$' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=_HOST_
}

define service {
name pnp-svc
register 0
action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=$SERVICEDESC$
}
EOF

sed -i '/name/a\ use pnp-hst ;\' /etc/icinga/objects/generic-host_icinga.cfg
sed -i '/name/a\ use pnp-svc ;\' /etc/icinga/objects/generic-service_icinga.cfg
cp /usr/share/doc/pnp4nagios/examples/ssi/status-header.ssi /usr/share/icinga/htdocs/ssi/

sed -i 's|RUN="no"|RUN="yes"|g' /etc/default/npcd

service icinga restart

service npcd restart