Below is a combination of shell & expect script which helps to monitor Redis cache.
Get your shell script [redistest.sh] embedded in Nagios/Zenoss [ or whichever monitoring tool you are using ] to set up monitoring for redis cache.
Get your shell script [redistest.sh] embedded in Nagios/Zenoss [ or whichever monitoring tool you are using ] to set up monitoring for redis cache.
redistest.sh
#!/bin/bash
set -x
var=`/tmp/redistest| awk '{print $1}'|grep PONG|cut -c2-5`
echo $var
if [ "$var" == "PONG" ]
then
echo "Redis is now running fine |"
exit 0
else
echo "Redis is having some issue |"
exit 2
fi
echo "Unknown error|"
exit 3
|
redistest
#!/usr/bin/expect
set timeout 5
set serverip "10.50.16.10"
set port 6379
spawn telnet $serverip $port
send "ping\r"
expect "+PONG"
exit
|
Reference:
No comments:
Post a Comment