From cd7ed12292aef11d9062b64f61215174e8cc1860 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 3 Sep 2019 12:23:48 +0200 Subject: Merging upstream version 1.17.0. Signed-off-by: Daniel Baumann --- collectors/nfacct.plugin/plugin_nfacct.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'collectors/nfacct.plugin/plugin_nfacct.c') diff --git a/collectors/nfacct.plugin/plugin_nfacct.c b/collectors/nfacct.plugin/plugin_nfacct.c index feec34b85..21c2e4aee 100644 --- a/collectors/nfacct.plugin/plugin_nfacct.c +++ b/collectors/nfacct.plugin/plugin_nfacct.c @@ -715,15 +715,18 @@ static void nfacct_send_metrics() { printf("CHART netfilter.nfacct_packets '' 'Netfilter Accounting Packets' 'packets/s'\n"); printf("DIMENSION %s '' incremental 1 %d\n", d->name, nfacct_root.update_every); } - printf( - "BEGIN netfilter.nfacct_packets\n" - "SET %s = %lld\n" - "END\n" + } + } + printf("BEGIN netfilter.nfacct_packets\n"); + for(d = nfacct_root.nfacct_metrics; d ; d = d->next) { + if(likely(d->updated)) { + printf("SET %s = %lld\n" , d->name , (collected_number)d->pkts ); } } + printf("END\n"); // ---------------------------------------------------------------- @@ -743,15 +746,18 @@ static void nfacct_send_metrics() { printf("CHART netfilter.nfacct_bytes '' 'Netfilter Accounting Bandwidth' 'kilobytes/s'\n"); printf("DIMENSION %s '' incremental 1 %d\n", d->name, 1000 * nfacct_root.update_every); } - printf( - "BEGIN netfilter.nfacct_bytes\n" - "SET %s = %lld\n" - "END\n" + } + } + printf("BEGIN netfilter.nfacct_bytes\n"); + for(d = nfacct_root.nfacct_metrics; d ; d = d->next) { + if(likely(d->updated)) { + printf("SET %s = %lld\n" , d->name , (collected_number)d->bytes ); } } + printf("END\n"); } #endif // HAVE_LIBNETFILTER_ACCT -- cgit v1.2.3