How to monitor Memcached's instance by using Zabbix
- Import Memcached's template from this link to your Zabbix server
- Modify /etc/zabbix/zabbix_agentd.conf and add the following UserParameter (on the Memcached server)
UserParameter=memcached_stats[*],echo -e "stats\nquit" | nc 127.0.0.1 $1 | grep "STAT $2 " | awk '{print $$3}' - Restart Zabbix agentd service
- Link Mecached template to Memcached server
- Check the latest data (Application: memcached)
- 38 Items (default type is Zabbix Agent Active)
- 1 trigger
- 4 graphs
Note
- This template tries to monitor Memcached instance that running on port 11211
- If your Memcached instance is running in different port, you could simply replace 11211 with your port number before importing this template
- If you run more than one Memcached instances, you could simply copy this and modify port number.
10 comments:
Hi,
I had some problems with the template, I had to replace "Type" "Zabbix agent (active) " by "Zabbix agent" on all elements,
and I also added "unit" Bytes to the elements "CS_Memcached_11211:limit maxbytes","CS_Memcached_11211:bytes_written","CS_Memcached_11211:bytes_read".
But otherwise this tutorial is great, thank you very much!
Thank you for your feedback. I'll recheck the template as your suggestion.
Thanks a lot for your job! Works perfect for me ! Easy, simple and well explained.
I had to replace "Type" "Zabbix agent (active) " by "Zabbix agent" on all elements, to add "unit" Bytes to the elements limit_maxbytes,bytes_written, bytes_read and unit "uptime" to time.
Cool!
I've only have a problem with the type of the items in our template, i've update all items to agent type, WHITOUT ACTIVE.
Thank you so much, this is a big job!
Interesting note: debian/ubuntu has more than one variation of netcat, the official one and another one with modifications from openbsd (packages netcat-traditional and netcat-openbsd).
The openbsd version doesn't seem to work for me, it ignores the piped-in stdin. So instead of running "nc" to get the stats i use "nc.traditional".
Just a minor detail to have in mind if it should be working but isn't
Hi!
Thank you!
Just one tip
Unless UnsafeUserParameters agent daemon configuration option is enabled, it is not allowed to pass flexible parameters containing these symbols: \ ' ” ` * ? [ ] { } ~ $ ! & ; ( ) < > | # @
;)
Thanks for this great template, i used ubuntu & had to change the command to:
UserParameter=memcached_stats[*],(echo stats; sleep 0.1) | telnet 127.0.0.1 $1 2>&1 | awk '/STAT $2/ {print $NF}'
with nc i coudn't make it work not even with other nc types. so telnet worked just fine !
better adding space after the $2
UserParameter=memcached_stats[*],(echo stats; sleep 0.1) | telnet 127.0.0.1 $1 2>&1 | awk '/STAT $2 / {print $NF}'
Post a Comment