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