3

I am writing a custom munin plugin/graph and it's slightly computationally expensive. It's also unlikely to change much in a few minutes. Is it possible to have this one graph/plugin only update once per hour, and leave the rest of my graphs to update at the usual once per 5 minutes?

Amandasaurus
  • 31,471
  • 65
  • 192
  • 253

3 Answers3

4

I had a similar problem and had the real plugin in cron writing the data every hour to a temp file and then a reading plugin that ran every 5 minutes from munin, but only displayed the last line from the temp file.

Jure1873
  • 3,702
  • 1
  • 22
  • 28
0

A better way to do it is to change your munin so that graphs are generated on demand, not every five minutes.

This page appears to have an overview: http://waste.mandragor.org/munin_tutorial/munin.html#cgi

David Mackintosh
  • 14,293
  • 7
  • 49
  • 78
0

I had the same problem running munin on my Raspberry Pi. Since the Raspberry Pi is not that powerful it was having a lot of keeping up with the five intervals set up by Munin.

Edit the file /etc/cron.d/munin, add the following line:

2 * * * *      munin if [ -x /usr/bin/munin-graph ]; then /usr/bin/munin-graph; fi

The file /usr/bin/munin-graph does not exist yet, so we are going to create it:

vi /usr/bin/munin-graph

Now add this:

#!/bin/bash
# We always launch munin-html.
# It is a noop if html_strategy is "cgi"
nice /usr/share/munin/munin-html $@ || exit 1

# The result of munin-html is needed for munin-graph.
# It is a noop if graph_strategy is "cgi"
nice /usr/share/munin/munin-graph --cron $@ || exit 1 

and make it executable:

chmod +x /usr/bin/munin-graph

Now edit the /usr/bin/munin-cron file and comment out the lines we put in the munin-graph file:

[...]
# We always launch munin-html.
# It is a noop if html_strategy is "cgi"
# nice /usr/share/munin/munin-html $@ || exit 1

# The result of munin-html is needed for munin-graph.
# It is a noop if graph_strategy is "cgi"
# nice /usr/share/munin/munin-graph --cron $@ || exit 1 

By doing this, the munin-update runs every 5 minutes, and the graphing and HTML page creation runs only once per hour (2 minutes after the full hour).