Munin is kind of inefficient and on my P4 2Ghz, it running every 5 minutes is too often, and the munin processes keep dying because locks already exist. You can’t increase the munin-cron script to 10 minute intervals, because then rrdtool will generate gaps.
The munin-cron script is nothing but a wrapper for munin-graph, munin-html and munin-update. I made my own wrappers, which I then run with separate cronjobs:
# cat /usr/local/bin/munin-graph #!/bin/bash # file copied from /usr/bin/munin-cron and adjusted. # This used to test if the executables were installed. But that is # perfectly redundant and supresses errors that the admin should see. #/usr/share/munin/munin-update $@ || exit 1 # The result of munin-limits is needed by munin-html but not by # munin-graph. So run it in the background now, it will be done # before munin-graph. # When runnin update at */5 and graph at */10, munin-update and munin-graph # will be started at the same time, and this sleep it to prevent a # race-condition on the update-running file. sleep 5 while [ -f "/var/run/munin/update-running" ]; do sleep 1 done /usr/share/munin/munin-limits $@ & nice /usr/share/munin/munin-graph --cron $@ 2>&1 | fgrep -v "*** attempt to put segment in horiz list twice" wait nice /usr/share/munin/munin-html $@ || exit 1
# cat /usr/local/bin/munin-update-data #!/bin/bash # file copied from /usr/bin/munin-cron and adjusted. # This used to test if the executables were installed. But that is # perfectly redundant and supresses errors that the admin should see. runfile="/var/run/munin/update-running" touch "$runfile" /usr/share/munin/munin-update $@ || exit 1 rm "$runfile" # The result of munin-limits is needed by munin-html but not by # munin-graph. So run it in the background now, it will be done # before munin-graph. #/usr/share/munin/munin-limits $@ & #nice /usr/share/munin/munin-graph --cron $@ 2>&1 | fgrep -v "*** attempt to put segment in horiz list twice" #wait #nice /usr/share/munin/munin-html $@ || exit 1
# cat /etc/cron.d/munin # # cron-jobs for munin # MAILTO=root #*/5 * * * * munin if [ -x /usr/bin/munin-cron ]; then /usr/bin/munin-cron; fi */5 * * * * munin if [ -x /usr/local/bin/munin-update-data ]; then /usr/local/bin/munin-update-data; fi */10 * * * * munin if [ -x /usr/local/bin/munin-graph ]; then /usr/local/bin/munin-graph; fi 14 10 * * * munin if [ -x /usr/share/munin/munin-limits ]; then /usr/share/munin/munin-limits --force --contact nagios --contact old-nagios; fi
Nice solution, have exactly this problem, but don’t want to switch to CGI mode for munin-graph.
10 minutes sound quite good for graphs updates.
Regards,
Alex
I have yet to upgrade my Debian machine. If I do, I will get the cgi-mode capability. Have you tried it? I was curious about it.
Thanks,
I eventually came up with a similar solution to yours:)
It’s strange that munin does not provide the option yet to separate data collection from graph generation. (except for this way)