Update plugin_nfacct.c (#6098)
fix CHART [netfilter.nfacct_bytes/nfacct_packets]: it just show 1 DIMENSION.
fun0 committed
Aug 6, 2019 at 21:42 UTC
845aa788384f4b2a0f99ad91237c38dad36ee5dd
1 file changed
+14
-8
collectors/nfacct.plugin/plugin_nfacct.c
+14
-8
@@ -715,15 +715,18 @@ static void nfacct_send_metrics() {
715
printf("CHART netfilter.nfacct_packets '' 'Netfilter Accounting Packets' 'packets/s'\n");
716
printf("DIMENSION %s '' incremental 1 %d\n", d->name, nfacct_root.update_every);
717
}
718
- printf(
719
- "BEGIN netfilter.nfacct_packets\n"
720
- "SET %s = %lld\n"
721
- "END\n"
718
+ }
719
+ }
720
+ printf("BEGIN netfilter.nfacct_packets\n");
721
+ for(d = nfacct_root.nfacct_metrics; d ; d = d->next) {
722
+ if(likely(d->updated)) {
723
+ printf("SET %s = %lld\n"
724
, d->name
725
, (collected_number)d->pkts
726
);
727
}
728
}
729
+ printf("END\n");
730
731
// ----------------------------------------------------------------
732
@@ -743,15 +746,18 @@ static void nfacct_send_metrics() {
746
printf("CHART netfilter.nfacct_bytes '' 'Netfilter Accounting Bandwidth' 'kilobytes/s'\n");
747
printf("DIMENSION %s '' incremental 1 %d\n", d->name, 1000 * nfacct_root.update_every);
748
}
746
- printf(
747
- "BEGIN netfilter.nfacct_bytes\n"
748
- "SET %s = %lld\n"
749
- "END\n"
749
+ }
750
+ }
751
+ printf("BEGIN netfilter.nfacct_bytes\n");
752
+ for(d = nfacct_root.nfacct_metrics; d ; d = d->next) {
753
+ if(likely(d->updated)) {
754
+ printf("SET %s = %lld\n"
755
, d->name
756
, (collected_number)d->bytes
757
);
758
}
759
}
760
+ printf("END\n");
761
}
762
763
#endif // HAVE_LIBNETFILTER_ACCT