Browse Source

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
Vladimir Kobal 5 years ago
parent
commit
e8d6cde97c

+ 2 - 0
collectors/cgroups.plugin/README.md

@@ -110,6 +110,8 @@ By default, Netdata will enable monitoring metrics only when they are not zero.
 	enable memory (used mem including cache) = yes
 ```
 
+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.
+
 ### alarms
 
 CPU and memory limits are watched and used to rise alarms. Memory usage for every cgroup is checked against `ram` and `ram+swap` limits. CPU usage for every cgroup is checked against `cpuset.cpus` and `cpu.cfs_period_us` + `cpu.cfs_quota_us` pair assigned for the cgroup. Configuration for the alarms is available in `health.d/cgroups.conf` file.

+ 17 - 11
collectors/cgroups.plugin/sys_fs_cgroup.c

@@ -575,7 +575,8 @@ static inline void cgroup_read_cpuacct_stat(struct cpuacct_stat *cp) {
 
         cp->updated = 1;
 
-        if(unlikely(cp->enabled == CONFIG_BOOLEAN_AUTO && (cp->user || cp->system)))
+        if(unlikely(cp->enabled == CONFIG_BOOLEAN_AUTO &&
+                    (cp->user || cp->system || netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES)))
             cp->enabled = CONFIG_BOOLEAN_YES;
     }
 }
@@ -611,7 +612,8 @@ static inline void cgroup2_read_cpuacct_stat(struct cpuacct_stat *cp) {
 
         cp->updated = 1;
 
-        if(unlikely(cp->enabled == CONFIG_BOOLEAN_AUTO && (cp->user || cp->system)))
+        if(unlikely(cp->enabled == CONFIG_BOOLEAN_AUTO &&
+                    (cp->user || cp->system || netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES)))
             cp->enabled = CONFIG_BOOLEAN_YES;
     }
 }
@@ -668,7 +670,8 @@ static inline void cgroup_read_cpuacct_usage(struct cpuacct_usage *ca) {
 
         ca->updated = 1;
 
-        if(unlikely(ca->enabled == CONFIG_BOOLEAN_AUTO && total))
+        if(unlikely(ca->enabled == CONFIG_BOOLEAN_AUTO &&
+                    (total || netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES)))
             ca->enabled = CONFIG_BOOLEAN_YES;
     }
 }
@@ -737,7 +740,7 @@ static inline void cgroup_read_blkio(struct blkio *io) {
         io->updated = 1;
 
         if(unlikely(io->enabled == CONFIG_BOOLEAN_AUTO)) {
-            if(unlikely(io->Read || io->Write))
+            if(unlikely(io->Read || io->Write || netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))
                 io->enabled = CONFIG_BOOLEAN_YES;
             else
                 io->delay_counter = cgroup_recheck_zero_blkio_every_iterations;
@@ -787,7 +790,7 @@ static inline void cgroup2_read_blkio(struct blkio *io, unsigned int word_offset
             io->updated = 1;
 
             if(unlikely(io->enabled == CONFIG_BOOLEAN_AUTO)) {
-                if(unlikely(io->Read || io->Write))
+                if(unlikely(io->Read || io->Write || netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))
                     io->enabled = CONFIG_BOOLEAN_YES;
                 else
                     io->delay_counter = cgroup_recheck_zero_blkio_every_iterations;
@@ -881,7 +884,8 @@ static inline void cgroup_read_memory(struct memory *mem, char parent_cg_is_unif
             if(( (!parent_cg_is_unified) && ( mem->total_cache || mem->total_dirty || mem->total_rss || mem->total_rss_huge || mem->total_mapped_file || mem->total_writeback
                     || mem->total_swap || mem->total_pgpgin || mem->total_pgpgout || mem->total_pgfault || mem->total_pgmajfault))
                || (parent_cg_is_unified && ( mem->anon || mem->total_dirty || mem->kernel_stack || mem->slab || mem->sock || mem->total_writeback
-                    || mem->anon_thp || mem->total_pgfault || mem->total_pgmajfault)))
+                    || mem->anon_thp || mem->total_pgfault || mem->total_pgmajfault))
+               || netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES)
                 mem->enabled_detailed = CONFIG_BOOLEAN_YES;
             else
                 mem->delay_counter_detailed = cgroup_recheck_zero_mem_detailed_every_iterations;
@@ -893,14 +897,16 @@ memory_next:
     // read usage_in_bytes
     if(likely(mem->filename_usage_in_bytes)) {
         mem->updated_usage_in_bytes = !read_single_number_file(mem->filename_usage_in_bytes, &mem->usage_in_bytes);
-        if(unlikely(mem->updated_usage_in_bytes && mem->enabled_usage_in_bytes == CONFIG_BOOLEAN_AUTO && mem->usage_in_bytes))
+        if(unlikely(mem->updated_usage_in_bytes && mem->enabled_usage_in_bytes == CONFIG_BOOLEAN_AUTO &&
+                    (mem->usage_in_bytes || netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES)))
             mem->enabled_usage_in_bytes = CONFIG_BOOLEAN_YES;
     }
 
     // read msw_usage_in_bytes
     if(likely(mem->filename_msw_usage_in_bytes)) {
         mem->updated_msw_usage_in_bytes = !read_single_number_file(mem->filename_msw_usage_in_bytes, &mem->msw_usage_in_bytes);
-        if(unlikely(mem->updated_msw_usage_in_bytes && mem->enabled_msw_usage_in_bytes == CONFIG_BOOLEAN_AUTO && mem->msw_usage_in_bytes))
+        if(unlikely(mem->updated_msw_usage_in_bytes && mem->enabled_msw_usage_in_bytes == CONFIG_BOOLEAN_AUTO &&
+                    (mem->msw_usage_in_bytes || netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES)))
             mem->enabled_msw_usage_in_bytes = CONFIG_BOOLEAN_YES;
     }
 
@@ -913,10 +919,10 @@ memory_next:
         else {
             mem->updated_failcnt = !read_single_number_file(mem->filename_failcnt, &mem->failcnt);
             if(unlikely(mem->updated_failcnt && mem->enabled_failcnt == CONFIG_BOOLEAN_AUTO)) {
-                if(unlikely(!mem->failcnt))
-                    mem->delay_counter_failcnt = cgroup_recheck_zero_mem_failcnt_every_iterations;
-                else
+                if(unlikely(mem->failcnt || netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))
                     mem->enabled_failcnt = CONFIG_BOOLEAN_YES;
+                else
+                    mem->delay_counter_failcnt = cgroup_recheck_zero_mem_failcnt_every_iterations;
             }
         }
     }

+ 1 - 1
collectors/diskspace.plugin/README.md

@@ -10,7 +10,7 @@ Two charts are available for every mount:
 
 Simple patterns can be used to exclude mounts from showed statistics based on path or filesystem. By default read-only mounts are not displayed. To display them `yes` should be set for a chart instead of `auto`.
 
-By default, Netdata will enable monitoring metrics 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). Set `yes` for a chart instead of `auto` to enable it permanently.
+By default, Netdata will enable monitoring metrics 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). Set `yes` for a chart instead of `auto` to enable it 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.
 
 
 ```

+ 6 - 2
collectors/diskspace.plugin/plugin_diskspace.c

@@ -249,7 +249,9 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) {
 
     int rendered = 0;
 
-    if(m->do_space == CONFIG_BOOLEAN_YES || (m->do_space == CONFIG_BOOLEAN_AUTO && (bavail || breserved_root || bused))) {
+    if(m->do_space == CONFIG_BOOLEAN_YES || (m->do_space == CONFIG_BOOLEAN_AUTO &&
+                                             (bavail || breserved_root || bused ||
+                                              netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
         if(unlikely(!m->st_space)) {
             m->do_space = CONFIG_BOOLEAN_YES;
             m->st_space = rrdset_find_bytype_localhost("disk_space", disk);
@@ -289,7 +291,9 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) {
 
     // --------------------------------------------------------------------------
 
-    if(m->do_inodes == CONFIG_BOOLEAN_YES || (m->do_inodes == CONFIG_BOOLEAN_AUTO && (favail || freserved_root || fused))) {
+    if(m->do_inodes == CONFIG_BOOLEAN_YES || (m->do_inodes == CONFIG_BOOLEAN_AUTO &&
+                                              (favail || freserved_root || fused ||
+                                               netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
         if(unlikely(!m->st_inodes)) {
             m->do_inodes = CONFIG_BOOLEAN_YES;
             m->st_inodes = rrdset_find_bytype_localhost("disk_inodes", disk);

+ 2 - 0
collectors/freebsd.plugin/README.md

@@ -2,4 +2,6 @@
 
 Collects resource usage and performance data on FreeBSD 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%2Ffreebsd.plugin%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()

+ 17 - 8
collectors/freebsd.plugin/freebsd_devstat.c

@@ -352,7 +352,8 @@ int do_kern_devstat(int update_every, usec_t dt) {
                         if(dm->do_io == CONFIG_BOOLEAN_YES || (dm->do_io == CONFIG_BOOLEAN_AUTO &&
                                                                (dstat[i].bytes[DEVSTAT_READ] ||
                                                                 dstat[i].bytes[DEVSTAT_WRITE] ||
-                                                                dstat[i].bytes[DEVSTAT_FREE]))) {
+                                                                dstat[i].bytes[DEVSTAT_FREE] ||
+                                                                netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                             if (unlikely(!dm->st_io)) {
                                 dm->st_io = rrdset_create_localhost("disk",
                                                                     disk,
@@ -389,7 +390,8 @@ int do_kern_devstat(int update_every, usec_t dt) {
                                                                 (dstat[i].operations[DEVSTAT_READ] ||
                                                                  dstat[i].operations[DEVSTAT_WRITE] ||
                                                                  dstat[i].operations[DEVSTAT_NO_DATA] ||
-                                                                 dstat[i].operations[DEVSTAT_FREE]))) {
+                                                                 dstat[i].operations[DEVSTAT_FREE] ||
+                                                                 netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                             if (unlikely(!dm->st_ops)) {
                                 dm->st_ops = rrdset_create_localhost("disk_ops",
                                                                      disk,
@@ -428,7 +430,9 @@ int do_kern_devstat(int update_every, usec_t dt) {
                         // --------------------------------------------------------------------
 
                         if(dm->do_qops == CONFIG_BOOLEAN_YES || (dm->do_qops == CONFIG_BOOLEAN_AUTO &&
-                                                                 (dstat[i].start_count || dstat[i].end_count))) {
+                                                                 (dstat[i].start_count ||
+                                                                  dstat[i].end_count ||
+                                                                  netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                             if (unlikely(!dm->st_qops)) {
                                 dm->st_qops = rrdset_create_localhost("disk_qops",
                                                                       disk,
@@ -457,7 +461,8 @@ int do_kern_devstat(int update_every, usec_t dt) {
                         // --------------------------------------------------------------------
 
                         if(dm->do_util == CONFIG_BOOLEAN_YES || (dm->do_util == CONFIG_BOOLEAN_AUTO &&
-                                                                 cur_dstat.busy_time_ms)) {
+                                                                 (cur_dstat.busy_time_ms ||
+                                                                  netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                             if (unlikely(!dm->st_util)) {
                                 dm->st_util = rrdset_create_localhost("disk_util",
                                                                       disk,
@@ -490,7 +495,8 @@ int do_kern_devstat(int update_every, usec_t dt) {
                                                                    (cur_dstat.duration_read_ms ||
                                                                     cur_dstat.duration_write_ms ||
                                                                     cur_dstat.duration_other_ms ||
-                                                                    cur_dstat.duration_free_ms))) {
+                                                                    cur_dstat.duration_free_ms ||
+                                                                    netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                             if (unlikely(!dm->st_iotime)) {
                                 dm->st_iotime = rrdset_create_localhost("disk_iotime",
                                                                         disk,
@@ -538,7 +544,8 @@ int do_kern_devstat(int update_every, usec_t dt) {
                                                                       (dstat[i].operations[DEVSTAT_READ] ||
                                                                        dstat[i].operations[DEVSTAT_WRITE] ||
                                                                        dstat[i].operations[DEVSTAT_NO_DATA] ||
-                                                                       dstat[i].operations[DEVSTAT_FREE]))) {
+                                                                       dstat[i].operations[DEVSTAT_FREE] ||
+                                                                       netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                                 if (unlikely(!dm->st_await)) {
                                     dm->st_await = rrdset_create_localhost("disk_await",
                                                                            disk,
@@ -603,7 +610,8 @@ int do_kern_devstat(int update_every, usec_t dt) {
                             if(dm->do_avagsz == CONFIG_BOOLEAN_YES || (dm->do_avagsz == CONFIG_BOOLEAN_AUTO &&
                                                                        (dstat[i].operations[DEVSTAT_READ] ||
                                                                         dstat[i].operations[DEVSTAT_WRITE] ||
-                                                                        dstat[i].operations[DEVSTAT_FREE]))) {
+                                                                        dstat[i].operations[DEVSTAT_FREE] ||
+                                                                        netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                                 if (unlikely(!dm->st_avagsz)) {
                                     dm->st_avagsz = rrdset_create_localhost("disk_avgsz",
                                                                             disk,
@@ -660,7 +668,8 @@ int do_kern_devstat(int update_every, usec_t dt) {
                                                                       (dstat[i].operations[DEVSTAT_READ] ||
                                                                        dstat[i].operations[DEVSTAT_WRITE] ||
                                                                        dstat[i].operations[DEVSTAT_NO_DATA] ||
-                                                                       dstat[i].operations[DEVSTAT_FREE]))) {
+                                                                       dstat[i].operations[DEVSTAT_FREE] ||
+                                                                       netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                                 if (unlikely(!dm->st_svctm)) {
                                     dm->st_svctm = rrdset_create_localhost("disk_svctm",
                                                                            disk,

+ 17 - 8
collectors/freebsd.plugin/freebsd_getifaddrs.c

@@ -440,7 +440,9 @@ int do_getifaddrs(int update_every, usec_t dt) {
                 // --------------------------------------------------------------------
 
                 if (ifm->do_bandwidth == CONFIG_BOOLEAN_YES || (ifm->do_bandwidth == CONFIG_BOOLEAN_AUTO &&
-                                                                (IFA_DATA(ibytes) || IFA_DATA(obytes)))) {
+                                                                (IFA_DATA(ibytes) ||
+                                                                 IFA_DATA(obytes) ||
+                                                                 netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                     if (unlikely(!ifm->st_bandwidth)) {
                         ifm->st_bandwidth = rrdset_create_localhost("net",
                                                                     ifa->ifa_name,
@@ -469,7 +471,11 @@ int do_getifaddrs(int update_every, usec_t dt) {
                 // --------------------------------------------------------------------
 
                 if (ifm->do_packets == CONFIG_BOOLEAN_YES || (ifm->do_packets == CONFIG_BOOLEAN_AUTO &&
-                                                              (IFA_DATA(ipackets) || IFA_DATA(opackets) || IFA_DATA(imcasts) || IFA_DATA(omcasts)))) {
+                                                              (IFA_DATA(ipackets) ||
+                                                               IFA_DATA(opackets) ||
+                                                               IFA_DATA(imcasts) ||
+                                                               IFA_DATA(omcasts) ||
+                                                               netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                     if (unlikely(!ifm->st_packets)) {
                         ifm->st_packets = rrdset_create_localhost("net_packets",
                                                                   ifa->ifa_name,
@@ -508,7 +514,9 @@ int do_getifaddrs(int update_every, usec_t dt) {
                 // --------------------------------------------------------------------
 
                 if (ifm->do_errors == CONFIG_BOOLEAN_YES || (ifm->do_errors == CONFIG_BOOLEAN_AUTO &&
-                                                             (IFA_DATA(ierrors) || IFA_DATA(oerrors)))) {
+                                                             (IFA_DATA(ierrors) ||
+                                                              IFA_DATA(oerrors) ||
+                                                              netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                     if (unlikely(!ifm->st_errors)) {
                         ifm->st_errors = rrdset_create_localhost("net_errors",
                                                                  ifa->ifa_name,
@@ -538,11 +546,11 @@ int do_getifaddrs(int update_every, usec_t dt) {
                 // --------------------------------------------------------------------
 
                 if (ifm->do_drops == CONFIG_BOOLEAN_YES || (ifm->do_drops == CONFIG_BOOLEAN_AUTO &&
-                                                            (IFA_DATA(iqdrops)
+                                                            (IFA_DATA(iqdrops) ||
                                                              #if __FreeBSD__ >= 11
-                                                             || IFA_DATA(oqdrops)
-#endif
-                ))) {
+                                                             IFA_DATA(oqdrops) ||
+                                                             #endif
+                                                             netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                     if (unlikely(!ifm->st_drops)) {
                         ifm->st_drops = rrdset_create_localhost("net_drops",
                                                                 ifa->ifa_name,
@@ -577,7 +585,8 @@ int do_getifaddrs(int update_every, usec_t dt) {
                 // --------------------------------------------------------------------
 
                 if (ifm->do_events == CONFIG_BOOLEAN_YES || (ifm->do_events == CONFIG_BOOLEAN_AUTO &&
-                                                             IFA_DATA(collisions))) {
+                                                             (IFA_DATA(collisions) ||
+                                                              netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                     if (unlikely(!ifm->st_events)) {
                         ifm->st_events = rrdset_create_localhost("net_events",
                                                                  ifa->ifa_name,

+ 6 - 2
collectors/freebsd.plugin/freebsd_getmntinfo.c

@@ -216,7 +216,9 @@ int do_getmntinfo(int update_every, usec_t dt) {
 
                 int rendered = 0;
 
-                if (m->do_space == CONFIG_BOOLEAN_YES || (m->do_space == CONFIG_BOOLEAN_AUTO && (mntbuf[i].f_blocks > 2))) {
+                if (m->do_space == CONFIG_BOOLEAN_YES || (m->do_space == CONFIG_BOOLEAN_AUTO &&
+                                                          (mntbuf[i].f_blocks > 2 ||
+                                                           netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                     if (unlikely(!m->st_space)) {
                         snprintfz(title, 4096, "Disk Space Usage for %s [%s]",
                                   mntbuf[i].f_mntonname, mntbuf[i].f_mntfromname);
@@ -255,7 +257,9 @@ int do_getmntinfo(int update_every, usec_t dt) {
 
                 // --------------------------------------------------------------------------
 
-                if (m->do_inodes == CONFIG_BOOLEAN_YES || (m->do_inodes == CONFIG_BOOLEAN_AUTO && (mntbuf[i].f_files > 1))) {
+                if (m->do_inodes == CONFIG_BOOLEAN_YES || (m->do_inodes == CONFIG_BOOLEAN_AUTO &&
+                                                           (mntbuf[i].f_files > 1 ||
+                                                            netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                     if (unlikely(!m->st_inodes)) {
                         snprintfz(title, 4096, "Disk Files (inodes) Usage for %s [%s]",
                                   mntbuf[i].f_mntonname, mntbuf[i].f_mntfromname);

+ 99 - 61
collectors/freebsd.plugin/freebsd_sysctl.c

@@ -1941,7 +1941,13 @@ int do_net_inet_tcp_stats(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 || tcpstat.tcps_finwait2_drops))) {
+            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 ||
+                                                                tcpstat.tcps_finwait2_drops ||
+                                                                netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                 do_tcpext_connaborts = CONFIG_BOOLEAN_YES;
 
                 static RRDSET *st = NULL;
@@ -1982,7 +1988,9 @@ int do_net_inet_tcp_stats(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;
 
                 static RRDSET *st = NULL;
@@ -2014,7 +2022,11 @@ int do_net_inet_tcp_stats(int update_every, usec_t dt) {
 
             // --------------------------------------------------------------------
 
-            if (do_tcpext_syncookies == CONFIG_BOOLEAN_YES || (do_tcpext_syncookies == CONFIG_BOOLEAN_AUTO && (tcpstat.tcps_sc_sendcookie || tcpstat.tcps_sc_recvcookie || tcpstat.tcps_sc_zonefail))) {
+            if (do_tcpext_syncookies == CONFIG_BOOLEAN_YES || (do_tcpext_syncookies == CONFIG_BOOLEAN_AUTO &&
+                                                               (tcpstat.tcps_sc_sendcookie ||
+                                                                tcpstat.tcps_sc_recvcookie ||
+                                                                tcpstat.tcps_sc_zonefail ||
+                                                                netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                 do_tcpext_syncookies = CONFIG_BOOLEAN_YES;
 
                 static RRDSET *st = NULL;
@@ -2050,7 +2062,9 @@ int do_net_inet_tcp_stats(int update_every, usec_t dt) {
 
             // --------------------------------------------------------------------
 
-            if(do_tcpext_listen == CONFIG_BOOLEAN_YES || (do_tcpext_listen == CONFIG_BOOLEAN_AUTO && tcpstat.tcps_listendrop)) {
+            if(do_tcpext_listen == CONFIG_BOOLEAN_YES || (do_tcpext_listen == CONFIG_BOOLEAN_AUTO &&
+                                                          (tcpstat.tcps_listendrop ||
+                                                           netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                 do_tcpext_listen = CONFIG_BOOLEAN_YES;
 
                 static RRDSET *st_listen = NULL;
@@ -2085,7 +2099,11 @@ int do_net_inet_tcp_stats(int update_every, usec_t dt) {
 
             // --------------------------------------------------------------------
 
-            if (do_ecn == CONFIG_BOOLEAN_YES || (do_ecn == CONFIG_BOOLEAN_AUTO && (tcpstat.tcps_ecn_ce || tcpstat.tcps_ecn_ect0 || tcpstat.tcps_ecn_ect1))) {
+            if (do_ecn == CONFIG_BOOLEAN_YES || (do_ecn == CONFIG_BOOLEAN_AUTO &&
+                                                 (tcpstat.tcps_ecn_ce ||
+                                                  tcpstat.tcps_ecn_ect0 ||
+                                                  tcpstat.tcps_ecn_ect1 ||
+                                                  netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
                 do_ecn = CONFIG_BOOLEAN_YES;
 
                 static RRDSET *st = NULL;
@@ -2626,8 +2644,11 @@ int do_net_inet6_ip6_stats(int update_every, usec_t dt) {
             // --------------------------------------------------------------------
 
             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;
 
                 static RRDSET *st = NULL;
@@ -2666,8 +2687,10 @@ int do_net_inet6_ip6_stats(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;
 
                 static RRDSET *st = NULL;
@@ -2706,8 +2729,11 @@ int do_net_inet6_ip6_stats(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;
 
                 static RRDSET *st = NULL;
@@ -2747,16 +2773,17 @@ int do_net_inet6_ip6_stats(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;
 
                 static RRDSET *st = NULL;
@@ -2872,7 +2899,10 @@ int do_net_inet6_icmp6_stats(int update_every, usec_t dt) {
 
             // --------------------------------------------------------------------
 
-            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;
 
                 static RRDSET *st = NULL;
@@ -2907,7 +2937,10 @@ int do_net_inet6_icmp6_stats(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;
 
                 static RRDSET *st = NULL;
@@ -2941,18 +2974,19 @@ int do_net_inet6_icmp6_stats(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;
 
                 static RRDSET *st = NULL;
@@ -3005,11 +3039,12 @@ int do_net_inet6_icmp6_stats(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;
 
                 static RRDSET *st = NULL;
@@ -3047,11 +3082,12 @@ int do_net_inet6_icmp6_stats(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;
 
                 static RRDSET *st = NULL;
@@ -3090,11 +3126,12 @@ int do_net_inet6_icmp6_stats(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;
 
                 static RRDSET *st = NULL;
@@ -3133,17 +3170,18 @@ int do_net_inet6_icmp6_stats(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;
 
                 static RRDSET *st = NULL;

+ 2 - 0
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)]()

Some files were not shown because too many files changed in this diff