From: Pavel Rochnyack Date: Sun, 12 May 2019 08:53:08 +0000 (+0700) Subject: virt plugin: Do not report 'domain_state' metric when not enabled by ExtraStats X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=a18a9abda421484791f8eaac270794903f1438be;p=collectd.git virt plugin: Do not report 'domain_state' metric when not enabled by ExtraStats PR #2701 adds 'domain_state' metric and ExtraStats's option `domain_state` selector behaviour was changed: now it enables metric, not notification. Removed inconsistency between documentation and implementation. Not all `get_domain_state` calls was covered by selector check. As result, metric was always sent for inactive domains. That is fixed now. --- diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index fb0751a7..800c0d22 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -9466,9 +9466,7 @@ I<0.9.5> or later. =item B: report disk errors if any occured. Requires libvirt API version I<0.9.10> or later. -=item B: report domain state and reason in human-readable format as -a notification. If libvirt API version I<0.9.2> or later is available, domain -reason will be included in notification. +=item B: report domain state and reason as 'domain_state' metric. =item B: report file system information as a notification. Requires libvirt API version I<1.2.11> or later. Can be collected only if I diff --git a/src/virt.c b/src/virt.c index 58bacab7..1267dbcb 100644 --- a/src/virt.c +++ b/src/virt.c @@ -2297,7 +2297,7 @@ static int lv_read(user_data_t *ud) { if (dom->active) status = get_domain_metrics(dom); #ifdef HAVE_DOM_REASON - else + else if (extra_stats & ex_stats_domain_state) status = submit_domain_state(dom->ptr); #endif