Unbound stats -> unbound_munin_ + another monitoring system

Hello community,

I tried to monitor Unbound via unbound-control stats from two monitoring systems (munin, check_mk) even if then Unbound configuration is set to
server:
statistics-interval: 0
extended-statistics: yes
statistics-cumulative: no

so counters are reset to 0 every command period. Munin (https://nlnetlabs.nl/documentation/unbound/howto-statistics/) period is 5 minutes and check_mk (https://github.com/michalskalski/nagios_check_mk/tree/master/unbound_stats) is every minute. Check_mk agent plugin uses the same philosophy to print counters from unbound-control stats.

The problem is obvious, each check resets statistic counters to 0 and counters correlation are malformed in a given time period for each monitoring system.

Can someone advise me how to update munin plugin to load data from “statistics-cumulative: yes” option?

Best regards,

Hello community,

I discovered my problem with counters reset after unbound-control stats command is triggered.
I set the Unbound configuration to statistic-cumulative: yes

I did more focus on Munin plugin, which stores .rrd files in type GAUGE. Then to uses Unbound option “statistics-cumulative: yes” it has to be defined in the plugin as type “COUNTER”.

I achieve it to add the parameter in Munin plugin “unbound_munin_” in “p_config”

line 217 - 223

print label and min 0 for a name $1 in unbound format

p_config ( ) {
mn=echo $1 | sed $ABBREV | tr . _
echo $mn.type COUNTER
echo $mn.label “$2”
echo $mn.min 0
}

This option can be checked by command:

#munin-run unbound_munin_by_type config
graph_title Unbound DNS queries by type
graph_args --base 1000 -l 0
graph_vlabel queries / second
graph_category DNS
n_q_t_A.type COUNTER
n_q_t_A.label A
n_q_t_A.min 0
graph_info queries by DNS RR type queried for

Is someone who can confirm my assumption that this modification should be functioning but unfortunately is not? Where I’m wrong?

Thanks in any advice, regards

[[ Setting up a tangent on cumulative/non-cumulative counters ]]

I set the Unbound configuration to statistic-cumulative: yes

Truth be told, I never understood why anyone with their wits
intact (not picking on you in particular...) would configure
"statistic-cumulative: no".

If you have a single monitoring client, that could work, for some
value of "work". However, with such a configuration, as soon as
you sample the stats with e.g. unbound-control, you ruin that
interval's counters for your monitoring client by resetting them
to zero "out of order" wrt. the monitoring client's periodic
polling.

With multiple monitoring clients any hopes of accuracy is
thrown out the window.

It always struck me as a bad idea to even offer the option to the
operator; IMHO the counters should always be counters in the
sense used by SNMP, i.e. never reset to zero on read.

Regards,

- Håvard

Hello Håvard,

thanks for your answer, I really appreciate it.
I agree with you, the original Munin plugin with non-cumulative counters is not the best way, how to monitor Unbound application from more than one monitoring system.
But complaining does not help.
Anyway, have you any experience with Munin plugin and modifying existed contrib/munin/unbound_munin_ in the case when is Unbound set to a cumulative counter and Munin shows rrd in COUNTER or DERIVE format, but the graf is still not displayed correctly. I did some update in the plugin in hope, when the counter type would be set to COUNTER or DERIVE, then the Munin graph can show me some valid information, but it still shows to me only the exponential line - then plugin did not count.

As I wrote before, my plugin modification is in “p_config” function
line 217 - 223

Regards,