This is expected behaviour since Virtualmin asks you to define a root password for your MySQL server (so it isn’t left unsecured out in the open). Unfortunately, by default, Munin tries to read MySQL data using the root account and no password and fails.
But there’s an easy way to fix this:
Enter your Virtualmin administration interface and navigate to Webmin > Servers > MySQL Database Server. Create a new user munin with a safe password (remember it, you’ll need it later), set it to only log in from localhost and add the Superuser permission.
Then navigate to Database Permissions and add the previously created munin user on database mysql, again only for localhost and only grant the Select table data permission.
Moving on, open the /etc/munin/plugin-conf.d/munin-node file in your favourite editor and add (or edit if already exists):
If you’re using innodb tables, you will need to create the /etc/munin/plugin-conf.d/mysql_innodb file and this in it to ignore error about it (which Munin will most likely generate):
Now it’s time to test if the plugin works. Run in the console:
munin-node-configure --suggest | grep mysql
You should get something like
mysql_ | yes | yes (+bin_relay_log +commands and a lot of other blabber
If you’re missing any required Perl modules, you’ll see a | no | no and the needed modules’ names. Install them and then try again.
If all is well, it’s time to activate the plugin by running
ln -s /usr/share/munin/plugins/mysql_* /etc/munin/plugins
You can also obtain the shell commands to activate the plugin directly calling munin-node-configure with:
service munin-node restart
Then just wait 10-20 minutes for your graphs to show up.