summaryrefslogtreecommitdiffstats
path: root/collectors/freebsd.plugin
diff options
context:
space:
mode:
authorVlad Movchan <vladislav.movchan@gmail.com>2018-10-16 15:31:38 +0300
committerCosta Tsaousis <costa@tsaousis.gr>2018-10-16 15:31:38 +0300
commit545d07eb78222a80124e9187e88921013ee403ea (patch)
tree3d4ac9d8a631afa627e06db9a3f1093fc6443853 /collectors/freebsd.plugin
parent6887691fa2ab224241b50729c29c0316bff9ffad (diff)
Account "Laundry" pages as a separate RAM dimension on FreeBSD. (#4390)
Laundry pages are dirty pages queued for laundering. "Laundry" page type was introduces in FreeBSD CURRENT about two years ago and later this was backported to FreeBSD 11 branch.
Diffstat (limited to 'collectors/freebsd.plugin')
-rw-r--r--collectors/freebsd.plugin/freebsd_sysctl.c20
1 files changed, 17 insertions, 3 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);
}