File ganglia-0025-Report-the-Linux-specific-slab-memory-metric.patch of Package ganglia

From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= <anders.f.bjorklund@gmail.com>
Date: Sat, 3 Feb 2018 15:32:38 +0100
Git-commit: c245a5a775cd327d69782fb65536cf037c7873e5
References: bsc#1087487
Subject: [PATCH] Report the Linux-specific slab memory metric

According to later versions of procps, the top(1) value for "buff/cache"
memory is supposed in addition to Buffers/Cached to also include Slab.

Interestingly, the biggest impact of this is in the "used" memory shown
since that value is not reported but just calculated using the others:

// {"Cached",       &kb_page_cache},
kb_main_cached = kb_page_cache + kb_slab;
kb_swap_used = kb_swap_total - kb_swap_free;
kb_main_used = kb_main_total - kb_main_free - kb_main_cached - kb_main_buffers;

In order to have more accurate memory reporting on Linux, make sure to
include this metric in the default configuration for the memory module.
Acked-by: John Jolly <jjolly@suse.de>
---
 lib/default_conf.h.in | 13 +++++++++++++
 lib/libgmond.c        |  3 +++
 2 files changed, 16 insertions(+)

diff --git a/lib/default_conf.h.in b/lib/default_conf.h.in
index 568c246f..44f87ce7 100644
--- a/lib/default_conf.h.in
+++ b/lib/default_conf.h.in
@@ -410,6 +410,19 @@ include (\"" SYSCONFDIR "/conf.d/*.conf\")\n\
 \n\
 "
 
+#define LINUX_SPECIFIC_CONFIGURATION "\
+collection_group {\n\
+  collect_every = 40\n\
+  time_threshold = 180\n\
+  metric {\n\
+    name = \"mem_slab\"\n\
+    value_threshold = \"1024.0\"\n\
+    title = \"Slab Memory\"\n\
+  }\n\
+}\n\
+\n\
+"
+
 #define SOLARIS_SPECIFIC_CONFIGURATION "\
 /* solaris specific metrics begin */\n\
 collection_group {\n\
diff --git a/lib/libgmond.c b/lib/libgmond.c
index f5eb32f1..c6267939 100644
--- a/lib/libgmond.c
+++ b/lib/libgmond.c
@@ -210,6 +210,9 @@ build_default_gmond_configuration(Ganglia_pool p)
   default_gmond_configuration = apr_pstrcat(context, default_gmond_configuration, SFLOW_CONFIGURATION, NULL);
 #endif
   default_gmond_configuration = apr_pstrcat(context, default_gmond_configuration, COLLECTION_GROUP_LIST, NULL);
+#if LINUX
+  default_gmond_configuration = apr_pstrcat(context, default_gmond_configuration, LINUX_SPECIFIC_CONFIGURATION, NULL);
+#endif
 #if SOLARIS
   default_gmond_configuration = apr_pstrcat(context, default_gmond_configuration, SOLARIS_SPECIFIC_CONFIGURATION, NULL);
 #endif
-- 
2.13.6

openSUSE Build Service is sponsored by