Check for connectivity to memcached.

This will attempt to call the daemon's stats command which, if broken, might
hung and cause nrpe to time out.  We want that, as it will give us a clue to
what might be causing some other app to fail.
This commit is contained in:
Ralph Bean 2014-11-19 18:35:14 +00:00
parent 42e44b6e8e
commit 85c486b34b
5 changed files with 41 additions and 3 deletions

View file

@ -0,0 +1,24 @@
#!/bin/bash
#
# 2014-12-19
# Author: Ralph Bean <rbean@redhat.com>
# exit codes
ok=0
warn=1
crit=2
unkn=3
# Right now we just check to see if we can even run this command without
# hanging and timing out. In the future, we could parse stdout for more
# fine-grained information.
echo stats | nc 127.0.0.1 11211 > /dev/null
status=$?
if [ $status -ne 0 ]; then
echo "CRIT: stats command got status code $status"
exit $crit
else
echo "OK: stats command got status code $status"
exit $ok
fi