Zabbix Monitoring Redis health status
Last Update:2018-07-26
Source: Internet
Author: User
Reference: Zabbix monitoring Redis Various status http://blog.csdn.net/saga_gallon/article/details/51242346 redis info Parameters Summary:/http www.wutianqi.com/?p=3620 http://blog.csdn.net/lang_man_xing/article/details/38539057
Basic idea: Get the individual parameter values in Redis info through a script. To gain monitoring status
The script is as follows:
vi/usr/local/zabbix/bin/redismonitor.sh
#! /bin/bash #Name: redismontior.sh #From: zhangm412@126.com <2014/08/06> #Action: Zabbix monitoring Redis Plug-in
Rediscli= "/usr/local/redis/src/redis-cli" host= "192.168.1.50" port=6379
if [[$# = = 1]];then case $ in Version] &N Bsp result= ' $REDISCLI-H $HOST-P $PORT Info | Grep-w "Redis_version" | Awk-f ': ' {print $} ' Echo $result ;; uptime) result= ' $REDISCLI-H $HOST-P $PORT Info | Grep-w "Uptime_in_seconds" | Awk-f ': ' {print $} ' Echo $result ;; connected_clients) result= ' $REDISCLI-H $HOST-P $PO RT Info | Grep-w "Connected_clients" | Awk-f ': ' {print $} ' Echo $result ;; blocked_clients) result= ' $REDISCLI-H $HOST-P $PORT info | Grep-w "Blocked_clients" | Awk -F ': ' {print $} ' Echo $result ;; used_memory) result= ' $REDISCLI-H $HOST-P $PORT inf o | Grep-w "Used_memory" | Awk-f ': ' {print $} ' Echo $result ;; Used_memory_rss) result= ' $REDISCLI-H $HOST-P $PORT info | Grep-w "Used_memory_rss" | Awk-f ': ' {print $} ' Echo $result ;; Used_memory_peak) result= ' $REDISCLI-H $HOST-P $POR T Info | Grep-w "Used_memory_peak" | Awk-f ': ' {print $} ' Echo $result ;; Used_memory_lua) result= '$REDISCLI-H $HOST-P $PORT Info | Grep-w "Used_memory_lua" | Awk-f ': ' {print $} ' Echo $result ;; Used_cpu_sys) result= ' $REDISCLI-H $HOST-P $PORT in Fo | Grep-w "Used_cpu_sys" | Awk-f ': ' {print $} ' Echo $result ;; Used_cpu_user) result= ' $REDISCLI-H $HOST-P $PORT I NFO | Grep-w "Used_cpu_user" | Awk-f ': ' {print $} ' Echo $result ;; Used_cpu_sys_children) result= ' $REDISCLI-H $HOST-P $PORT Info | Grep-w "Used_cpu_sys_children" | Awk-f ': ' {print $} ' Echo $result ;; Used_cpu_user_children) result= ' $REDISCLI-H $HOST-P $PORT Info | Grep-w "Used_cpu_user_children" | Awk-f ': ' {print $} ' Echo $result ;; Rdb_last_bgsave_status) result= ' $REDISCLI-H $HOST- P $PORT info | Grep-w "Rdb_last_bgsave_status" | Awk-f ': ' {print $} ' | Grep-c OK ' Echo $result ;; Aof_last_bgrewrite_status) result= ' $REDISCLI-H $HOS T-p $PORT info | Grep-w "Aof_last_bgrewrite_status" | Awk-f ': ' {print $} ' | Grep-c OK ' Echo $result ;; Aof_last_write_status) result= ' $REDISCLI-H $HOST-P $PORT info | Grep-w "Aof_last_write_status" | Awk-f ': ' {print $} ' | Grep-c OK ' Echo $result ;; *) ECHO-E "\033[33musage: $ {Connected_clients|blo Cked_clients|used_memory|used_memory_rss|used_memory_peak|used_memory_lua|used_cpu_sys|used_cpu_user|used_cpu_ Sys_children|used_cpu_user_children|rdb_last_bgsave_status|aof_last_bgrewrite_status|aof_last_write_status}\ 033[0m "
;; ESAC elif [[$# = 2]];then case $ in keys] result= ' $REDISCLI-H $HOST-P $PORT Info | Grep-w "$" | Grep-w "Keys" | Awk-f ' =|, ' {print $} ' Echo $result ;; expires) result= ' $REDISCLI-H $HOST-P $PORT Info | Grep-w "$" | Grep-w "Keys" | Awk-f ' =|, ' {print $4} ' Echo $result ;; Avg_ttl) result= ' $REDISCLI-H $HOST-P $PORT Info | Grep-w "$" | Grep-w "Avg_ttl" | Awk-f ' =|, ' {print $6} ' Echo $result ;; *) ECHO-E "\033[33musage: $ {DB0 keys|db0 expires|db0 avg_ttl}\033[0m " ;; Esac fi
The Zabbix client then writes key:userparameter=redis.info[*],/usr/local/zabbix/bin/redismonitor.sh $
Zabbix interface Add Template: (
the advantage of adding a template is that Redis is generally used as a cluster for easy monitoring 。 )
Then add the monitoring item inside the template: Here's just an example, and virtually all of the parameters are added to the monitoring
The creation of graphs and triggers is done according to your own requirements.