How to install Munin monitoring on cPanel/WHM

Many people like to have some monitoring tool with lots of charts so they can track better how their server is performing. One of the best known tools for this is Munin: a free (open source) networked resource monitoring tool. Installation on WHM powered hosting is somewhat easy:

Munin

 

Step 1
First, login to WHM  🙂

Step 2
In the left sidebar go to cPanel -> Manage Plugins (or simply search for Manage Plugins like I did):
Munin-on-cPanel-WHM-1

Step 3
Tick a check-box next to Munin and press the save button below:
Munin-on-cPanel-WHM-2

Step 4
Wait some time until it it’s installed:
Munin-on-cPanel-WHM-3

Step 5
That’s about it! Munin is now installed and charts will be updated every five minutes. At this point you should simply wait some time until the charts are generated for the first time. If you try to access it by clicking Plugins -> Munin Service Monitor:
Munin-on-cPanel-WHM-4
You will probably get error like this:
Munin-on-cPanel-WHM-5

So this means you need to wait some more. Some people reported that they had to logout and login back to WHM before they can access the Munin after the installation so that might not be a bad idea.

After some time you should get  first charts (probably empty ones)
Munin-on-cPanel-WHM-6
Typically you’ll want to wait for 24 hours before giving a deeper look at these charts.

 

And now some geek stuff…

 

Munin not showing Apache
If you are running Apache on different port (typically if you’re having Varnish running on port 80 and Apache running on some other port) you’ll have to edit file on path:
/etc/munin/plugin-conf.d/cpanel.conf and add two following lines of code at the end of file:

[apache_*]
env.url   http://127.0.0.1:%d/whm-server-status?auto
env.ports 8080

Don’t forget to replace the Apache port with your port! After editing this config file you should restart Munin by executing this command: /etc/init.d/munin-node restart and again wait some time before Apache data starts to show.

 

Apache_process error in munin-node.log
I have noticed this error in my /var/log/munin/munin-node.log file:

Error output from apache_processes:
Use of qw(...) as parentheses is deprecated at /etc/munin/plugins/apache_processes line 164.

To fix this bug edit file located at /usr/local/cpanel/3rdparty/share/munin/plugins/apache_processes and locate line 164 – it should look like this:

foreach my $type qw "busy idle" {

And simply replace it with this:

foreach my $type (qw(busy idle)) {

After that simply restart Munin.

 

Monitor Varnish with Munin
To monitor Varnish with Munin simply first edit config file at /etc/munin/plugin-conf.d/cpanel.conf and add these two lines:

[varnish*]
user root

And then execute following commands:

cd /usr/local/cpanel/3rdparty/share/munin/plugins/
wget https://raw.githubusercontent.com/basiszwo/munin-varnish/master/varnish_allocated
wget https://raw.githubusercontent.com/basiszwo/munin-varnish/master/varnish_hitrate
wget https://raw.githubusercontent.com/basiszwo/munin-varnish/master/varnish_total_objects
wget https://raw.githubusercontent.com/basiszwo/munin-varnish/master/varnish_cachehitratio
wget https://raw.githubusercontent.com/basiszwo/munin-varnish/master/varnish_varnishstat_
chmod a+x varnish_*
ln -s varnish_* /etc/munin/plugins/
/etc/init.d/munin-node restart
RESTRICT_SYSLOG is disabled error at CSF
How to disable xmlrpc.php?

Comments

  1. Thanks for the great guidance its help out a lot. You made Munin quite easy to understand.

Leave a Reply

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.