内容简介:2018-10-31 15:25:46公司最近网站改版,增加了redis服务器,现领导要求需要测试redis的监控,于是从网上找了个redis的监控脚本,简单的修改了一下,测试中没出现任何问题。生产环境中,可根据实际要监控的参数值修改脚本内容,并添加相应的触发器。Redis有自带的redis-cli客户端,通过info命令可以查询到redis的运行情况,我们可以写个shell脚本,通过zabbix来调用这个脚本实现redis的监控。
2018-10-31 15:25:46
公司最近网站改版,增加了 redis 服务器,现领导要求需要测试redis的监控,于是从网上找了个redis的监控脚本,简单的修改了一下,测试中没出现任何问题。生产环境中,可根据实际要监控的参数值修改脚本内容,并添加相应的触发器。
Redis有自带的redis-cli客户端,通过info命令可以查询到redis的运行情况,我们可以写个 shell 脚本,通过zabbix来调用这个脚本实现redis的监控。
一、info命令的使用
要获得redis的当前情况,可以使用info命令。
命令格式:
redis-cli -h [hostname] -p [port] -a [password] info [参数]
redis-cli -h [hostname] -p [port] -c [参数]
1、查询server信息
redis-cli -h 127.0.0.1 -p 6379 -a 'password' info server
2、查询客户端连接情况
redis-cli -h 127.0.0.1 -p 6379 -a 'password' info clients
3、查询内存使用情况
redis-cli -h 127.0.0.1 -p 6379 -a 'password' info memory
4、查询CPU使用情况
redis-cli -h 127.0.0.1 -p 6379 -a 'password' info cpu
5、查询redis集群情况
redis-cli -h 127.0.0.1 -p 6379 -c cluster nodes redis-cli -h 127.0.0.1 -p 6379 -c info server
二、创建redis监控脚本
1、编写监控脚本(第一个脚本是参考网上的,第二个脚本是根据系统实际情况改编的。)
第一个网上参考脚本:
vim /etc/zabbix/zabbix_agentd.d/redis_status.sh
#!/bin/bash
REDISCLI="/usr/local/bin/redis-cli"
HOST="127.0.0.1"
PORT=6379
PASS="password"
if [[ $# == 1 ]];then
case $1 in
version)
result=$REDISCLI -h $HOST -a $PASS -p $PORT info server | grep -w "redis_version" | awk -F':' '{print $2}'
echo $result
;;
uptime)
result=$REDISCLI -h $HOST -a $PASS -p $PORT info server | grep -w "uptime_in_seconds" | awk -F':' '{print $2}'
echo $result
;;
connected_clients)
result=$REDISCLI -h $HOST -a $PASS -p $PORT info clients | grep -w "connected_clients" | awk -F':' '{print $2}'
echo $result
;;
blocked_clients)
result=$REDISCLI -h $HOST -a $PASS -p $PORT info clients | grep -w "blocked_clients" | awk -F':' '{print $2}'
echo $result
;;
used_memory)
result=$REDISCLI -h $HOST -a $PASS -p $PORT info memory | grep -w "used_memory" | awk -F':' '{print $2}'
echo $result
;;
used_memory_rss)
result=$REDISCLI -h $HOST -a $PASS -p $PORT info memory | grep -w "used_memory_rss" | awk -F':' '{print $2}'
echo $result
;;
used_memory_peak)
result=$REDISCLI -h $HOST -a $PASS -p $PORT info memory | grep -w "used_memory_peak" | awk -F':' '{print $2}'
echo $result
;;
used_memory_lua)
result=$REDISCLI -h $HOST -a $PASS -p $PORT info memory | grep -w "used_memory_lua" | awk -F':' '{print $2}'
echo $result
;;
used_cpu_sys)
result=$REDISCLI -h $HOST -a $PASS -p $PORT info cpu | grep -w "used_cpu_sys" | awk -F':' '{print $2}'
echo $result
;;
used_cpu_user)
result=$REDISCLI -h $HOST -a $PASS -p $PORT info cpu | grep -w "used_cpu_user" | awk -F':' '{print $2}'
echo $result
;;
used_cpu_sys_children)
result=$REDISCLI -h $HOST -a $PASS -p $PORT info cpu | grep -w "used_cpu_sys_children" | awk -F':' '{print $2}'
echo $result
;;
used_cpu_user_children)
result=$REDISCLI -h $HOST -a $PASS -p $PORT info cpu | grep -w "used_cpu_user_children" | awk -F':' '{print $2}'
echo $result
;;
rdb_last_bgsave_status)
result=$REDISCLI -h $HOST -a $PASS -p $PORT info Persistence | grep -w "rdb_last_bgsave_status" | awk -F':' '{print $2}' | grep -c ok
echo $result
;;
aof_last_bgrewrite_status)
result=$REDISCLI -h $HOST -a $PASS -p $PORT info Persistence | grep -w "aof_last_bgrewrite_status" | awk -F':' '{print $2}' | grep -c ok
echo $result
;;
aof_last_write_status)
result=$REDISCLI -h $HOST -a $PASS -p $PORT info Persistence | grep -w "aof_last_write_status" | awk -F':' '{print $2}' | grep -c ok
echo $result
;;
)
echo -e "\033[33mUsage: $0 {connected_clients|blocked_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 $2 in
keys)
result=$REDISCLI -h $HOST -a $PASS -p $PORT info | grep -w "$1" | grep -w "keys" | awk -F'=|,' '{print $2}'
echo $result
;;
expires)
result=$REDISCLI -h $HOST -a $PASS -p $PORT info | grep -w "$1" | grep -w "keys" | awk -F'=|,' '{print $4}'
echo $result
;;
avg_ttl)
result=$REDISCLI -h $HOST -a $PASS -p $PORT info | grep -w "$1" | grep -w "avg_ttl" | awk -F'=|,' '{print $6}'
echo $result
;;
)echo -e "\033[33mUsage: $0 {db0 keys|db0 expires|db0 avg_ttl}\033[0m"
;;
esac
fi
第二个根据自己系统环境改编的脚本:
vim /etc/zabbix/zabbix_agentd.d/redis_status.sh
#!/bin/bash
REDISCLI="/usr/bin/redis-cli"
HOST="127.0.0.1"
PORT=6379
if [[ $# == 1 ]];then
case $1 in
cluster_state)
result=$REDISCLI -h $HOST -p $PORT -c cluster info | grep -w "cluster_state" | awk -F':' '{print $2}'| grep -c ok
echo $result
;;
cluster_slots_assigned)
result=$REDISCLI -h $HOST -p $PORT -c cluster info | grep -w "cluster_slots_assigned" | awk -F':' '{print $2}'
echo $result
;;
cluster_slots_ok)
result=$REDISCLI -h $HOST -p $PORT -c cluster info | grep -w "cluster_slots_ok" | awk -F':' '{print $2}'
echo $result
;;
cluster_slots_pfail)
result=$REDISCLI -h $HOST -p $PORT -c cluster info | grep -w "cluster_slots_pfail" | awk -F':' '{print $2}'
echo $result
;;
cluster_slots_fail)
result=$REDISCLI -h $HOST -p $PORT -c cluster info | grep -w "cluster_slots_fail" | awk -F':' '{print $2}'
echo $result
;;
cluster_known_nodes)
result=$REDISCLI -h $HOST -p $PORT -c cluster info | grep -w "cluster_known_nodes" | awk -F':' '{print $2}'
echo $result
;;
cluster_size)
result=$REDISCLI -h $HOST -p $PORT -c cluster info | grep -w "cluster_size" | awk -F':' '{print $2}'
echo $result
;;
cluster_current_epoch)
result=$REDISCLI -h $HOST -p $PORT -c cluster info | grep -w "cluster_current_epoch" | awk -F':' '{print $2}'
echo $result
;;
cluster_my_epoch)
result=$REDISCLI -h $HOST -p $PORT -c cluster info | grep -w "cluster_my_epoch" | awk -F':' '{print $2}'
echo $result
;;
cluster_stats_messages_ping_sent)
result=$REDISCLI -h $HOST -p $PORT -c cluster info | grep -w "cluster_stats_messages_ping_sent" | awk -F':' '{print $2}'
echo $result
;;
cluster_stats_messages_pong_sent)
result=$REDISCLI -h $HOST -p $PORT -c cluster info | grep -w "cluster_stats_messages_pong_sent" | awk -F':' '{print $2}'
echo $result
;;
cluster_stats_messages_sent)
result=$REDISCLI -h $HOST -p $PORT -c cluster info | grep -w "cluster_stats_messages_sent" | awk -F':' '{print $2}'
echo $result
;;
cluster_stats_messages_ping_received)
result=$REDISCLI -h $HOST -p $PORT -c cluster info | grep -w "cluster_stats_messages_ping_received" | awk -F':' '{print $2}'
echo $result
;;
cluster_stats_messages_pong_received)
result=$REDISCLI -h $HOST -p $PORT -c cluster info | grep -w "cluster_stats_messages_pong_received" | awk -F':' '{print $2}'
echo $result
;;
cluster_stats_messages_received)
result=$REDISCLI -h $HOST -p $PORT -c cluster info | grep -w "cluster_stats_messages_received" | awk -F':' '{print $2}'
echo $result
;;
*)
echo -e "\033[33mUsage: $0 {cluster_state|cluster_slots_assigned|cluster_slots_ok|cluster_slots_pfail|cluster_slots_fail|cluster_known_nodes|cluster_size|cluster_current_epoch|cluster_known_nodes|cluster_size|cluster_current_epoch|cluster_my_epoch|cluster_stats_messages_ping_sent|cluster_stats_messages_pong_sent|cluster_stats_messages_sent|cluster_stats_messages_ping_received|cluster_stats_messages_pong_received|cluster_stats_messages_received}\033[0m"
;;
esac
fi
好接下来继续:
2、赋予脚本可执行权限
chmod +x /etc/zabbix/zabbix_agentd.d/redis_status.sh
3、脚本测试
查看redis的客户端连接数
/etc/zabbix/zabbix_agentd.d/redis_status.sh connected_clients
三、创建redis监控配置文件
1、编写redis监控配置文件
vim /etc/zabbix/zabbix_agentd.d/redis.conf UserParameter=Redis.status[*],/data/zabbix/scripts/redis_status.sh $1 UserParameter=Redisfile,redis-cli -h 127.0.0.1 -p 6379 -c cluster nodes | awk -F ',' '{print $2}' | grep -c 'fail'
2、重启zabbix-agent
ps -ef | grep zabbix_agentd
kill -9 进程
/data/zabbix/sbin/zabbix_agentd -c /data/zabbix/etc/zabbix_agentd.conf
或者:
systemctl restart zabbix-agent
3、在zabbix server端测试
zabbix_get -s 192.168.2.235 -p 10050 -k "Redis.Info[used_cpu_user]"
四、创建并导入监控模板
1、创建监控模板文件
redis-template.xml文件内容如下
<?xml version="1.0" encoding="UTF-8"?> <zabbix_export> <version>2.0</version> <date>2014-08-07T10:04:35Z</date> <groups> <group> <name>RedisMontior</name> </group> <group> <name>Templates</name> </group> </groups> <templates> <template> <template>RedisMontior</template> <name>RedisMontior</name> <groups> <group> <name>RedisMontior</name> </group> <group> <name>Templates</name> </group> </groups> <applications> <application> <name>Redis Clients</name> </application> <application> <name>Redis CPU</name> </application> <application> <name>Redis DbKey</name> </application> <application> <name>Redis Memory</name> </application> <application> <name>Redis WriteStatus</name> </application> </applications> <items> <item> <name>Redis.Info[aof_last_bgrewrite_status]</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Info[aof_last_bgrewrite_status]</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Redis WriteStatus</name> </application> </applications> <valuemap/> </item> <item> <name>Redis.Info[aof_last_write_status]</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Info[aof_last_write_status]</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Redis WriteStatus</name> </application> </applications> <valuemap/> </item> <item> <name>Redis.Info[blocked_clients]</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Info[blocked_clients]</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Redis Clients</name> </application> </applications> <valuemap/> </item> <item> <name>Redis.Info[connected_clients]</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Info[connected_clients]</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Redis Clients</name> </application> </applications> <valuemap/> </item> <item> <name>Redis.Info[db0,avg_ttl]</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Info[db0,avg_ttl]</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Redis DbKey</name> </application> </applications> <valuemap/> </item> <item> <name>Redis.Info[db0,expires]</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Info[db0,expires]</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Redis DbKey</name> </application> </applications> <valuemap/> </item> <item> <name>Redis.Info[db0,keys]</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Info[db0,keys]</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Redis DbKey</name> </application> </applications> <valuemap/> </item> <item> <name>Redis.Info[rdb_last_bgsave_status]</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Info[rdb_last_bgsave_status]</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Redis WriteStatus</name> </application> </applications> <valuemap/> </item> <item> <name>Redis.Info[uptime]</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Info[uptime]</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units>uptime</units> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications/> <valuemap/> </item> <item> <name>Redis.Info[used_cpu_sys]</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Info[used_cpu_sys]</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>0</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Redis CPU</name> </application> </applications> <valuemap/> </item> <item> <name>Redis.Info[used_cpu_sys_children]</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Info[used_cpu_sys_children]</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>0</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Redis CPU</name> </application> </applications> <valuemap/> </item> <item> <name>Redis.Info[used_cpu_user]</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Info[used_cpu_user]</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>0</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Redis CPU</name> </application> </applications> <valuemap/> </item> <item> <name>Redis.Info[used_cpu_user_children]</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Info[used_cpu_user_children]</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>0</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Redis CPU</name> </application> </applications> <valuemap/> </item> <item> <name>Redis.Info[used_memory]</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Info[used_memory]</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Redis Memory</name> </application> </applications> <valuemap/> </item> <item> <name>Redis.Info[used_memory_lua]</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Info[used_memory_lua]</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Redis Memory</name> </application> </applications> <valuemap/> </item> <item> <name>Redis.Info[used_memory_peak]</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Info[used_memory_peak]</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Redis Memory</name> </application> </applications> <valuemap/> </item> <item> <name>Redis.Info[used_memory_rss]</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Info[used_memory_rss]</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Redis Memory</name> </application> </applications> <valuemap/> </item> <item> <name>Redis.Info[version]</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Info[version]</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>1</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications/> <valuemap/> </item> <item> <name>Redis Status</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>Redis.Status</key> <delay>30</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications/> <valuemap/> </item> </items> <discovery_rules/> <macros/> <templates/> <screens/> </template> </templates> <triggers> <trigger> <expression>{RedisMontior:Redis.Status.last(0)}=0</expression> <name>Redis is down</name> <url/> <status>0</status> <priority>5</priority> <description/> <type>0</type> <dependencies/> </trigger> </triggers> <graphs> <graph> <name>Redis Client</name> <width>900</width> <height>200</height> <yaxismin>0.0000</yaxismin> <yaxismax>100.0000</yaxismax> <show_work_period>1</show_work_period> <show_triggers>1</show_triggers> <type>0</type> <show_legend>1</show_legend> <show_3d>0</show_3d> <percent_left>0.0000</percent_left> <percent_right>0.0000</percent_right> <ymin_type_1>0</ymin_type_1> <ymax_type_1>0</ymax_type_1> <ymin_item_1>0</ymin_item_1> <ymax_item_1>0</ymax_item_1> <graph_items> <graph_item> <sortorder>0</sortorder> <drawtype>0</drawtype> <color>C80000</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>RedisMontior</host> <key>Redis.Info[blocked_clients]</key> </item> </graph_item> <graph_item> <sortorder>1</sortorder> <drawtype>0</drawtype> <color>00C800</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>RedisMontior</host> <key>Redis.Info[connected_clients]</key> </item> </graph_item> </graph_items> </graph> <graph> <name>Redis CPU</name> <width>900</width> <height>200</height> <yaxismin>0.0000</yaxismin> <yaxismax>100.0000</yaxismax> <show_work_period>1</show_work_period> <show_triggers>1</show_triggers> <type>0</type> <show_legend>1</show_legend> <show_3d>0</show_3d> <percent_left>0.0000</percent_left> <percent_right>0.0000</percent_right> <ymin_type_1>0</ymin_type_1> <ymax_type_1>0</ymax_type_1> <ymin_item_1>0</ymin_item_1> <ymax_item_1>0</ymax_item_1> <graph_items> <graph_item> <sortorder>0</sortorder> <drawtype>2</drawtype> <color>C80000</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>RedisMontior</host> <key>Redis.Info[used_cpu_sys]</key> </item> </graph_item> <graph_item> <sortorder>1</sortorder> <drawtype>2</drawtype> <color>00C800</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>RedisMontior</host> <key>Redis.Info[used_cpu_user]</key> </item> </graph_item> <graph_item> <sortorder>2</sortorder> <drawtype>2</drawtype> <color>0000C8</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>RedisMontior</host> <key>Redis.Info[used_cpu_sys_children]</key> </item> </graph_item> <graph_item> <sortorder>3</sortorder> <drawtype>2</drawtype> <color>C800C8</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>RedisMontior</host> <key>Redis.Info[used_cpu_user_children]</key> </item> </graph_item> </graph_items> </graph> <graph> <name>Redis DbKeys</name> <width>900</width> <height>200</height> <yaxismin>0.0000</yaxismin> <yaxismax>100.0000</yaxismax> <show_work_period>1</show_work_period> <show_triggers>1</show_triggers> <type>0</type> <show_legend>1</show_legend> <show_3d>0</show_3d> <percent_left>0.0000</percent_left> <percent_right>0.0000</percent_right> <ymin_type_1>0</ymin_type_1> <ymax_type_1>0</ymax_type_1> <ymin_item_1>0</ymin_item_1> <ymax_item_1>0</ymax_item_1> <graph_items> <graph_item> <sortorder>0</sortorder> <drawtype>2</drawtype> <color>C80000</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>RedisMontior</host> <key>Redis.Info[db0,avg_ttl]</key> </item> </graph_item> <graph_item> <sortorder>1</sortorder> <drawtype>2</drawtype> <color>00C800</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>RedisMontior</host> <key>Redis.Info[db0,expires]</key> </item> </graph_item> <graph_item> <sortorder>2</sortorder> <drawtype>2</drawtype> <color>0000C8</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>RedisMontior</host> <key>Redis.Info[db0,keys]</key> </item> </graph_item> </graph_items> </graph> <graph> <name>Redis Memory</name> <width>900</width> <height>200</height> <yaxismin>0.0000</yaxismin> <yaxismax>100.0000</yaxismax> <show_work_period>1</show_work_period> <show_triggers>1</show_triggers> <type>0</type> <show_legend>1</show_legend> <show_3d>0</show_3d> <percent_left>0.0000</percent_left> <percent_right>0.0000</percent_right> <ymin_type_1>0</ymin_type_1> <ymax_type_1>0</ymax_type_1> <ymin_item_1>0</ymin_item_1> <ymax_item_1>0</ymax_item_1> <graph_items> <graph_item> <sortorder>0</sortorder> <drawtype>2</drawtype> <color>C80000</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>RedisMontior</host> <key>Redis.Info[used_memory]</key> </item> </graph_item> <graph_item> <sortorder>1</sortorder> <drawtype>2</drawtype> <color>00C800</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>RedisMontior</host> <key>Redis.Info[used_memory_lua]</key> </item> </graph_item> <graph_item> <sortorder>2</sortorder> <drawtype>2</drawtype> <color>0000C8</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>RedisMontior</host> <key>Redis.Info[used_memory_peak]</key> </item> </graph_item> <graph_item> <sortorder>3</sortorder> <drawtype>2</drawtype> <color>C800C8</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>RedisMontior</host> <key>Redis.Info[used_memory_rss]</key> </item> </graph_item> </graph_items> </graph> <graph> <name>Redis WriteStatus</name> <width>900</width> <height>200</height> <yaxismin>0.0000</yaxismin> <yaxismax>100.0000</yaxismax> <show_work_period>1</show_work_period> <show_triggers>1</show_triggers> <type>0</type> <show_legend>1</show_legend> <show_3d>0</show_3d> <percent_left>0.0000</percent_left> <percent_right>0.0000</percent_right> <ymin_type_1>0</ymin_type_1> <ymax_type_1>0</ymax_type_1> <ymin_item_1>0</ymin_item_1> <ymax_item_1>0</ymax_item_1> <graph_items> <graph_item> <sortorder>0</sortorder> <drawtype>2</drawtype> <color>C80000</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>RedisMontior</host> <key>Redis.Info[aof_last_bgrewrite_status]</key> </item> </graph_item> <graph_item> <sortorder>1</sortorder> <drawtype>2</drawtype> <color>0000C8</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>RedisMontior</host> <key>Redis.Info[rdb_last_bgsave_status]</key> </item> </graph_item> <graph_item> <sortorder>2</sortorder> <drawtype>2</drawtype> <color>00C800</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>RedisMontior</host> <key>Redis.Info[aof_last_write_status]</key> </item> </graph_item> </graph_items> </graph> </graphs> </zabbix_export>
模板下载地址:
https://pan.baidu.com/s/1Iqqr_ad1V_Vzt9H4DyDoeA
密码:m15h
2、导入监控模板
配置—模板—导入
点击“选择文件”,找到redis-template.xml文件,将其导入
五、给主机添加监控模板
六、监控效果图
脚本、模板下载地址:
https://pan.baidu.com/s/1UnS4e4FFv1rZW-ctdrdQHA
密码:1glw
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- Zookeeper集群 + Kafka集群 + KafkaOffsetMonitor 监控
- 监控多个Kubernetes集群
- 监控 Kubernetes 集群节点
- 监控系统 WGCLOUD,新增集群能力
- Prometheus Operator 监控 etcd 集群
- 基于 ZooKeeper 实现爬虫集群的监控
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
深度学习框架PyTorch:入门与实践
陈云 / 电子工业出版社 / 2018-1 / 65
《深度学习框架PyTorch:入门与实践》从多维数组Tensor开始,循序渐进地带领读者了解PyTorch各方面的基础知识。结合基础知识和前沿研究,带领读者从零开始完成几个经典有趣的深度学习小项目,包括GAN生成动漫头像、AI滤镜、AI写诗等。《深度学习框架PyTorch:入门与实践》没有简单机械地介绍各个函数接口的使用,而是尝试分门别类、循序渐进地向读者介绍PyTorch的知识,希望读者对PyT......一起来看看 《深度学习框架PyTorch:入门与实践》 这本书的介绍吧!