Funky world of Juha

Bizarre and funky world of Juha

Installing Memcached graphs to munin July 15, 2011

Filed under: Memcached,Servers — juhq @ 3:01 pm

Munin is a great statistics tool that every developer and website owner should know and user.

Today I was adding statistics for memcached, for every plugin that I could find from Munin Exchange and it didn’t take too long to realize that typing all the commands by hand, to 8 different servers, is going to take for ever.

So I copied all the steps into my notepad (oldskool) and combined the steps into easily copy & pasted steps.

Before you can install these plugins, you need to have perl-Cache-Memcached installed on the server.

As I’m using CentOS, the command is yum install perl-Cache-Memcached

Now for the interesting part of installing every memcached plugin to munin easily.

wget && mv download memcached_hits && cp memcached_hits /usr/share/munin/plugins/ && chmod 777 /usr/share/munin/plugins/memcached_hits && ln -s /usr/share/munin/plugins/memcached_hits /etc/munin/plugins/memcached_hits_127_0_0_1_11211 && ls -al /etc/munin/plugins && /usr/sbin/munin-run memcached_hits_127_0_0_1_11211
wget && mv download memcached_bytes && cp memcached_bytes /usr/share/munin/plugins/ && chmod 777 /usr/share/munin/plugins/memcached_bytes && ln -s /usr/share/munin/plugins/memcached_bytes /etc/munin/plugins/memcached_bytes_127_0_0_1_11211 && ls -al /etc/munin/plugins && /usr/sbin/munin-run memcached_bytes_127_0_0_1_11211
wget && mv download memcached_requests && cp memcached_requests /usr/share/munin/plugins/ && chmod 777 /usr/share/munin/plugins/memcached_requests && ln -s /usr/share/munin/plugins/memcached_requests /etc/munin/plugins/memcached_requests_127_0_0_1_11211 && ls -al /etc/munin/plugins && /usr/sbin/munin-run memcached_requests_127_0_0_1_11211
wget && mv download memcached_traffic && cp memcached_traffic /usr/share/munin/plugins/ && chmod 777 /usr/share/munin/plugins/memcached_traffic && ln -s /usr/share/munin/plugins/memcached_traffic /etc/munin/plugins/memcached_traffic_127_0_0_1_11211 && ls -al /etc/munin/plugins && /usr/sbin/munin-run memcached_traffic_127_0_0_1_11211
wget && mv download memcached_items && cp memcached_items /usr/share/munin/plugins/ && chmod 777 /usr/share/munin/plugins/memcached_items && ln -s /usr/share/munin/plugins/memcached_items /etc/munin/plugins/memcached_items_127_0_0_1_11211 && ls -al /etc/munin/plugins && /usr/sbin/munin-run memcached_items_127_0_0_1_11211
wget && mv download memcached_connections && cp memcached_connections /usr/share/munin/plugins/ && chmod 777 /usr/share/munin/plugins/memcached_connections && ln -s /usr/share/munin/plugins/memcached_connections /etc/munin/plugins/memcached_connections_127_0_0_1_11211 && ls -al /etc/munin/plugins && /usr/sbin/munin-run memcached_connections_127_0_0_1_11211

/etc/init.d/munin-node restart

What this will do is that it’ll download the file, rename it, copy it to proper folders, add proper properties, create symbolic link, then list all the symbolic links, test that the plugin works and finally it will restart munin.



This should be easily converted into simpler and smaller shell script. If you’re thinking of creating a shell script or have a better solution, please feel free to leave a comment 🙂