A simple monitoring of the number of Redis db keys, the script is as follows:
#!/bin/bashport= ' 7010 ' host= ' 192.168.33.33 ' echo ' redis-cli-h ${host}-P ${port} <<eofselect 1llen data1eof ' >/ Usr/local/redis/script/redix.txt echo ' awk ' {print $/usr/local/redis/script/redix.txt ' exit 0 |
The implementation of the script is simple, the custom terminator, from the redis corresponding to the DB to obtain data, directed to the Redis.txt file. Use awk to remove the value of the Redis key corresponding to the Zabbix_agent configuration: Format: userparameter=key[*],commandunsafeuserparameters=0 = Unsafeuserparameters=1 and remove the previous comment userparameter=redis.7010.data1.count,/usr/local/redis/script/ Redis.sh Description: Redis.7010.data1.count-----The key value to be used to add monitoring information to the Zabbix server, as described below. Format: Redis.7010.data_center.count (example: redis.7010.data_center.count)/usr/local/redis/script/redis.sh-----Absolute Path to the monitoring script Zabbix_server Web configuration: 1. Create a template:
2. Create items:3. Create trigger Condition triggers:4, is over!
Zabbix total number of redis DB keys monitored