SOURCES: nagios-notify.sh - sanity check
glen
glen at pld-linux.org
Thu Aug 3 14:39:27 CEST 2006
Author: glen Date: Thu Aug 3 12:39:27 2006 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- sanity check
---- Files affected:
SOURCES:
nagios-notify.sh (1.2 -> 1.3)
---- Diffs:
================================================================
Index: SOURCES/nagios-notify.sh
diff -u SOURCES/nagios-notify.sh:1.2 SOURCES/nagios-notify.sh:1.3
--- SOURCES/nagios-notify.sh:1.2 Thu Aug 3 14:36:06 2006
+++ SOURCES/nagios-notify.sh Thu Aug 3 14:39:22 2006
@@ -9,6 +9,7 @@
#
templatedir='/etc/nagios/templates'
+prog="${0##*/}"
# Substutute Nagios $VAR$-s (which are exported to environment by Nagios) from template.
template_subst() {
@@ -24,12 +25,17 @@
}' | sed -f - $tmpl
}
+if [ -z "$NAGIOS_STATUSDATAFILE" ]; then
+ echo >&2 "$prog: This program must be ran from Nagios."
+ exit 1
+fi
+
# extract nagios version from status file
export NAGIOS_VERSION=$(awk -F= '/version=/{print $2}' $NAGIOS_STATUSDATAFILE)
tmpl="$templatedir/$1.tmpl"
if [ ! -f "$tmpl" ]; then
- echo >&2 "$0: template '$tmpl' can not be found!"
+ echo >&2 "$prog: template '$tmpl' can not be found!"
exit 1
fi
================================================================
---- CVS-web:
http://cvs.pld-linux.org/SOURCES/nagios-notify.sh?r1=1.2&r2=1.3&f=u
More information about the pld-cvs-commit
mailing list