I have many memcached servers around. So, I needed a tool to check status information on these servers like top utility. I decided to write it in bash scripting language (100% in bash except printf,date and sleep commands :) ). You can simply enhance the script for example getting server names and ports from a config file or display interval parameter from command line. Memcached supports tcp and udp protocols for communication with clients. I used tcp communication in my bash script. Here is information about
Memcached's supported server commands. My example script uses "stats" command. Here is sample output for "stats" command from one memcached server.
I have used the information provided by "stats" command. Script uses pure bash builtin commands to access a tcp server like memcached.
You can download the script from
here.
Here is sample output from the script.
If you're using Ubuntu, probably you will not be able to run this script, because bash is not compiled with "--enable-net-redirections" parameter on Ubuntu systems. RedHat based distributions has no problem with bash net-directions like Fedora,Centos and RedHat ES.
2 comments:
Good idea to write scripts for all memcached installed servers.
nice article.
George Michael.
Post a Comment