Skip to content

Instantly share code, notes, and snippets.

@zerwes
Created May 12, 2023 04:39
Show Gist options
  • Save zerwes/01f1667ce1ab32cb0940c0fc03f7abb4 to your computer and use it in GitHub Desktop.
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
#!/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