diff options
-rw-r--r-- | collectors/freebsd.plugin/freebsd_sysctl.c | 20 | ||||
-rw-r--r-- | health/health.d/ram.conf | 4 |
2 files changed, 19 insertions, 5 deletions
diff --git a/collectors/freebsd.plugin/freebsd_sysctl.c b/collectors/freebsd.plugin/freebsd_sysctl.c index 8261fab8ce..da5a351def 100644 --- a/collectors/freebsd.plugin/freebsd_sysctl.c +++ b/collectors/freebsd.plugin/freebsd_sysctl.c @@ -86,6 +86,10 @@ typedef struct __vmmeter vmmeter_t; typedef struct vmmeter vmmeter_t; #endif +#if (__FreeBSD_version >= 1101516 && __FreeBSD_version < 1200000) || __FreeBSD_version >= 1200015 +#define NETDATA_COLLECT_LAUNDRY 1 +#endif + // -------------------------------------------------------------------------------------------------------------------- // FreeBSD plugin initialization @@ -961,7 +965,8 @@ int do_vm_swap_info(int update_every, usec_t dt) { int do_system_ram(int update_every, usec_t dt) { (void)dt; static int mib_active_count[4] = {0, 0, 0, 0}, mib_inactive_count[4] = {0, 0, 0, 0}, mib_wire_count[4] = {0, 0, 0, 0}, - mib_cache_count[4] = {0, 0, 0, 0}, mib_vfs_bufspace[2] = {0, 0}, mib_free_count[4] = {0, 0, 0, 0}; + mib_cache_count[4] = {0, 0, 0, 0}, mib_laundry_count[4] = {0, 0, 0, 0}, mib_vfs_bufspace[2] = {0, 0}, + mib_free_count[4] = {0, 0, 0, 0}; vmmeter_t vmmeter_data; int vfs_bufspace_count; @@ -971,6 +976,9 @@ int do_system_ram(int update_every, usec_t dt) { #if __FreeBSD_version < 1200016 GETSYSCTL_SIMPLE("vm.stats.vm.v_cache_count", mib_cache_count, vmmeter_data.v_cache_count) || #endif +#if defined(NETDATA_COLLECT_LAUNDRY) + GETSYSCTL_SIMPLE("vm.stats.vm.v_laundry_count", mib_laundry_count, vmmeter_data.v_laundry_count) || +#endif GETSYSCTL_SIMPLE("vfs.bufspace", mib_vfs_bufspace, vfs_bufspace_count) || GETSYSCTL_SIMPLE("vm.stats.vm.v_free_count", mib_free_count, vmmeter_data.v_free_count))) { error("DISABLED: system.ram chart"); @@ -981,8 +989,8 @@ int do_system_ram(int update_every, usec_t dt) { // -------------------------------------------------------------------- static RRDSET *st = NULL; - static RRDDIM *rd_free = NULL, *rd_active = NULL, *rd_inactive = NULL, - *rd_wired = NULL, *rd_cache = NULL, *rd_buffers = NULL; + static RRDDIM *rd_free = NULL, *rd_active = NULL, *rd_inactive = NULL, *rd_wired = NULL, + *rd_cache = NULL, *rd_laundry = NULL, *rd_buffers = NULL; if (unlikely(!st)) { st = rrdset_create_localhost( @@ -1007,6 +1015,9 @@ int do_system_ram(int update_every, usec_t dt) { #if __FreeBSD_version < 1200016 rd_cache = rrddim_add(st, "cache", NULL, system_pagesize, MEGA_FACTOR, RRD_ALGORITHM_ABSOLUTE); #endif +#if defined(NETDATA_COLLECT_LAUNDRY) + rd_laundry = rrddim_add(st, "laundry", NULL, system_pagesize, MEGA_FACTOR, RRD_ALGORITHM_ABSOLUTE); +#endif rd_buffers = rrddim_add(st, "buffers", NULL, 1, MEGA_FACTOR, RRD_ALGORITHM_ABSOLUTE); } else rrdset_next(st); @@ -1018,6 +1029,9 @@ int do_system_ram(int update_every, usec_t dt) { #if __FreeBSD_version < 1200016 rrddim_set_by_pointer(st, rd_cache, vmmeter_data.v_cache_count); #endif +#if defined(NETDATA_COLLECT_LAUNDRY) + rrddim_set_by_pointer(st, rd_laundry, vmmeter_data.v_laundry_count); +#endif rrddim_set_by_pointer(st, rd_buffers, vfs_bufspace_count); rrdset_done(st); } diff --git a/health/health.d/ram.conf b/health/health.d/ram.conf index 65f7c9c654..d5a6396b60 100644 --- a/health/health.d/ram.conf +++ b/health/health.d/ram.conf @@ -41,7 +41,7 @@ alarm: ram_in_use on: system.ram os: freebsd hosts: * - calc: ($active + $wired + $buffers - $used_ram_to_ignore) * 100 / ($active + $wired + $buffers - $used_ram_to_ignore + $cache + $free + $inactive) + calc: ($active + $wired + $laundry + $buffers - $used_ram_to_ignore) * 100 / ($active + $wired + $laundry + $buffers - $used_ram_to_ignore + $cache + $free + $inactive) units: % every: 10s warn: $this > (($status >= $WARNING) ? (80) : (90)) @@ -54,7 +54,7 @@ delay: down 15m multiplier 1.5 max 1h on: system.ram os: freebsd hosts: * - calc: ($free + $inactive + $used_ram_to_ignore) * 100 / ($free + $active + $inactive + $wired + $cache + $buffers) + calc: ($free + $inactive + $used_ram_to_ignore) * 100 / ($free + $active + $inactive + $wired + $cache + $laundry + $buffers) units: % every: 10s warn: $this < (($status >= $WARNING) ? ( 5) : (10)) |