I have a metric that should only be checked and logged daily.
Calculation is CPU-intensive, and querying multiple times per day returns the same value (i.e. it just wastes CPU time).
Is it possible to make a plugin that is queried only once per day?
I've tried to specify "update_rate 3600" in munin-node config for this plugin, but it was still queried every 5 minutes. Graphs are also displayed with 5 minutes granularity.
Surely, local cache is an option, but makes things more complicated.
You could play with cron to have two entries in
/etc/cron.d/munin
. The normal one which callmunin-cron
every 5 minutes (*/5
) with the base config where you remove reference to your daily run plugin, and a second one which call only the update (munin-update
) every day at 7:30 for example (30 7
) with a extra config file you will have to write that only deal with the daily plugin.I don't have munin anymore to play and test it, but nevertheless, as far as I remember how it works, it should help you to solve your issue.
Although this does not exactly answer your question, it could be a workaround. Consider the following munin plugin:
And this crontab:
In
/etc/munin/plugin-pool
, I would link the probes whose results I want to cache locally:The crontab would iterate over those, keep track of the results in
/tmp/munin-pool/
. While thepool_
probe would query that cache:So instead of re-querying a service every five minutes, I can gather metrics from my crontab, on whatever schedule I need. Or, in my use case, if a probe usually exceeds munin query timeout, you're not left with empty graphs.
If we were to scrape some probes on different intervals, without such workaround, then the resulting graphs would only include those points you did gather, and lots of blanks for those we "missed".