First, create Memcached-tool script
See http://www.linuxidc.com/Linux/2014-08/105157.htm
Mkdir/scripts && cd/scripts && vim memcache-tool.pl
Put script copy into Memcache-tool.plchmod +x/scripts/memcache-tool.pl
Second, use the script to view the various statistics of memcache
/scripts/memcache-tool.pl 127.0.0.1:11211 stats#127.0.0.1:11211 field Value accepting_conns 1 auth_cmds 0 auth_errors 0 bytes 0 bytes_read 94 bytes_written 5261 cas_badval 0 cas_hits 0 cas_ misses 0 cmd_flush 0 cmd_get 0 cmd_set 0 cmd_touch 0 conn_yields 0 connection_structures 11 curr_connections 10 curr_items 0 decr_hits 0 decr_misses 0 delete_hits 0 delete_misses 0 evicted_unfetched 0 evictions 0 expired_unfetched 0 get_hits 0 get_misses 0 hash_bytes 524288 hash_is_expanding 0 hash_ power_level 16 incr_hits 0 incr_misses 0 libevent 2.0.21 -stable limit_maxbytes 134217728 listen_disabled_num 0 pid 10459 pointer_size 64 reclaimed 0 reserved_fds 20 Rusage_system 0.121024 rusage_user 0.045384 threads 4 time 1426727521 total_ connections 18 total_items 0 touch_hits 0 touch_misses 0 uptime 2574 version 1.4.15
Iii. customizing Userparameter in zabbix_agent.conf
Modify the following parameters:
unsafeuserparameters=1userparameter=memcachestats[*],/scripts/memcache-tool.pl 127.0.0.1:11211 stats|grep |awk ' {Print $NF} '
Then restart the zabbix_agent process
Iv. Adding item in Zabbix
For example, add the current "Curr_connections"
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5B/76/wKioL1UJxG2y5QoLAADMQH1Z48A053.jpg "title=" T.jpg " alt= "Wkiol1ujxg2y5qolaadmqh1z48a053.jpg"/>
Save it.
* If the error "not supported by Zabbix Agent" appears,
Get detailed information using the following command:
Zabbix_agent-t Memcachestats[curr_connections]]
or modify the zabbix_server.conf in the
Timeout=3 #将这个值调整的大一点
This article is from the "Margin with Wish" blog, please be sure to keep this source http://281816327.blog.51cto.com/907015/1622063
Zabbix Monitoring Memcache Example