[ SEA-GHOST MINI SHELL]
# DISCOVERY (@PARAMS = #1 PASSWORDS LIST)
UserParameter=redis.discovery[*], /var/lib/zabbix/redis_discovery.bash $1 $2
# METRICS (@PARAMS = #1 - METRIC, #2 - REDIS HOST, #3 - REDIS PORT)
# EXAMPLE: master_last_io_seconds_ago:7
UserParameter=redis.stat.get[*],output=`cat /tmp/redis-$2-$3 2>/dev/null | grep "$1:" | cut -d":" -f2`; if [ -z $output ]; then echo 0; else echo $output; fi
# METRICS (@PARAMS = #1 - METRIC, #2 - METRIC SUBKEY, #3 - REDIS HOST, #4 - REDIS PORT)
# EXAMPLE: cmdstat_ping:calls=142434,usec=210078,usec_per_call=1.47
UserParameter=redis.stat.mget[*],output=`cat /tmp/redis-$3-$4 2>/dev/null | grep "$1:" | grep -oP '(?<=\b$2=)[^,]+'`; if [ -z $output ]; then echo 0; else echo $output; fi
# METRICS (@PARAMS = #1 - REDIS HOST, #2 - REDIS PORT)
UserParameter=redis.slowlog.count[*],output=`cat /tmp/redis-$1-$2-slowlog-len 2>/dev/null`; if [ "$output" = "" ]; then echo 0; else echo $output; fi
UserParameter=redis.slowlog.get[*],output=`cat /tmp/redis-$1-$2-slowlog-raw 2>/dev/null`; if [ "$output" = "" ]; then echo 0; else echo $output;redis-cli -h $1 -p $2 -a "$3" slowlog reset 2>/dev/null; fi
UserParameter=redis.maxclients[*],output=`cat /tmp/redis-$1-$2-maxclients 2>/dev/null`; if [ "$output" = "" ]; then echo 0; else echo $output; fi
SEA-GHOST - SHELL CODING BY SEA-GHOST