Unix的WATCH命令是一个非常实用的工具,它可以实时监视任意命令的输出结果。比如上面我们提到的命令,稍加改造就能变成持续地实时监控工具:
- [root@vm redis-3.0.3]# watch -n 1 -d "src/redis-cli -h 127.0.0.1 info | grep -e "connected_clients" -e "blocked_clients" -e "used_memory_human" -e "used_memory_peak_human" -e "rejected_connections" -e "evicted_keys" -e "instantaneous""
- Every 1.0s: src/redis-cli -h 127.0.0.1 info | grep -e... Wed Aug 12 14:30:40 2015
- connected_clients:1
- blocked_clients:0
- used_memory_human:799.66K
- used_memory_peak_human:852.35K
- instantaneous_ops_per_sec:0
- instantaneous_input_kbps:0.01
- instantaneous_output_kbps:1.23
- rejected_connections:0
- evicted_keys:0
- [root@vm redis-3.0.3]# watch -n 1 -d "src/redis-cli -h 127.0.0.1 latency graph command"
- Every 1.0s: src/redis-cli -h 127.0.0.1 latency graph command Wed Aug 12 14:33:25 2015
- command - high 2000 ms, low 150 ms (all time high 2000 ms)
- --------------------------------------------------------------------------------
- #
- | #
- | |
- |_#|
- 4441
- 0006
- mmmm
本文作者:geelou
本文来自云栖社区合作伙伴rediscn,了解相关信息可以关注redis.cn网站。