Created
May 12, 2023 04:39
-
-
Save zerwes/01f1667ce1ab32cb0940c0fc03f7abb4 to your computer and use it in GitHub Desktop.
simple checkmk local plugin to check redis server state using a redis ping: expected response = pong
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 smartindent nu ft=bash | |
declare -i RET=0 | |
STATUS="OK" | |
O=$(REDISCLI_AUTH="$(sed '/^masterauth/!d;s/.* //g' /etc/redis/redis.conf)" redis-cli ping 2>&1) | |
RET=$? | |
if [ $RET -gt 0 ]; then | |
RET=2 | |
STATUS="CRITICAL" | |
else | |
if [ "$O" != "PONG" ]; then | |
RET=1 | |
STATUS="WARNING" | |
fi | |
fi | |
echo "$RET REDIS-PING exitcode=$RET $STATUS - ${O}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment