bugcy013
1/5/2018 - 2:41 PM

Opennms General Poller for mk-heartbeat

Opennms General Poller for mk-heartbeat

#!/bin/sh

set -e
set -o pipefail

hostname=$2
RET=`/usr/bin/mk-heartbeat --database test --table heartbeat --user <user> --pass <pass> --host $hostname --check | sed -r -e 's, ,,g'`
RETVAL="$?"
if [ "$RETVAL" != "0" ]; then
	exit $RETVAL
fi

if [ "$RET" -gt 5 ]; then
	echo "NO"
else
	echo "OK"
fi
exit 0