Munin: Dynazoom not working (suEXEC)

Yesterday I was introducing the Munin Server Monitoring tool for Linux. Read the posts here. Running the tool is easy and straightforward. However there is one feature, that is causes problems: the Dynazoom. Clicking at a graphic to enlarge it brings a script to front that is called Dynazoom. This script allows to zoom inside the selected monitoring screen and displays a distinct range of time. That sounds very useful and it is very useful indeed.

Unfortunately there are different problems regarding this feature. The zoomed images are rendered by demand. To do this the front end is calling a Perl script, located at /usr/lib/munin/cgi/munin-cgi-graph. If there is no image shown but rather an error symbol, you can open a more specific error message by opening the image directly (right-click) or use a developer tool of your choice inspecting the network traffic and requests.

By default Munin adds a scriptalias to its own apache.conf to make the rendering script available. The problem is the permission this script runs with – called from the request. In most cases you can fix the permission issue editing the the apache.conf file for the munin-cgi-graph alias. According to your server configuration this is all you have to do.

Workaround – Dynazoom with suEXEC

If you are using a server configuration with suEXEC it is a bit more complicated. suEXEC locks the script to a defined document root . All scripts outside this directory cannot be executed. You will get a 500 Internal Server Error and the log will contain

The easiest option is to turn off suEXEC but it is not the best idea.

It is possible to change the directory compiling suEXEC by yourself or by using suEXEC custom. However, if you are using a server management tool like Froxlor it is not possible to change the default directory to another without destroying the server infrastructure. To solve this problem, you have to copy the Perl script from Munin into your suEXEC root directory. In order to find out what directory is your root execute suexec -V in your shell (DOC_ROOT line). Furthermore you have to adjust the Apache config to run per scripts in the subdirectory where the scripts are located now.

You also need a .htaccess file using mod_rewrite inside your script directory. Because the scripts are called without a file extension you have to rewrite the address.

Calling the script now should execute the script but also returns some errors regarding permission violation from the Perl script.  Depending on your server and Apache configuration you now have to spread correct directory and file permissions for the script. You have to set the group from the Munin directories to the SuexecUserGroup from where the Munin script will be called. Under certain circumstances you also have to adjust the permissions to give writing access to the script.

The script should now be running and generate the requested graphs.

Problems, ideas or further advices? Leave a comment or contact me :)