redis监控指标 - 简书
- -Redis Server数据采集. 二、Redis Server监控数据采集. redis存活监控 (redis_alive):redis本地监控agent使用ping,如果指定时间返回PONG表示存活,否则redis不能响应请求,可能阻塞或死亡. 当返回值不为1时,redis挂了,告警. 连接个数 (connected_clients):客户端连接个数,如果连接数过高,影响redis吞吐量.
<b>
<b>
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 ping | grep -c PONG
1
<b>
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w "connected_clients" | awk -F":" '{print $2}'
1
<b>
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w rejected_connections
rejected_connections:0
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w total_connections_received
total_connections_received:217
<b>
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w blocked_clients
blocked_clients:0
<b>
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w used_memory
used_memory:2513656
<b>
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w used_memory_rss
used_memory_rss:9728000
<b>
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w mem_fragmentation_ratio
mem_fragmentation_ratio:3.89
<b>
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w keys | awk -F':' '{print $2}' | awk -F',' '{print $1}' | awk -F'=' '{print $2}'
43
<b>
./redis-cli -c -p 7000 info | grep -w total_commands_processed| awk -F':' '{print $2}'
<b>
./redis-cli -c -p 7000 info | grep -w instantaneous_ops_per_sec | awk -F':' '{print $2}'
<b>
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w keyspace_hits | awk -F':' '{print $2}'
354
<b>
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w keyspace_misses
keyspace_misses:122
<b>
<b>
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w latest_fork_usec
latest_fork_usec:315
<b>
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w cluster_enabled
cluster_enabled:1
<b>
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 cluster info
cluster_state:ok
<b>
不等于16384则告警
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 cluster info | grep -w cluster_slots_ok
cluster_slots_ok:16384
<b>
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 cluster info | grep -w cluster_slots_fail
cluster_slots_fail:0
<b>
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 cluster info | grep -w cluster_known_nodes
cluster_known_nodes:6