Skip to content

Instantly share code, notes, and snippets.

@viegelinsch
Last active February 18, 2024 09:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viegelinsch/49c404b1b99a462bad4f to your computer and use it in GitHub Desktop.
Save viegelinsch/49c404b1b99a462bad4f to your computer and use it in GitHub Desktop.
fix no graphic in munin dynazoom

You have something like "[WARNING] Could not draw graph "/var/lib/munin/cgi-tmp/munin-cgi-graph/" in your /var/log/munin/munin-cgi-graph.log ???

Check the directory permissions!

ls -l /var/lib/munin/cgi-tmp/

shows something like

drwxr-xr-x 3 munin www-data 4,0K Mär 29  2013 munin-cgi-graph/

means the web server (group) has no write to this directory but graphs are rendered by cgi by the web server. So give the web server sufficient rights.
Do

chmod g+w /var/lib/munin/cgi-tmp/munin-cgi-graph/
ls -l /var/lib/munin/cgi-tmp/

now it should look like

drwxrwxr-x 3 munin www-data 4,0K Mär 29  2013 munin-cgi-graph/

et voilá!
Graphs are drawn like a charm.

@Baroti
Copy link

Baroti commented Jan 22, 2020

In my opinion, in the case of munin graphs being built on the fly (aka on web access only, with the "graph_strategy cgi" in munin.conf), the folder containing the generated web content should be own only by the Apache web user only (user: www-data, group www-data in Ubuntu 18.04), so permissions on /var/lib/munin/cgi-tmp/munin-cgi-graph/ would be more like 755, allowing the PNG file generation and other required sub-directories:
ls -lad /var/lib/munin/cgi-tmp/munin-cgi-graph/
drwxr-xr-x 5 www-data www-data 4096 Jan 22 14:33 /var/lib/munin/cgi-tmp/munin-cgi-graph/
We need to keep in mind that Apache web user and munin system user have different roles on a server, and they working directories should have strict, exclusive permissions in a well done setup: one does the web serving of web files (and generates temporary PNG files via CGI scripts, reads from RRD database files), and the other system user connects to your servers on the network, collects stats, builds /writes the RRD historical files, even does some alerting :-)
find /var/lib/munin/cgi-tmp/ -type d -exec chmod 755 -v '{}' \;
chown -Rv www-data:www-data /var/lib/munin/cgi-tmp/munin-cgi-graph/

@iamtalhaasghar
Copy link

Thanks man for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment