@cryptotaxi247 / netdata-1 / commits / 56bc902bc

Fix collectors on MacOS and FreeBSD to ignore archived charts. (#9695)

* Make macOS collectors ignore archived charts. * Make FreeBSD collectors ignore archived charts.

Markos Fountoulakis committed Aug 11, 2020 at 11:03 UTC 56bc902bc6e08d191be8ec8a2c7833f322773610
4 files changed +38 -38
collectors/freebsd.plugin/freebsd_ipfw.c
+4 -4
@@ -235,12 +235,12 @@ int do_ipfw(int update_every, usec_t dt) {
235 if (likely(do_static)) {
236 sprintf(rule_num_str, "%d_%d", rule->rulenum, rule->id);
237
238 - rd_packets = rrddim_find(st_packets, rule_num_str);
238 + rd_packets = rrddim_find_active(st_packets, rule_num_str);
239 if (unlikely(!rd_packets))
240 rd_packets = rrddim_add(st_packets, rule_num_str, NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
241 rrddim_set_by_pointer(st_packets, rd_packets, cntr->pcnt);
242
243 - rd_bytes = rrddim_find(st_bytes, rule_num_str);
243 + rd_bytes = rrddim_find_active(st_bytes, rule_num_str);
244 if (unlikely(!rd_bytes))
245 rd_bytes = rrddim_add(st_bytes, rule_num_str, NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
246 rrddim_set_by_pointer(st_bytes, rd_bytes, cntr->bcnt);
@@ -347,12 +347,12 @@ int do_ipfw(int update_every, usec_t dt) {
347 for (srn = 0; (srn < (static_rules_num - 1)) && (dyn_rules_num[srn].rule_num != IPFW_DEFAULT_RULE); srn++) {
348 sprintf(rule_num_str, "%d", dyn_rules_num[srn].rule_num);
349
350 - rd_active = rrddim_find(st_active, rule_num_str);
350 + rd_active = rrddim_find_active(st_active, rule_num_str);
351 if (unlikely(!rd_active))
352 rd_active = rrddim_add(st_active, rule_num_str, NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
353 rrddim_set_by_pointer(st_active, rd_active, dyn_rules_num[srn].active_rules);
354
355 - rd_expired = rrddim_find(st_expired, rule_num_str);
355 + rd_expired = rrddim_find_active(st_expired, rule_num_str);
356 if (unlikely(!rd_expired))
357 rd_expired = rrddim_add(st_expired, rule_num_str, NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
358 rrddim_set_by_pointer(st_expired, rd_expired, dyn_rules_num[srn].expired_rules);
collectors/freebsd.plugin/freebsd_sysctl.c
+1 -1
@@ -678,7 +678,7 @@ int do_hw_intcnt(int update_every, usec_t dt) {
678
679 p = intrnames + i * (MAXCOMLEN + 1);
680 if (unlikely((intrcnt[i] != 0) && (*(char *) p != 0))) {
681 - RRDDIM *rd_interrupts = rrddim_find(st_interrupts, p);
681 + RRDDIM *rd_interrupts = rrddim_find_active(st_interrupts, p);
682
683 if (unlikely(!rd_interrupts))
684 rd_interrupts = rrddim_add(st_interrupts, p, NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
collectors/macos.plugin/macos_mach_smi.c
+3 -3
@@ -109,7 +109,7 @@ int do_macos_mach_smi(int update_every, usec_t dt) {
109 error("DISABLED: mem.pgfaults");
110 } else {
111 if (likely(do_ram)) {
112 - st = rrdset_find_localhost("system.ram");
112 + st = rrdset_find_active_localhost("system.ram");
113 if (unlikely(!st)) {
114 st = rrdset_create_localhost(
115 "system"
@@ -156,7 +156,7 @@ int do_macos_mach_smi(int update_every, usec_t dt) {
156 // --------------------------------------------------------------------
157
158 if (likely(do_swapio)) {
159 - st = rrdset_find_localhost("system.swapio");
159 + st = rrdset_find_active_localhost("system.swapio");
160 if (unlikely(!st)) {
161 st = rrdset_create_localhost(
162 "system"
@@ -187,7 +187,7 @@ int do_macos_mach_smi(int update_every, usec_t dt) {
187 // --------------------------------------------------------------------
188
189 if (likely(do_pgfaults)) {
190 - st = rrdset_find_localhost("mem.pgfaults");
190 + st = rrdset_find_active_localhost("mem.pgfaults");
191 if (unlikely(!st)) {
192 st = rrdset_create_localhost(
193 "mem"
collectors/macos.plugin/macos_sysctl.c
+30 -30
@@ -270,7 +270,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
270 do_swap = 0;
271 error("DISABLED: system.swap");
272 } else {
273 - st = rrdset_find_localhost("system.swap");
273 + st = rrdset_find_active_localhost("system.swap");
274 if (unlikely(!st)) {
275 st = rrdset_create_localhost(
276 "system"
@@ -332,7 +332,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
332 iftot.ift_obytes += if2m->ifm_data.ifi_obytes;
333 }
334 }
335 - st = rrdset_find_localhost("system.ipv4");
335 + st = rrdset_find_active_localhost("system.ipv4");
336 if (unlikely(!st)) {
337 st = rrdset_create_localhost(
338 "system"
@@ -382,7 +382,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
382 error("DISABLED: ipv4.ecnpkts");
383 } else {
384 if (likely(do_tcp_packets)) {
385 - st = rrdset_find_localhost("ipv4.tcppackets");
385 + st = rrdset_find_active_localhost("ipv4.tcppackets");
386 if (unlikely(!st)) {
387 st = rrdset_create_localhost(
388 "ipv4"
@@ -412,7 +412,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
412 // --------------------------------------------------------------------
413
414 if (likely(do_tcp_errors)) {
415 - st = rrdset_find_localhost("ipv4.tcperrors");
415 + st = rrdset_find_active_localhost("ipv4.tcperrors");
416 if (unlikely(!st)) {
417 st = rrdset_create_localhost(
418 "ipv4"
@@ -445,7 +445,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
445 // --------------------------------------------------------------------
446
447 if (likely(do_tcp_handshake)) {
448 - st = rrdset_find_localhost("ipv4.tcphandshake");
448 + st = rrdset_find_active_localhost("ipv4.tcphandshake");
449 if (unlikely(!st)) {
450 st = rrdset_create_localhost(
451 "ipv4"
@@ -486,7 +486,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
486 tcpstat.tcps_persistdrop ||
487 netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
488 do_tcpext_connaborts = CONFIG_BOOLEAN_YES;
489 - st = rrdset_find_localhost("ipv4.tcpconnaborts");
489 + st = rrdset_find_active_localhost("ipv4.tcpconnaborts");
490 if (unlikely(!st)) {
491 st = rrdset_create_localhost(
492 "ipv4"
@@ -523,7 +523,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
523 (tcpstat.tcps_rcvoopack ||
524 netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
525 do_tcpext_ofo = CONFIG_BOOLEAN_YES;
526 - st = rrdset_find_localhost("ipv4.tcpofo");
526 + st = rrdset_find_active_localhost("ipv4.tcpofo");
527 if (unlikely(!st)) {
528 st = rrdset_create_localhost(
529 "ipv4"
@@ -557,7 +557,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
557 netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
558 do_tcpext_syscookies = CONFIG_BOOLEAN_YES;
559
560 - st = rrdset_find_localhost("ipv4.tcpsyncookies");
560 + st = rrdset_find_active_localhost("ipv4.tcpsyncookies");
561 if (unlikely(!st)) {
562 st = rrdset_create_localhost(
563 "ipv4"
@@ -595,7 +595,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
595 tcpstat.tcps_ecn_not_supported ||
596 netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
597 do_ecn = CONFIG_BOOLEAN_YES;
598 - st = rrdset_find_localhost("ipv4.ecnpkts");
598 + st = rrdset_find_active_localhost("ipv4.ecnpkts");
599 if (unlikely(!st)) {
600 st = rrdset_create_localhost(
601 "ipv4"
@@ -638,7 +638,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
638 error("DISABLED: ipv4.udperrors");
639 } else {
640 if (likely(do_udp_packets)) {
641 - st = rrdset_find_localhost("ipv4.udppackets");
641 + st = rrdset_find_active_localhost("ipv4.udppackets");
642 if (unlikely(!st)) {
643 st = rrdset_create_localhost(
644 "ipv4"
@@ -668,7 +668,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
668 // --------------------------------------------------------------------
669
670 if (likely(do_udp_errors)) {
671 - st = rrdset_find_localhost("ipv4.udperrors");
671 + st = rrdset_find_active_localhost("ipv4.udperrors");
672 if (unlikely(!st)) {
673 st = rrdset_create_localhost(
674 "ipv4"
@@ -729,7 +729,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
729 // --------------------------------------------------------------------
730
731 if (likely(do_icmp_packets)) {
732 - st = rrdset_find_localhost("ipv4.icmp");
732 + st = rrdset_find_active_localhost("ipv4.icmp");
733 if (unlikely(!st)) {
734 st = rrdset_create_localhost(
735 "ipv4"
@@ -758,7 +758,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
758
759 // --------------------------------------------------------------------
760
761 - st = rrdset_find_localhost("ipv4.icmp_errors");
761 + st = rrdset_find_active_localhost("ipv4.icmp_errors");
762 if (unlikely(!st)) {
763 st = rrdset_create_localhost(
764 "ipv4"
@@ -791,7 +791,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
791 // --------------------------------------------------------------------
792
793 if (likely(do_icmpmsg)) {
794 - st = rrdset_find_localhost("ipv4.icmpmsg");
794 + st = rrdset_find_active_localhost("ipv4.icmpmsg");
795 if (unlikely(!st)) {
796 st = rrdset_create_localhost(
797 "ipv4"
@@ -840,7 +840,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
840 error("DISABLED: ipv4.errors");
841 } else {
842 if (likely(do_ip_packets)) {
843 - st = rrdset_find_localhost("ipv4.packets");
843 + st = rrdset_find_active_localhost("ipv4.packets");
844 if (unlikely(!st)) {
845 st = rrdset_create_localhost(
846 "ipv4"
@@ -874,7 +874,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
874 // --------------------------------------------------------------------
875
876 if (likely(do_ip_fragsout)) {
877 - st = rrdset_find_localhost("ipv4.fragsout");
877 + st = rrdset_find_active_localhost("ipv4.fragsout");
878 if (unlikely(!st)) {
879 st = rrdset_create_localhost(
880 "ipv4"
@@ -907,7 +907,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
907 // --------------------------------------------------------------------
908
909 if (likely(do_ip_fragsin)) {
910 - st = rrdset_find_localhost("ipv4.fragsin");
910 + st = rrdset_find_active_localhost("ipv4.fragsin");
911 if (unlikely(!st)) {
912 st = rrdset_create_localhost(
913 "ipv4"
@@ -940,7 +940,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
940 // --------------------------------------------------------------------
941
942 if (likely(do_ip_errors)) {
943 - st = rrdset_find_localhost("ipv4.errors");
943 + st = rrdset_find_active_localhost("ipv4.errors");
944 if (unlikely(!st)) {
945 st = rrdset_create_localhost(
946 "ipv4"
@@ -1000,7 +1000,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1000 ip6stat.ip6s_delivered ||
1001 netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1002 do_ip6_packets = CONFIG_BOOLEAN_YES;
1003 - st = rrdset_find_localhost("ipv6.packets");
1003 + st = rrdset_find_active_localhost("ipv6.packets");
1004 if (unlikely(!st)) {
1005 st = rrdset_create_localhost(
1006 "ipv6"
@@ -1039,7 +1039,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1039 ip6stat.ip6s_ofragments ||
1040 netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1041 do_ip6_fragsout = CONFIG_BOOLEAN_YES;
1042 - st = rrdset_find_localhost("ipv6.fragsout");
1042 + st = rrdset_find_active_localhost("ipv6.fragsout");
1043 if (unlikely(!st)) {
1044 st = rrdset_create_localhost(
1045 "ipv6"
@@ -1078,7 +1078,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1078 ip6stat.ip6s_fragments ||
1079 netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1080 do_ip6_fragsin = CONFIG_BOOLEAN_YES;
1081 - st = rrdset_find_localhost("ipv6.fragsin");
1081 + st = rrdset_find_active_localhost("ipv6.fragsin");
1082 if (unlikely(!st)) {
1083 st = rrdset_create_localhost(
1084 "ipv6"
@@ -1124,7 +1124,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1124 ip6stat.ip6s_noroute ||
1125 netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1126 do_ip6_errors = CONFIG_BOOLEAN_YES;
1127 - st = rrdset_find_localhost("ipv6.errors");
1127 + st = rrdset_find_active_localhost("ipv6.errors");
1128 if (unlikely(!st)) {
1129 st = rrdset_create_localhost(
1130 "ipv6"
@@ -1186,7 +1186,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1186 icmp6_total.msgs_out ||
1187 netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1188 do_icmp6 = CONFIG_BOOLEAN_YES;
1189 - st = rrdset_find_localhost("ipv6.icmp");
1189 + st = rrdset_find_active_localhost("ipv6.icmp");
1190 if (unlikely(!st)) {
1191 st = rrdset_create_localhost(
1192 "ipv6"
@@ -1220,7 +1220,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1220 icmp6stat.icp6s_outhist[ND_REDIRECT] ||
1221 netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1222 do_icmp6_redir = CONFIG_BOOLEAN_YES;
1223 - st = rrdset_find_localhost("ipv6.icmpredir");
1223 + st = rrdset_find_active_localhost("ipv6.icmpredir");
1224 if (unlikely(!st)) {
1225 st = rrdset_create_localhost(
1226 "ipv6"
@@ -1263,7 +1263,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1263 icmp6stat.icp6s_outhist[ICMP6_PARAM_PROB] ||
1264 netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1265 do_icmp6_errors = CONFIG_BOOLEAN_YES;
1266 - st = rrdset_find_localhost("ipv6.icmperrors");
1266 + st = rrdset_find_active_localhost("ipv6.icmperrors");
1267 if (unlikely(!st)) {
1268 st = rrdset_create_localhost(
1269 "ipv6"
@@ -1316,7 +1316,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1316 icmp6stat.icp6s_outhist[ICMP6_ECHO_REPLY] ||
1317 netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1318 do_icmp6_echos = CONFIG_BOOLEAN_YES;
1319 - st = rrdset_find_localhost("ipv6.icmpechos");
1319 + st = rrdset_find_active_localhost("ipv6.icmpechos");
1320 if (unlikely(!st)) {
1321 st = rrdset_create_localhost(
1322 "ipv6"
@@ -1356,7 +1356,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1356 icmp6stat.icp6s_outhist[ND_ROUTER_ADVERT] ||
1357 netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1358 do_icmp6_router = CONFIG_BOOLEAN_YES;
1359 - st = rrdset_find_localhost("ipv6.icmprouter");
1359 + st = rrdset_find_active_localhost("ipv6.icmprouter");
1360 if (unlikely(!st)) {
1361 st = rrdset_create_localhost(
1362 "ipv6"
@@ -1396,7 +1396,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1396 icmp6stat.icp6s_outhist[ND_NEIGHBOR_ADVERT] ||
1397 netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1398 do_icmp6_neighbor = CONFIG_BOOLEAN_YES;
1399 - st = rrdset_find_localhost("ipv6.icmpneighbor");
1399 + st = rrdset_find_active_localhost("ipv6.icmpneighbor");
1400 if (unlikely(!st)) {
1401 st = rrdset_create_localhost(
1402 "ipv6"
@@ -1442,7 +1442,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1442 icmp6stat.icp6s_outhist[136] ||
1443 netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1444 do_icmp6_types = CONFIG_BOOLEAN_YES;
1445 - st = rrdset_find_localhost("ipv6.icmptypes");
1445 + st = rrdset_find_active_localhost("ipv6.icmptypes");
1446 if (unlikely(!st)) {
1447 st = rrdset_create_localhost(
1448 "ipv6"
@@ -1495,7 +1495,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1495 error("DISABLED: system.uptime");
1496 } else {
1497 clock_gettime(CLOCK_REALTIME, &cur_time);
1498 - st = rrdset_find_localhost("system.uptime");
1498 + st = rrdset_find_active_localhost("system.uptime");
1499
1500 if(unlikely(!st)) {
1501 st = rrdset_create_localhost(