diff options
author | fun0 <48508322+fun04wr0ng@users.noreply.github.com> | 2019-08-06 21:42:20 +0800 |
---|---|---|
committer | Vladimir Kobal <vlad@prokk.net> | 2019-08-06 16:42:20 +0300 |
commit | 845aa788384f4b2a0f99ad91237c38dad36ee5dd (patch) | |
tree | 6cc0045932b8d9431e81679ada81cf67e7ca24b2 /collectors/nfacct.plugin | |
parent | 32451c28c7a8083438cbb721b60a41dd29feaf7b (diff) |
Update plugin_nfacct.c (#6098)
fix CHART [netfilter.nfacct_bytes/nfacct_packets]: it just show 1 DIMENSION.
Diffstat (limited to 'collectors/nfacct.plugin')
-rw-r--r-- | collectors/nfacct.plugin/plugin_nfacct.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/collectors/nfacct.plugin/plugin_nfacct.c b/collectors/nfacct.plugin/plugin_nfacct.c index feec34b85d..21c2e4aeec 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 |