check_logfiles: 3.7.5.1
[omd.git] / packages / pnp4nagios / PNP4NAGIOS.hook
bloba978f9e08ff6711a973a2cded57b340dd0e14dab
1 #!/bin/bash
3 # Alias: Process performance data with PNP4Nagios
4 # Menu: Addons
5 # Description:
6 # PNP4Nagios is a great addon for storing Nagios performance data
7 # into round robin databases. This switch enabled the processing
8 # of performance data by pnp. It implies the starting of the daemon
9 # "npcd", the rrdcached and load the broker module npcdmod into
10 # Nagios.
12 case "$1" in
13 default)
14 echo "on"
16 choices)
17 echo "on: enable bulk mode with npcdmod and npcd"
18 echo "npcd: enable bulk mode with npcd"
19 echo "gearman: enable gearman worker"
20 echo "off: disable"
22 set)
23 if [ "$2" == "on" ]
24 then
25 #mkdir -p $OMD_ROOT/etc/nagios/nagios.d
26 if [ -e $OMD_ROOT/etc/nagios/nagios.d ] ; then
27 ln -sfn ../../pnp4nagios/nagios_npcdmod.cfg $OMD_ROOT/etc/nagios/nagios.d/pnp4nagios.cfg
29 if [ -e $OMD_ROOT/etc/icinga/icinga.d ] ; then
30 ln -sfn ../../pnp4nagios/nagios_npcdmod.cfg $OMD_ROOT/etc/icinga/icinga.d/pnp4nagios.cfg
32 ln -sfn ../../pnp4nagios/apache.conf $OMD_ROOT/etc/apache/conf.d/pnp4nagios.conf
33 if [ -s $OMD_ROOT/etc/mod-gearman/perfdata.conf ]; then
34 sed -i -e 's/^perfdata=.*$/perfdata=no/' $OMD_ROOT/etc/mod-gearman/perfdata.conf
36 elif [ "$2" == "gearman" ]
37 then
38 if [ -e $OMD_ROOT/etc/nagios/nagios.d ] ; then
39 ln -sfn ../../pnp4nagios/nagios_gearman.cfg $OMD_ROOT/etc/nagios/nagios.d/pnp4nagios.cfg
41 if [ -e $OMD_ROOT/etc/icinga/icinga.d ] ; then
42 ln -sfn ../../pnp4nagios/nagios_gearman.cfg $OMD_ROOT/etc/icinga/icinga.d/pnp4nagios.cfg
44 ln -sfn ../../pnp4nagios/apache.conf $OMD_ROOT/etc/apache/conf.d/pnp4nagios.conf
45 if [ -s $OMD_ROOT/etc/mod-gearman/perfdata.conf ]; then
46 sed -i -e 's/^perfdata=.*$/perfdata=yes/' $OMD_ROOT/etc/mod-gearman/perfdata.conf
48 elif [ "$2" == "npcd" ]
49 then
50 if [ -e $OMD_ROOT/etc/nagios/nagios.d ] ; then
51 ln -sfn ../../pnp4nagios/nagios_npcd.cfg $OMD_ROOT/etc/nagios/nagios.d/pnp4nagios.cfg
53 if [ -e $OMD_ROOT/etc/icinga/icinga.d ] ; then
54 ln -sfn ../../pnp4nagios/nagios_npcd.cfg $OMD_ROOT/etc/icinga/icinga.d/pnp4nagios.cfg
56 ln -sfn ../../pnp4nagios/apache.conf $OMD_ROOT/etc/apache/conf.d/pnp4nagios.conf
57 else
58 rm -f $OMD_ROOT/etc/nagios/nagios.d/pnp4nagios.cfg
59 rm -f $OMD_ROOT/etc/icinga/icinga.d/pnp4nagios.cfg
60 rm -f $OMD_ROOT/etc/apache/conf.d/pnp4nagios.conf
61 if [ -s $OMD_ROOT/etc/mod-gearman/perfdata.conf ]; then
62 sed -i -e 's/^perfdata=.*$/perfdata=no/' $OMD_ROOT/etc/mod-gearman/perfdata.conf
67 esac