Skip to content

Instantly share code, notes, and snippets.

@bugcy013
Forked from masterzen/mk-heartbeat-check.sh
Created January 5, 2018 14:41
Show Gist options
  • Save bugcy013/72eca908b5e8ca094a52ef7d24e109dc to your computer and use it in GitHub Desktop.
Save bugcy013/72eca908b5e8ca094a52ef7d24e109dc to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment