-
Hahn Axel (hahn) authoredHahn Axel (hahn) authored
check_clientbackup 1.16 KiB
#!/bin/bash
# ======================================================================
#
# NAGIOS CLIENT CHECK :: check client backup
#
# ----------------------------------------------------------------------
# 2016-12-09 v1.0 first lines
# 2016-12-23 v1.1 added readable exitcode from shared functions file
# 2020-03-05 v1.2 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions
# 2020-04-04 v1.3 <axel.hahn@iml.unibe.ch> set status unknown if never executed
# ======================================================================
. `dirname $0`/inc_pluginfunctions
sInstalldir=/opt/imlbackup/client/
sChecker=$sInstalldir/check_clientbackup.sh
tmpfile=/tmp/clientbackup_status.out
if [ ! -x $sChecker ]; then
ph.abort "$sChecker not found - maybe clientbackup is not installed."
fi
$sChecker >$tmpfile
rc=$?
if [ $rc -eq 0 ]; then
ph.setStatus "ok"
else
grep "Backup was never executed" $tmpfile 2>/dev/null
if [ $? -eq 0 ]; then
ph.setStatus "unknown"
else
ph.setStatus "critical"
fi
fi
ph.status "`fgrep "MONITORINFO:" $tmpfile | cut -f 2- -d ':'`"
rm -f $tmpfile
ph.exit
# ----------------------------------------------------------------------