remove "ingore 0 metrics" from macos plugin (#17803)
* remove "ingore 0 metrics" from macos plugin * fix
Ilya Mashchenko committed
Jun 3, 2024 at 22:42 UTC
b5406d7fb4568924063d5504e1fe6e59f91c951c
1 file changed
+16
-97
src/collectors/macos.plugin/macos_sysctl.c
+16
-97
@@ -456,12 +456,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
456
rrdset_done(st);
457
}
458
459
- if (do_tcpext_connaborts == CONFIG_BOOLEAN_YES || (do_tcpext_connaborts == CONFIG_BOOLEAN_AUTO &&
460
- (tcpstat.tcps_rcvpackafterwin ||
461
- tcpstat.tcps_rcvafterclose ||
462
- tcpstat.tcps_rcvmemdrop ||
463
- tcpstat.tcps_persistdrop ||
464
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
459
+ if (do_tcpext_connaborts == CONFIG_BOOLEAN_YES || do_tcpext_connaborts == CONFIG_BOOLEAN_AUTO) {
460
do_tcpext_connaborts = CONFIG_BOOLEAN_YES;
461
st = rrdset_find_active_localhost("ipv4.tcpconnaborts");
462
if (unlikely(!st)) {
@@ -493,9 +488,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
488
rrdset_done(st);
489
}
490
496
- if (do_tcpext_ofo == CONFIG_BOOLEAN_YES || (do_tcpext_ofo == CONFIG_BOOLEAN_AUTO &&
497
- (tcpstat.tcps_rcvoopack ||
498
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
491
+ if (do_tcpext_ofo == CONFIG_BOOLEAN_YES || do_tcpext_ofo == CONFIG_BOOLEAN_AUTO) {
492
do_tcpext_ofo = CONFIG_BOOLEAN_YES;
493
st = rrdset_find_active_localhost("ipv4.tcpofo");
494
if (unlikely(!st)) {
@@ -521,11 +514,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
514
rrdset_done(st);
515
}
516
524
- if (do_tcpext_syscookies == CONFIG_BOOLEAN_YES || (do_tcpext_syscookies == CONFIG_BOOLEAN_AUTO &&
525
- (tcpstat.tcps_sc_sendcookie ||
526
- tcpstat.tcps_sc_recvcookie ||
527
- tcpstat.tcps_sc_zonefail ||
528
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
517
+ if (do_tcpext_syscookies == CONFIG_BOOLEAN_YES || do_tcpext_syscookies == CONFIG_BOOLEAN_AUTO) {
518
do_tcpext_syscookies = CONFIG_BOOLEAN_YES;
519
520
st = rrdset_find_active_localhost("ipv4.tcpsyncookies");
@@ -557,10 +546,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
546
}
547
548
#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
560
- if (do_ecn == CONFIG_BOOLEAN_YES || (do_ecn == CONFIG_BOOLEAN_AUTO &&
561
- (tcpstat.tcps_ecn_recv_ce ||
562
- tcpstat.tcps_ecn_not_supported ||
563
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
549
+ if (do_ecn == CONFIG_BOOLEAN_YES || do_ecn == CONFIG_BOOLEAN_AUTO) {
550
do_ecn = CONFIG_BOOLEAN_YES;
551
st = rrdset_find_active_localhost("ipv4.ecnpkts");
552
if (unlikely(!st)) {
@@ -927,12 +913,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
913
do_ip6_errors = 0;
914
collector_error("DISABLED: ipv6.errors");
915
} else {
930
- if (do_ip6_packets == CONFIG_BOOLEAN_YES || (do_ip6_packets == CONFIG_BOOLEAN_AUTO &&
931
- (ip6stat.ip6s_localout ||
932
- ip6stat.ip6s_total ||
933
- ip6stat.ip6s_forward ||
934
- ip6stat.ip6s_delivered ||
935
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
916
+ if (do_ip6_packets == CONFIG_BOOLEAN_YES || do_ip6_packets == CONFIG_BOOLEAN_AUTO) {
917
do_ip6_packets = CONFIG_BOOLEAN_YES;
918
st = rrdset_find_active_localhost("ipv6.packets");
919
if (unlikely(!st)) {
@@ -964,11 +945,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
945
rrdset_done(st);
946
}
947
967
- if (do_ip6_fragsout == CONFIG_BOOLEAN_YES || (do_ip6_fragsout == CONFIG_BOOLEAN_AUTO &&
968
- (ip6stat.ip6s_fragmented ||
969
- ip6stat.ip6s_cantfrag ||
970
- ip6stat.ip6s_ofragments ||
971
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
948
+ if (do_ip6_fragsout == CONFIG_BOOLEAN_YES || do_ip6_fragsout == CONFIG_BOOLEAN_AUTO) {
949
do_ip6_fragsout = CONFIG_BOOLEAN_YES;
950
st = rrdset_find_active_localhost("ipv6.fragsout");
951
if (unlikely(!st)) {
@@ -999,12 +976,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
976
rrdset_done(st);
977
}
978
1002
- if (do_ip6_fragsin == CONFIG_BOOLEAN_YES || (do_ip6_fragsin == CONFIG_BOOLEAN_AUTO &&
1003
- (ip6stat.ip6s_reassembled ||
1004
- ip6stat.ip6s_fragdropped ||
1005
- ip6stat.ip6s_fragtimeout ||
1006
- ip6stat.ip6s_fragments ||
1007
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
979
+ if (do_ip6_fragsin == CONFIG_BOOLEAN_YES || do_ip6_fragsin == CONFIG_BOOLEAN_AUTO) {
980
do_ip6_fragsin = CONFIG_BOOLEAN_YES;
981
st = rrdset_find_active_localhost("ipv6.fragsin");
982
if (unlikely(!st)) {
@@ -1037,17 +1009,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1009
rrdset_done(st);
1010
}
1011
1040
- if (do_ip6_errors == CONFIG_BOOLEAN_YES || (do_ip6_errors == CONFIG_BOOLEAN_AUTO &&
1041
- (ip6stat.ip6s_toosmall ||
1042
- ip6stat.ip6s_odropped ||
1043
- ip6stat.ip6s_badoptions ||
1044
- ip6stat.ip6s_badvers ||
1045
- ip6stat.ip6s_exthdrtoolong ||
1046
- ip6stat.ip6s_sources_none ||
1047
- ip6stat.ip6s_tooshort ||
1048
- ip6stat.ip6s_cantforward ||
1049
- ip6stat.ip6s_noroute ||
1050
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1012
+ if (do_ip6_errors == CONFIG_BOOLEAN_YES || do_ip6_errors == CONFIG_BOOLEAN_AUTO) {
1013
do_ip6_errors = CONFIG_BOOLEAN_YES;
1014
st = rrdset_find_active_localhost("ipv6.errors");
1015
if (unlikely(!st)) {
@@ -1103,10 +1065,8 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1065
icmp6_total.msgs_out += icmp6stat.icp6s_outhist[i];
1066
}
1067
icmp6_total.msgs_in += icmp6stat.icp6s_badcode + icmp6stat.icp6s_badlen + icmp6stat.icp6s_checksum + icmp6stat.icp6s_tooshort;
1106
- if (do_icmp6 == CONFIG_BOOLEAN_YES || (do_icmp6 == CONFIG_BOOLEAN_AUTO &&
1107
- (icmp6_total.msgs_in ||
1108
- icmp6_total.msgs_out ||
1109
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1068
+
1069
+ if (do_icmp6 == CONFIG_BOOLEAN_YES || do_icmp6 == CONFIG_BOOLEAN_AUTO) {
1070
do_icmp6 = CONFIG_BOOLEAN_YES;
1071
st = rrdset_find_active_localhost("ipv6.icmp");
1072
if (unlikely(!st)) {
@@ -1134,10 +1094,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1094
rrdset_done(st);
1095
}
1096
1137
- if (do_icmp6_redir == CONFIG_BOOLEAN_YES || (do_icmp6_redir == CONFIG_BOOLEAN_AUTO &&
1138
- (icmp6stat.icp6s_inhist[ND_REDIRECT] ||
1139
- icmp6stat.icp6s_outhist[ND_REDIRECT] ||
1140
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1097
+ if (do_icmp6_redir == CONFIG_BOOLEAN_YES || do_icmp6_redir == CONFIG_BOOLEAN_AUTO) {
1098
do_icmp6_redir = CONFIG_BOOLEAN_YES;
1099
st = rrdset_find_active_localhost("ipv6.icmpredir");
1100
if (unlikely(!st)) {
@@ -1165,19 +1122,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1122
rrdset_done(st);
1123
}
1124
1168
- if (do_icmp6_errors == CONFIG_BOOLEAN_YES || (do_icmp6_errors == CONFIG_BOOLEAN_AUTO &&
1169
- (icmp6stat.icp6s_badcode ||
1170
- icmp6stat.icp6s_badlen ||
1171
- icmp6stat.icp6s_checksum ||
1172
- icmp6stat.icp6s_tooshort ||
1173
- icmp6stat.icp6s_error ||
1174
- icmp6stat.icp6s_inhist[ICMP6_DST_UNREACH] ||
1175
- icmp6stat.icp6s_inhist[ICMP6_TIME_EXCEEDED] ||
1176
- icmp6stat.icp6s_inhist[ICMP6_PARAM_PROB] ||
1177
- icmp6stat.icp6s_outhist[ICMP6_DST_UNREACH] ||
1178
- icmp6stat.icp6s_outhist[ICMP6_TIME_EXCEEDED] ||
1179
- icmp6stat.icp6s_outhist[ICMP6_PARAM_PROB] ||
1180
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1125
+ if (do_icmp6_errors == CONFIG_BOOLEAN_YES || do_icmp6_errors == CONFIG_BOOLEAN_AUTO) {
1126
do_icmp6_errors = CONFIG_BOOLEAN_YES;
1127
st = rrdset_find_active_localhost("ipv6.icmperrors");
1128
if (unlikely(!st)) {
@@ -1222,12 +1167,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1167
rrdset_done(st);
1168
}
1169
1225
- if (do_icmp6_echos == CONFIG_BOOLEAN_YES || (do_icmp6_echos == CONFIG_BOOLEAN_AUTO &&
1226
- (icmp6stat.icp6s_inhist[ICMP6_ECHO_REQUEST] ||
1227
- icmp6stat.icp6s_outhist[ICMP6_ECHO_REQUEST] ||
1228
- icmp6stat.icp6s_inhist[ICMP6_ECHO_REPLY] ||
1229
- icmp6stat.icp6s_outhist[ICMP6_ECHO_REPLY] ||
1230
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1170
+ if (do_icmp6_echos == CONFIG_BOOLEAN_YES || do_icmp6_echos == CONFIG_BOOLEAN_AUTO) {
1171
do_icmp6_echos = CONFIG_BOOLEAN_YES;
1172
st = rrdset_find_active_localhost("ipv6.icmpechos");
1173
if (unlikely(!st)) {
@@ -1259,12 +1199,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1199
rrdset_done(st);
1200
}
1201
1262
- if (do_icmp6_router == CONFIG_BOOLEAN_YES || (do_icmp6_router == CONFIG_BOOLEAN_AUTO &&
1263
- (icmp6stat.icp6s_inhist[ND_ROUTER_SOLICIT] ||
1264
- icmp6stat.icp6s_outhist[ND_ROUTER_SOLICIT] ||
1265
- icmp6stat.icp6s_inhist[ND_ROUTER_ADVERT] ||
1266
- icmp6stat.icp6s_outhist[ND_ROUTER_ADVERT] ||
1267
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1202
+ if (do_icmp6_router == CONFIG_BOOLEAN_YES || do_icmp6_router == CONFIG_BOOLEAN_AUTO) {
1203
do_icmp6_router = CONFIG_BOOLEAN_YES;
1204
st = rrdset_find_active_localhost("ipv6.icmprouter");
1205
if (unlikely(!st)) {
@@ -1296,12 +1231,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1231
rrdset_done(st);
1232
}
1233
1299
- if (do_icmp6_neighbor == CONFIG_BOOLEAN_YES || (do_icmp6_neighbor == CONFIG_BOOLEAN_AUTO &&
1300
- (icmp6stat.icp6s_inhist[ND_NEIGHBOR_SOLICIT] ||
1301
- icmp6stat.icp6s_outhist[ND_NEIGHBOR_SOLICIT] ||
1302
- icmp6stat.icp6s_inhist[ND_NEIGHBOR_ADVERT] ||
1303
- icmp6stat.icp6s_outhist[ND_NEIGHBOR_ADVERT] ||
1304
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1234
+ if (do_icmp6_neighbor == CONFIG_BOOLEAN_YES || do_icmp6_neighbor == CONFIG_BOOLEAN_AUTO) {
1235
do_icmp6_neighbor = CONFIG_BOOLEAN_YES;
1236
st = rrdset_find_active_localhost("ipv6.icmpneighbor");
1237
if (unlikely(!st)) {
@@ -1332,18 +1262,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
1262
rrddim_set(st, "OutAdvertisements", icmp6stat.icp6s_outhist[ND_NEIGHBOR_ADVERT]);
1263
}
1264
1335
- if (do_icmp6_types == CONFIG_BOOLEAN_YES || (do_icmp6_types == CONFIG_BOOLEAN_AUTO &&
1336
- (icmp6stat.icp6s_inhist[1] ||
1337
- icmp6stat.icp6s_inhist[128] ||
1338
- icmp6stat.icp6s_inhist[129] ||
1339
- icmp6stat.icp6s_inhist[136] ||
1340
- icmp6stat.icp6s_outhist[1] ||
1341
- icmp6stat.icp6s_outhist[128] ||
1342
- icmp6stat.icp6s_outhist[129] ||
1343
- icmp6stat.icp6s_outhist[133] ||
1344
- icmp6stat.icp6s_outhist[135] ||
1345
- icmp6stat.icp6s_outhist[136] ||
1346
- netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1265
+ if (do_icmp6_types == CONFIG_BOOLEAN_YES || do_icmp6_types == CONFIG_BOOLEAN_AUTO) {
1266
do_icmp6_types = CONFIG_BOOLEAN_YES;
1267
st = rrdset_find_active_localhost("ipv6.icmptypes");
1268
if (unlikely(!st)) {