[omd-commits] OMD Git: omd: PNP4NAGIOS hook: tolerate if not all cores are present

git version control git at mathias-kettner.de
Fri Jun 22 10:15:19 CEST 2012


Module:   omd
Branch:   master
Commit:   38492a962a898d7256efcb007c6490e79f6c6c84
URL:      http://omdistro.org/projects/omd/repository/revisions/38492a962a898d7256efcb007c6490e79f6c6c84

Author:   Mathias Kettner <mk at mathias-kettner.de>
Date:     Fri Jun 22 10:15:14 2012 +0200
Commiter: Mathias Kettner <mk at mathias-kettner.de>
Date:     Fri Jun 22 10:15:14 2012 +0200

PNP4NAGIOS hook: tolerate if not all cores are present

---

 packages/pnp4nagios/PNP4NAGIOS.hook |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/packages/pnp4nagios/PNP4NAGIOS.hook b/packages/pnp4nagios/PNP4NAGIOS.hook
index 6966db4..41f0093 100755
--- a/packages/pnp4nagios/PNP4NAGIOS.hook
+++ b/packages/pnp4nagios/PNP4NAGIOS.hook
@@ -22,16 +22,24 @@ case "$1" in
        if [ "$2" == "on" ]
        then
            #mkdir -p $OMD_ROOT/etc/nagios/nagios.d
-           ln -sfn ../../pnp4nagios/nagios_npcdmod.cfg $OMD_ROOT/etc/nagios/nagios.d/pnp4nagios.cfg
-           ln -sfn ../../pnp4nagios/nagios_npcdmod.cfg $OMD_ROOT/etc/icinga/icinga.d/pnp4nagios.cfg
+           if [ -e $OMD_ROOT/etc/nagios/nagios.d ] ; then
+               ln -sfn ../../pnp4nagios/nagios_npcdmod.cfg $OMD_ROOT/etc/nagios/nagios.d/pnp4nagios.cfg
+           fi
+           if [ -e $OMD_ROOT/etc/icinga/icinga.d ] ; then
+               ln -sfn ../../pnp4nagios/nagios_npcdmod.cfg $OMD_ROOT/etc/icinga/icinga.d/pnp4nagios.cfg
+           fi
            ln -sfn ../../pnp4nagios/apache.conf $OMD_ROOT/etc/apache/conf.d/pnp4nagios.conf
            if [ -s $OMD_ROOT/etc/mod-gearman/perfdata.conf ]; then
                sed -i -e 's/^perfdata=.*$/perfdata=no/' $OMD_ROOT/etc/mod-gearman/perfdata.conf
            fi
        elif [ "$2" == "gearman" ]
        then
-           ln -sfn ../../pnp4nagios/nagios_gearman.cfg $OMD_ROOT/etc/nagios/nagios.d/pnp4nagios.cfg
-           ln -sfn ../../pnp4nagios/nagios_gearman.cfg $OMD_ROOT/etc/icinga/icinga.d/pnp4nagios.cfg
+           if [ -e $OMD_ROOT/etc/nagios/nagios.d ] ; then
+               ln -sfn ../../pnp4nagios/nagios_gearman.cfg $OMD_ROOT/etc/nagios/nagios.d/pnp4nagios.cfg
+           fi
+           if [ -e $OMD_ROOT/etc/icinga/icinga.d ] ; then
+               ln -sfn ../../pnp4nagios/nagios_gearman.cfg $OMD_ROOT/etc/icinga/icinga.d/pnp4nagios.cfg
+           fi 
            ln -sfn ../../pnp4nagios/apache.conf $OMD_ROOT/etc/apache/conf.d/pnp4nagios.conf
            if [ -s $OMD_ROOT/etc/mod-gearman/perfdata.conf ]; then
                sed -i -e 's/^perfdata=.*$/perfdata=yes/' $OMD_ROOT/etc/mod-gearman/perfdata.conf



More information about the omd-commits mailing list