nagios/check_mysql_cluster
Moritz Rudert (helios) 68840f51ec initial commit
2012-02-12 10:23:57 +01:00

19 lines
480 B
Bash
Executable File

#!/bin/bash
. /usr/lib/nagios/plugins/utils.sh
killall -9 ndb_mgm >/dev/null 2>/dev/null
tmpfile=`mktemp`
ndb_mgm -e show --try-reconnect=1 > $tmpfile 2>/dev/null
if grep -q "Unable to connect " $tmpfile; then
echo "[CRITICAL] unable to connect to mgmt"
exit $STATE_CRITICAL
elif grep -q connected $tmpfile; then
echo "[CRITICAL] not connected: `grep connected $tmpfile | awk '{ printf "%s (%s ", $1, $7 }'`"
exit $STATE_CRITICAL
else
echo "[OK]"
exit $STATE_OK
fi