redis延迟监控
脚本
[root@localhost scripts]# more get_latency_history.sh
#!/bin/bash
timeout 5 /usr/local/services/redis/bin/redis-cli -u redis://123@192.168.1.14:6379 --latency --raw
获取平均延迟字段
[root@localhost scripts]# ./get_latency_history.sh|awk '{print $3}'
0.13
[root@localhost scripts]#/usr/local/services/redis/bin/redis-cli -u redis://123@192.168.1.14:6379 --latency --raw
0 1 0.12 99
若不加--raw的话,该命令会一直执行,可以尝试在前面加上timeout命令 指定执行多久后退出
timeout 5 /usr/local/services/redis/bin/redis-cli -u redis://123@192.168.1.14:6379 --latency
timeout的目的是5秒后自动退出命令