redis monitoring metrics

Redis Survival Monitoring

<b>

  • Redis Survival Monitoring (redis_alive): Redis local monitoring agent uses ping. If the specified time returns PONG to indicate survival, otherwise redis cannot respond to the request and may block or die. When the return value is not 1, redis hangs up and alarms
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 ping | grep -c PONG
1

<b>

  • Number of connections (connected_clients): The number of client connections. If the number of connections is too high, it will affect the redis throughput. Alarm when >5000
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w "connected_clients" | awk -F":" '{print $2}'
1
  • Connection usage rate (connected_clients_pct): The percentage of connection usage, calculated by (connected_clients/maxclients); if it reaches 1, redis starts to refuse the creation of new connections and alarms

<b>

  • Rejected connections (rejected_connections): The number of redis connections reaches the maxclients limit, and the number of new connections rejected. alert
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w rejected_connections
rejected_connections:0
  • Number of newly created connections (total_connections_received): If there are too many newly created connections, excessive creation and destruction of connections will have an impact on performance, indicating that short connections are serious or there is a problem with connection pool usage, and an alarm will be issued.
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w total_connections_received
total_connections_received:217

<b>

  • The number of blocked connections for list blocking calls (blocked_clients): If the monitoring data is greater than 0, an alarm
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w blocked_clients
blocked_clients:0

<b>

  • The memory size allocated by redis (used_memory): the real memory used by redis, excluding memory fragmentation
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w used_memory
used_memory:2513656

<b>

  • Redis process used memory size (used_memory_rss): The physical memory size actually used by the process, including memory fragmentation; if the rss is too large, the internal fragmentation will be large, memory resources will be wasted, and the fork time and cow memory will increase.
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w used_memory_rss
used_memory_rss:9728000

<b>

  • Redis memory fragmentation ratio (mem_fragmentation_ratio): Indicates (used_memory_rss/used_memory). If the fragmentation ratio is too large, memory resources are wasted, and no alarm is set. If it is less than 1, it means that redis has used the swap partition, and an alarm is issued.
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w mem_fragmentation_ratio
mem_fragmentation_ratio:3.89

<b>

  • Number of keys (keys): The number of keys contained in the redis instance. If the number of single-instance keys is too large, it may lead to untimely recycling of expired keys.
[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>

  • The number of commands processed by redis (total_commands_processed): monitor the average qps in the collection period
./redis-cli -c -p 7000 info | grep -w total_commands_processed| awk -F':' '{print $2}'

<b>

  • The current qps of redis (instantaneous_ops_per_sec): the number of commands executed per second in real-time within redis
./redis-cli -c -p 7000 info | grep -w instantaneous_ops_per_sec | awk -F':' '{print $2}'

<b>

  • Request key hits (keyspace_hits): The number of times the redis request key was hit
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w keyspace_hits | awk -F':' '{print $2}'
354

<b>

  • The number of times the request key was not hit (keyspace_misses): the number of times the redis request key was not hit
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w keyspace_misses
keyspace_misses:122

<b>

  • The hit ratio of the requested key (keyspace_hit_ratio): Calculated using keyspace_hits/(keyspace_hits+keyspace_misses), if the hit ratio is lower than 50%, an alarm

<b>

  • The number of microseconds in the last fork blocking (latest_fork_usec): The time spent in the last fork operation blocking the redis process, in microseconds.
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w latest_fork_usec
latest_fork_usec:315

 

Redis cluster monitoring

<b>

  • Whether the instance enables cluster mode (cluster_enabled): Monitor whether cluster mode is enabled through cluster_enabled of info. If not equal to 1, alarm
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 info | grep -w cluster_enabled
cluster_enabled:1

<b>

  • Cluster health state (clusster_state): alarm if cluster_state is not OK
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 cluster info
cluster_state:ok

<b>

  • Cluster data slot allocation (cluster_slots_assigned): When the cluster is running normally, the default is 16384 slots

If it is not equal to 16384, it will alarm

[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 cluster info | grep -w cluster_slots_ok
cluster_slots_ok:16384

<b>

  • Detect the number of offline data slots (cluster_slots_fail): When the cluster is running normally, it should be 0. If it is greater than 0, it means that the cluster has a slot failure.
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 cluster info | grep -w cluster_slots_fail
cluster_slots_fail:0

<b>

  • The number of nodes in the cluster (cluster_known_nodes): the number of redis nodes in the cluster
[root@tzgdevapp10 bin]# ./redis-cli -c -p 7000 cluster info | grep -w cluster_known_nodes
cluster_known_nodes:6


Author: Pima Jiqin
Link : https://www.jianshu.com/p/68485d5c7fb9
Source: Jianshu The
copyright belongs to the author. For commercial reprints, please contact the author for authorization, and for non-commercial reprints, please indicate the source.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326034497&siteId=291194637