APC Plugin For Munin
If you're like me, you want to monitor and graph every little piece of your server. Until recently, I've been relying on a simple PHP script to display APC statistics. Although the tool worked well, I wanted to integrate the statistics into Munin, as most all other server properties and system services are monitoring with it. The problem was that finding a suitable APC plugin for Munin proved to be very difficult. Fortunately I stumbled across this German gem (Vielen Dank, dass Sie meine deutsche Freundin!) that met my needs. To set this up on your system, just follow the directions below:
First, let's set up the apcinfo.php file in the document root of your web server and retrieve the file from a private gist:
Now, make the file executable:
The script itself is very simple. It simply ouputs the total cache memory, memory available and memory used:
To confirm that the script is working, check out /apcinfo.php on your site. You should see something like the following:
size: 31457200.00 used: 19478104.00 free: 11979096.00
Now, let's set up the Munin plugin that will use that information:
What that does is create the apc plugin, makes it executable and then symlinks it to the proper directory. Now, we'll need to make sure Munin loads the new plugin. To do this, we'll edit the /etc/munin/plugin-conf.d/munin-node
to add the following:
Obviously, you'll want to replace example.com with the host you intend to use. Once the file has been updated and saved, restart Munin:
Once the node is running, it'll take a few minutes for Munin to update so don't worry if you don't see any new graphs right away. One thing to keep in mind is that you will need the LWP::UserAgent Perl module. If you are on a Debian/Ubuntu OS, just run the following to install it:
Now, go check your pretty graphs.