summaryrefslogtreecommitdiffstats
path: root/collectors/macos.plugin
diff options
context:
space:
mode:
authorVladimir Kobal <vlad@prokk.net>2019-07-12 15:45:35 +0300
committerGitHub <noreply@github.com>2019-07-12 15:45:35 +0300
commite8d6cde97c0bad7c598a3cc04c45603f0c942992 (patch)
tree6937fa6536d19327bb6add153eea6e1cb0755740 /collectors/macos.plugin
parentfecc659376d67f66f483799929eeb962d7b5abd2 (diff)
Add global configuration option for zero metrics (#6419)
* Add global configuration option for zero metrics * Add the option to the cgroup plugin * Add the option to the proc plugin (diskstats, meminfo, net_dev, netstat, sctp_snmp, snmp, snmp6, sockstat, sockstat6, synproxy, vmstat, system_edac_mc, system_node, btrfs, ksm, zfs) * Add the option to the macos plugin * Add the option to the freebsd plugin (devstat, getifaddrs, getmntinfo, sysctl) * Change the option behaviour with the 'auto' value * Add the option to the tc plugin * Update the documentation
Diffstat (limited to 'collectors/macos.plugin')
-rw-r--r--collectors/macos.plugin/README.md2
-rw-r--r--collectors/macos.plugin/macos_sysctl.c154
2 files changed, 96 insertions, 60 deletions
diff --git a/collectors/macos.plugin/README.md b/collectors/macos.plugin/README.md
index 3e2554e478..fcb4670eae 100644
--- a/collectors/macos.plugin/README.md
+++ b/collectors/macos.plugin/README.md
@@ -2,4 +2,6 @@
Collects resource usage and performance data on MacOS systems
+By default, Netdata will enable monitoring metrics for disks, memory, and network only when they are not zero. If they are constantly zero they are ignored. Metrics that will start having values, after netdata is started, will be detected and charts will be automatically added to the dashboard (a refresh of the dashboard is needed for them to appear though). Use `yes` instead of `auto` in plugin configuration sections to enable these charts permanently. You can also set the `enable zero metrics` option to `yes` in the `[global]` section which enables charts with zero metrics for all internal Netdata plugins.
+
[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fmacos.plugin%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/macos.plugin/macos_sysctl.c b/collectors/macos.plugin/macos_sysctl.c
index a8af72e694..dddafc9f51 100644
--- a/collectors/macos.plugin/macos_sysctl.c
+++ b/collectors/macos.plugin/macos_sysctl.c
@@ -479,7 +479,12 @@ int do_macos_sysctl(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if (do_tcpext_connaborts == CONFIG_BOOLEAN_YES || (do_tcpext_connaborts == CONFIG_BOOLEAN_AUTO && (tcpstat.tcps_rcvpackafterwin || tcpstat.tcps_rcvafterclose || tcpstat.tcps_rcvmemdrop || tcpstat.tcps_persistdrop))) {
+ if (do_tcpext_connaborts == CONFIG_BOOLEAN_YES || (do_tcpext_connaborts == CONFIG_BOOLEAN_AUTO &&
+ (tcpstat.tcps_rcvpackafterwin ||
+ tcpstat.tcps_rcvafterclose ||
+ tcpstat.tcps_rcvmemdrop ||
+ tcpstat.tcps_persistdrop ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
do_tcpext_connaborts = CONFIG_BOOLEAN_YES;
st = rrdset_find_localhost("ipv4.tcpconnaborts");
if (unlikely(!st)) {
@@ -514,7 +519,9 @@ int do_macos_sysctl(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if (do_tcpext_ofo == CONFIG_BOOLEAN_YES || (do_tcpext_ofo == CONFIG_BOOLEAN_AUTO && tcpstat.tcps_rcvoopack)) {
+ if (do_tcpext_ofo == CONFIG_BOOLEAN_YES || (do_tcpext_ofo == CONFIG_BOOLEAN_AUTO &&
+ (tcpstat.tcps_rcvoopack ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
do_tcpext_ofo = CONFIG_BOOLEAN_YES;
st = rrdset_find_localhost("ipv4.tcpofo");
if (unlikely(!st)) {
@@ -543,7 +550,11 @@ int do_macos_sysctl(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if (do_tcpext_syscookies == CONFIG_BOOLEAN_YES || (do_tcpext_syscookies == CONFIG_BOOLEAN_AUTO && (tcpstat.tcps_sc_sendcookie || tcpstat.tcps_sc_recvcookie || tcpstat.tcps_sc_zonefail))) {
+ if (do_tcpext_syscookies == CONFIG_BOOLEAN_YES || (do_tcpext_syscookies == CONFIG_BOOLEAN_AUTO &&
+ (tcpstat.tcps_sc_sendcookie ||
+ tcpstat.tcps_sc_recvcookie ||
+ tcpstat.tcps_sc_zonefail ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
do_tcpext_syscookies = CONFIG_BOOLEAN_YES;
st = rrdset_find_localhost("ipv4.tcpsyncookies");
@@ -579,7 +590,10 @@ int do_macos_sysctl(int update_every, usec_t dt) {
#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
- if (do_ecn == CONFIG_BOOLEAN_YES || (do_ecn == CONFIG_BOOLEAN_AUTO && (tcpstat.tcps_ecn_recv_ce || tcpstat.tcps_ecn_not_supported))) {
+ if (do_ecn == CONFIG_BOOLEAN_YES || (do_ecn == CONFIG_BOOLEAN_AUTO &&
+ (tcpstat.tcps_ecn_recv_ce ||
+ tcpstat.tcps_ecn_not_supported ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
do_ecn = CONFIG_BOOLEAN_YES;
st = rrdset_find_localhost("ipv4.ecnpkts");
if (unlikely(!st)) {
@@ -980,8 +994,11 @@ int do_macos_sysctl(int update_every, usec_t dt) {
error("DISABLED: ipv6.errors");
} else {
if (do_ip6_packets == CONFIG_BOOLEAN_YES || (do_ip6_packets == CONFIG_BOOLEAN_AUTO &&
- (ip6stat.ip6s_localout || ip6stat.ip6s_total ||
- ip6stat.ip6s_forward || ip6stat.ip6s_delivered))) {
+ (ip6stat.ip6s_localout ||
+ ip6stat.ip6s_total ||
+ ip6stat.ip6s_forward ||
+ ip6stat.ip6s_delivered ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
do_ip6_packets = CONFIG_BOOLEAN_YES;
st = rrdset_find_localhost("ipv6.packets");
if (unlikely(!st)) {
@@ -1017,8 +1034,10 @@ int do_macos_sysctl(int update_every, usec_t dt) {
// --------------------------------------------------------------------
if (do_ip6_fragsout == CONFIG_BOOLEAN_YES || (do_ip6_fragsout == CONFIG_BOOLEAN_AUTO &&
- (ip6stat.ip6s_fragmented || ip6stat.ip6s_cantfrag ||
- ip6stat.ip6s_ofragments))) {
+ (ip6stat.ip6s_fragmented ||
+ ip6stat.ip6s_cantfrag ||
+ ip6stat.ip6s_ofragments ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
do_ip6_fragsout = CONFIG_BOOLEAN_YES;
st = rrdset_find_localhost("ipv6.fragsout");
if (unlikely(!st)) {
@@ -1053,8 +1072,11 @@ int do_macos_sysctl(int update_every, usec_t dt) {
// --------------------------------------------------------------------
if (do_ip6_fragsin == CONFIG_BOOLEAN_YES || (do_ip6_fragsin == CONFIG_BOOLEAN_AUTO &&
- (ip6stat.ip6s_reassembled || ip6stat.ip6s_fragdropped ||
- ip6stat.ip6s_fragtimeout || ip6stat.ip6s_fragments))) {
+ (ip6stat.ip6s_reassembled ||
+ ip6stat.ip6s_fragdropped ||
+ ip6stat.ip6s_fragtimeout ||
+ ip6stat.ip6s_fragments ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
do_ip6_fragsin = CONFIG_BOOLEAN_YES;
st = rrdset_find_localhost("ipv6.fragsin");
if (unlikely(!st)) {
@@ -1090,16 +1112,17 @@ int do_macos_sysctl(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if (do_ip6_errors == CONFIG_BOOLEAN_YES || (do_ip6_errors == CONFIG_BOOLEAN_AUTO && (
- ip6stat.ip6s_toosmall ||
- ip6stat.ip6s_odropped ||
- ip6stat.ip6s_badoptions ||
- ip6stat.ip6s_badvers ||
- ip6stat.ip6s_exthdrtoolong ||
- ip6stat.ip6s_sources_none ||
- ip6stat.ip6s_tooshort ||
- ip6stat.ip6s_cantforward ||
- ip6stat.ip6s_noroute))) {
+ if (do_ip6_errors == CONFIG_BOOLEAN_YES || (do_ip6_errors == CONFIG_BOOLEAN_AUTO &&
+ (ip6stat.ip6s_toosmall ||
+ ip6stat.ip6s_odropped ||
+ ip6stat.ip6s_badoptions ||
+ ip6stat.ip6s_badvers ||
+ ip6stat.ip6s_exthdrtoolong ||
+ ip6stat.ip6s_sources_none ||
+ ip6stat.ip6s_tooshort ||
+ ip6stat.ip6s_cantforward ||
+ ip6stat.ip6s_noroute ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
do_ip6_errors = CONFIG_BOOLEAN_YES;
st = rrdset_find_localhost("ipv6.errors");
if (unlikely(!st)) {
@@ -1158,7 +1181,10 @@ int do_macos_sysctl(int update_every, usec_t dt) {
icmp6_total.msgs_out += icmp6stat.icp6s_outhist[i];
}
icmp6_total.msgs_in += icmp6stat.icp6s_badcode + icmp6stat.icp6s_badlen + icmp6stat.icp6s_checksum + icmp6stat.icp6s_tooshort;
- if (do_icmp6 == CONFIG_BOOLEAN_YES || (do_icmp6 == CONFIG_BOOLEAN_AUTO && (icmp6_total.msgs_in || icmp6_total.msgs_out))) {
+ if (do_icmp6 == CONFIG_BOOLEAN_YES || (do_icmp6 == CONFIG_BOOLEAN_AUTO &&
+ (icmp6_total.msgs_in ||
+ icmp6_total.msgs_out ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
do_icmp6 = CONFIG_BOOLEAN_YES;
st = rrdset_find_localhost("ipv6.icmp");
if (unlikely(!st)) {
@@ -1189,7 +1215,10 @@ int do_macos_sysctl(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if (do_icmp6_redir == CONFIG_BOOLEAN_YES || (do_icmp6_redir == CONFIG_BOOLEAN_AUTO && (icmp6stat.icp6s_inhist[ND_REDIRECT] || icmp6stat.icp6s_outhist[ND_REDIRECT]))) {
+ if (do_icmp6_redir == CONFIG_BOOLEAN_YES || (do_icmp6_redir == CONFIG_BOOLEAN_AUTO &&
+ (icmp6stat.icp6s_inhist[ND_REDIRECT] ||
+ icmp6stat.icp6s_outhist[ND_REDIRECT] ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
do_icmp6_redir = CONFIG_BOOLEAN_YES;
st = rrdset_find_localhost("ipv6.icmpredir");
if (unlikely(!st)) {
@@ -1220,18 +1249,19 @@ int do_macos_sysctl(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if (do_icmp6_errors == CONFIG_BOOLEAN_YES || (do_icmp6_errors == CONFIG_BOOLEAN_AUTO && (
- icmp6stat.icp6s_badcode ||
- icmp6stat.icp6s_badlen ||
- icmp6stat.icp6s_checksum ||
- icmp6stat.icp6s_tooshort ||
- icmp6stat.icp6s_error ||
- icmp6stat.icp6s_inhist[ICMP6_DST_UNREACH] ||
- icmp6stat.icp6s_inhist[ICMP6_TIME_EXCEEDED] ||
- icmp6stat.icp6s_inhist[ICMP6_PARAM_PROB] ||
- icmp6stat.icp6s_outhist[ICMP6_DST_UNREACH] ||
- icmp6stat.icp6s_outhist[ICMP6_TIME_EXCEEDED] ||
- icmp6stat.icp6s_outhist[ICMP6_PARAM_PROB]))) {
+ if (do_icmp6_errors == CONFIG_BOOLEAN_YES || (do_icmp6_errors == CONFIG_BOOLEAN_AUTO &&
+ (icmp6stat.icp6s_badcode ||
+ icmp6stat.icp6s_badlen ||
+ icmp6stat.icp6s_checksum ||
+ icmp6stat.icp6s_tooshort ||
+ icmp6stat.icp6s_error ||
+ icmp6stat.icp6s_inhist[ICMP6_DST_UNREACH] ||
+ icmp6stat.icp6s_inhist[ICMP6_TIME_EXCEEDED] ||
+ icmp6stat.icp6s_inhist[ICMP6_PARAM_PROB] ||
+ icmp6stat.icp6s_outhist[ICMP6_DST_UNREACH] ||
+ icmp6stat.icp6s_outhist[ICMP6_TIME_EXCEEDED] ||
+ icmp6stat.icp6s_outhist[ICMP6_PARAM_PROB] ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
do_icmp6_errors = CONFIG_BOOLEAN_YES;
st = rrdset_find_localhost("ipv6.icmperrors");
if (unlikely(!st)) {
@@ -1279,11 +1309,12 @@ int do_macos_sysctl(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if (do_icmp6_echos == CONFIG_BOOLEAN_YES || (do_icmp6_echos == CONFIG_BOOLEAN_AUTO && (
- icmp6stat.icp6s_inhist[ICMP6_ECHO_REQUEST] ||
- icmp6stat.icp6s_outhist[ICMP6_ECHO_REQUEST] ||
- icmp6stat.icp6s_inhist[ICMP6_ECHO_REPLY] ||
- icmp6stat.icp6s_outhist[ICMP6_ECHO_REPLY]))) {
+ if (do_icmp6_echos == CONFIG_BOOLEAN_YES || (do_icmp6_echos == CONFIG_BOOLEAN_AUTO &&
+ (icmp6stat.icp6s_inhist[ICMP6_ECHO_REQUEST] ||
+ icmp6stat.icp6s_outhist[ICMP6_ECHO_REQUEST] ||
+ icmp6stat.icp6s_inhist[ICMP6_ECHO_REPLY] ||
+ icmp6stat.icp6s_outhist[ICMP6_ECHO_REPLY] ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
do_icmp6_echos = CONFIG_BOOLEAN_YES;
st = rrdset_find_localhost("ipv6.icmpechos");
if (unlikely(!st)) {
@@ -1318,11 +1349,12 @@ int do_macos_sysctl(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if (do_icmp6_router == CONFIG_BOOLEAN_YES || (do_icmp6_router == CONFIG_BOOLEAN_AUTO && (
- icmp6stat.icp6s_inhist[ND_ROUTER_SOLICIT] ||
- icmp6stat.icp6s_outhist[ND_ROUTER_SOLICIT] ||
- icmp6stat.icp6s_inhist[ND_ROUTER_ADVERT] ||
- icmp6stat.icp6s_outhist[ND_ROUTER_ADVERT]))) {
+ if (do_icmp6_router == CONFIG_BOOLEAN_YES || (do_icmp6_router == CONFIG_BOOLEAN_AUTO &&
+ (icmp6stat.icp6s_inhist[ND_ROUTER_SOLICIT] ||
+ icmp6stat.icp6s_outhist[ND_ROUTER_SOLICIT] ||
+ icmp6stat.icp6s_inhist[ND_ROUTER_ADVERT] ||
+ icmp6stat.icp6s_outhist[ND_ROUTER_ADVERT] ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
do_icmp6_router = CONFIG_BOOLEAN_YES;
st = rrdset_find_localhost("ipv6.icmprouter");
if (unlikely(!st)) {
@@ -1357,11 +1389,12 @@ int do_macos_sysctl(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if (do_icmp6_neighbor == CONFIG_BOOLEAN_YES || (do_icmp6_neighbor == CONFIG_BOOLEAN_AUTO && (
- icmp6stat.icp6s_inhist[ND_NEIGHBOR_SOLICIT] ||
- icmp6stat.icp6s_outhist[ND_NEIGHBOR_SOLICIT] ||
- icmp6stat.icp6s_inhist[ND_NEIGHBOR_ADVERT] ||
- icmp6stat.icp6s_outhist[ND_NEIGHBOR_ADVERT]))) {
+ if (do_icmp6_neighbor == CONFIG_BOOLEAN_YES || (do_icmp6_neighbor == CONFIG_BOOLEAN_AUTO &&
+ (icmp6stat.icp6s_inhist[ND_NEIGHBOR_SOLICIT] ||
+ icmp6stat.icp6s_outhist[ND_NEIGHBOR_SOLICIT] ||
+ icmp6stat.icp6s_inhist[ND_NEIGHBOR_ADVERT] ||
+ icmp6stat.icp6s_outhist[ND_NEIGHBOR_ADVERT] ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
do_icmp6_neighbor = CONFIG_BOOLEAN_YES;
st = rrdset_find_localhost("ipv6.icmpneighbor");
if (unlikely(!st)) {
@@ -1396,17 +1429,18 @@ int do_macos_sysctl(int update_every, usec_t dt) {
// --------------------------------------------------------------------
- if (do_icmp6_types == CONFIG_BOOLEAN_YES || (do_icmp6_types == CONFIG_BOOLEAN_AUTO && (
- icmp6stat.icp6s_inhist[1] ||
- icmp6stat.icp6s_inhist[128] ||
- icmp6stat.icp6s_inhist[129] ||
- icmp6stat.icp6s_inhist[136] ||
- icmp6stat.icp6s_outhist[1] ||
- icmp6stat.icp6s_outhist[128] ||
- icmp6stat.icp6s_outhist[129] ||
- icmp6stat.icp6s_outhist[133] ||
- icmp6stat.icp6s_outhist[135] ||
- icmp6stat.icp6s_outhist[136]))) {
+ if (do_icmp6_types == CONFIG_BOOLEAN_YES || (do_icmp6_types == CONFIG_BOOLEAN_AUTO &&
+ (icmp6stat.icp6s_inhist[1] ||
+ icmp6stat.icp6s_inhist[128] ||
+ icmp6stat.icp6s_inhist[129] ||
+ icmp6stat.icp6s_inhist[136] ||
+ icmp6stat.icp6s_outhist[1] ||
+ icmp6stat.icp6s_outhist[128] ||
+ icmp6stat.icp6s_outhist[129] ||
+ icmp6stat.icp6s_outhist[133] ||
+ icmp6stat.icp6s_outhist[135] ||
+ icmp6stat.icp6s_outhist[136] ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
do_icmp6_types = CONFIG_BOOLEAN_YES;
st = rrdset_find_localhost("ipv6.icmptypes");
if (unlikely(!st)) {