Last active
August 29, 2015 14:07
-
-
Save martinufo/5419c06cc21c3a7c1024 to your computer and use it in GitHub Desktop.
Simple nagios plugins for Redis
This file contains hidden or 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/sh -e | |
| if [ "$#" -ne 5 ]; then | |
| echo "Invalid usage" | |
| echo "`basename $0` host port key 200000 4000000" | |
| exit 2 | |
| fi | |
| LLEN=`redis-cli --raw -h $1 -p $2 LLEN $3` | |
| echo -n "REDIS $1:$2 (key $3) " | |
| if [ "$LLEN" -lt "$4" ]; then | |
| echo -n " OK" | |
| RET=0 | |
| else | |
| if [ "$LLEN" -lt "$5" ]; then | |
| echo -n "WARNING" | |
| RET=1 | |
| else | |
| echo -n "CRITICAL" | |
| RET=2 | |
| fi | |
| fi | |
| echo ", list length = $LLEN" | |
| exit $RET |
This file contains hidden or 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/sh -e | |
| if [ "$#" -ne 4 ]; then | |
| echo "Invalid usage" | |
| echo "`basename $0` host port 200000 4000000" | |
| exit 2 | |
| fi | |
| MEM=`redis-cli --raw -h $1 -p $2 INFO | tr -d '\r' | awk -F: '$1=="used_memory" { print $2 }'` | |
| echo -n "REDIS $1:$2 " | |
| if [ "$MEM" -lt "$3" ]; then | |
| echo -n " OK" | |
| RET=0 | |
| else | |
| if [ "$MEM" -lt "$4" ]; then | |
| echo -n "WARNING" | |
| RET=1 | |
| else | |
| echo -n "CRITICAL" | |
| RET=2 | |
| fi | |
| fi | |
| echo ", used memory = $MEM" | |
| exit $RET |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment