Ubuntu – Apache graphs and data not updating in Munin on Ubuntu 14.04

apache-2.4muninUbuntuubuntu-14.04

So I am rebuilding a server from Ubuntu 12.04 to Ubuntu 14.04; not doing the upgrade path because I would rather build from scratch in this case. I have installed Munin as I have done before in Ubuntu 12.04 like this:

sudo aptitude install munin munin-node

Then I enabled the Apache modules for Munin like this:

sudo ln -s /usr/share/munin/plugins/apache_accesses /etc/munin/plugins/apache_accesses
sudo ln -s /usr/share/munin/plugins/apache_processes /etc/munin/plugins/apache_processes
sudo ln -s /usr/share/munin/plugins/apache_volume /etc/munin/plugins/apache_volume

Then I restarted the Munin node like this:

sudo service munin-node restart

And waited the requisite 5-10 minutes to get data and related graphs generated. And happily the graphs showed up! But unhappily, all the values were -nan, meaning somehow the data was not being processed by Munin; see screenshot below:

Munin Apache graphs without data.

Usually this means Munin is having problems reaching the localhost’s Apache service-status page, but checking that URL on the system with Lynx shows everything works fine:

lynx http://localhost/server-status

So I am stumped as to what might have happened. Did a full system restart and 100% no improvement. What could be happening?

Apache service status page viewable via Lynx.

Best Answer

I solved this! Getting frustrated as heck about this issue, I ran a Munin module suggest command like this:

sudo munin-node-configure --suggest

In the piles of output here are the relevant Apache related lines:

apache_accesses            | yes  | no [LWP::UserAgent not found]          
apache_processes           | yes  | no [LWP::UserAgent not found]          
apache_volume              | yes  | no [LWP::UserAgent not found] 

So the modules are active, but that [LWP::UserAgent not found]? What’s up with that? Did some Googling and found this article that explains it:

It's not the most helpful suggestion you're likely to come across, granted, but with a little research it might make more sense. Fortunately we can skip the research in this case and get right down to what it means: Munin is actually a collection of scripts written in a language called Perl, and "LWP::UserAgent" is a Perl library. So the fact that LWP::UserAgent wasn't found means that particular Perl library isn't installed on our example slice.

Since Munin is a bunch of Perl scripts, that LWP error was connected to libwww-perl which is basically the “The World-Wide Web library for Perl.” So Munin was failing because it had no client library installed to connect to the Apache server status page. I was able to solve that issue by just installing libwww-perl like this:

sudo aptitude install libwww-perl

With that done, I ran that Munin module suggest command again and all looks good with no LWP related errors:

apache_accesses            | yes  | yes                                    
apache_processes           | yes  | yes                                    
apache_volume              | yes  | yes                                    

So I just waited another 5-10 minutes and et voilà! Munin can now read the Apache server status data and the graphs are now properly updated and working as expected:

Munin Apache graphs without data.

Related Topic