Fix for Blank Graphs using Percona Cacti Monitoring Plugins with Redis and Memcached

I use Cacti to monitor my servers and recently had some trouble getting the percona graphs to work with memcached and redis on a remote debian server. The graphs were always blank. I’m going to provide a few fixes to ss_get_by_ssh.php in this post that I used to make it work.

Fixing Blank Memcached Graph

Open ss_get_by_ssh.php and go to line 1060 and find this code:

This is the command that returns your current memcached stats. This would not run on debian for me. If you are getting blank graphs, open a shell to your server and run this command to see if it’s returning valid data. In this example memcached is running on on port 11211.

If my case, (ubuntu/debian), it wasn’t and this is why the graphs are blank. I had to add the -e flag to echo

There is also a variable called $nc_cmd at the top of this file that specifies the netcat (nc) command to run, I found that I do not need the additional nc parameters so I changed it to

Here is my modified function, I replaced the old code with this (added the -e flag to echo).

You can use this command on your cacti server to test this now:

These scripts connect to the machine designated by IPADDRESS and return info for a memcached server listening on localhost. CACTIUSER is the user your cron jobs run under. Check out these links for more information:

Fixing Blank Redis Graph

Go to line 1243 of ss_get_by_ssh.php and completely delete the function redis_get(). You must do this because in this script this is known as the $getting_func (see line 256) and takes precendence over the $cmdline_func which is this case is redis_cmdline (see line 1217). In my installation redis doesn’t respond at all when using netcat. I replaced netcat with a call to redis-cli which is the built in cli tool for redis.

Replace the existing redis_cmdline at line 127 with this much simpler function:

This will simply called redis-cli on the remote machine and return the info. If you require more custom options, you should be able to customize this method.

Here is a simple way to test that it is working:

Hope this helps.

, ,

Leave a Reply

Your email address will not be published. Required fields are marked *