Hello community,

here is the log from the commit of package ganglia for openSUSE:Factory checked 
in at 2018-04-04 11:07:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ganglia (Old)
 and      /work/SRC/openSUSE:Factory/.ganglia.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ganglia"

Wed Apr  4 11:07:00 2018 rev:6 rq:593198 version:3.7.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/ganglia/ganglia.changes  2018-03-30 
12:08:50.834643754 +0200
+++ /work/SRC/openSUSE:Factory/.ganglia.new/ganglia.changes     2018-04-04 
11:07:31.111473304 +0200
@@ -1,0 +2,30 @@
+Tue Apr  3 04:50:58 UTC 2018 - jjo...@suse.com
+
+- Added update patches from ganglia upstream (bsc#1087487):
+  * ganglia-0001-avoid-segfault-when-fd-leaked-and-reached-fd-number-.patch
+  * ganglia-0002-Ignore-hostname-line-in-Apache-2.4.16.patch
+  * ganglia-0003-Avoid-KeyError-for-new-metric-groups.patch
+  * ganglia-0004-Metric-currestab-unlike-all-the-other-one-is-an-abso.patch
+  * ganglia-0005-ensure-the-num-DS-is-always-of-type-GAUGE.patch
+  * ganglia-0006-Fix-race-condition-where-new-metrics-are-added-while.patch
+  * ganglia-0007-fix-indent-to-use-whitespace.patch
+  * ganglia-0008-support-fs-size-for-ZFS-on-Linux.patch
+  * ganglia-0009-Fix-server-definition-type-of-cpu_steal-float.patch
+  * ganglia-0010-Fixes-245.patch - Close fp
+  * ganglia-0011-Fixed-44.patch - Prevent module reload
+  * ganglia-0012-Fix-disable-setuid-and-disable-setgid.patch
+  * ganglia-0013-downgrade-udp-recv-buffer-length-check.patch
+  * ganglia-0014-Report-mem-as-float-to-avoid-uint32-overflow.patch
+  * ganglia-0015-Fix-for-issue-246-minor-typo-in-conversion-from-sflo.patch
+  * ganglia-0016-The-way-forward-is-sometimes-the-way-back.patch
+  * ganglia-0017-Fix-wrong-steal-values-being-reported-for-multi_cpu.patch
+  * ganglia-0018-PEP8-changed-indentation-resulting-in-wrong-summatio.patch
+  * ganglia-0019-issue-266-requiring-dhcp-and-network-interfaces-to-b.patch
+  * ganglia-0020-Fix-segfault-with-TCP-listener-thread-on-exit.patch
+  * ganglia-0021-fix-net-byte-packet-stats-on-32-bit-linux.patch
+  * ganglia-0022-spaces-may-not-appear-in-some-parts-of-the-rrdtool-d.patch
+  * ganglia-0023-Fix-hash-collisions.patch
+  * ganglia-0024-Add-regular-Slab-memory-to-linux-memory-metrics.patch
+  * ganglia-0025-Report-the-Linux-specific-slab-memory-metric.patch
+
+-------------------------------------------------------------------

New:
----
  ganglia-0001-avoid-segfault-when-fd-leaked-and-reached-fd-number-.patch
  ganglia-0002-Ignore-hostname-line-in-Apache-2.4.16.patch
  ganglia-0003-Avoid-KeyError-for-new-metric-groups.patch
  ganglia-0004-Metric-currestab-unlike-all-the-other-one-is-an-abso.patch
  ganglia-0005-ensure-the-num-DS-is-always-of-type-GAUGE.patch
  ganglia-0006-Fix-race-condition-where-new-metrics-are-added-while.patch
  ganglia-0007-fix-indent-to-use-whitespace.patch
  ganglia-0008-support-fs-size-for-ZFS-on-Linux.patch
  ganglia-0009-Fix-server-definition-type-of-cpu_steal-float.patch
  ganglia-0010-Fixes-245.patch
  ganglia-0011-Fixed-44.patch
  ganglia-0012-Fix-disable-setuid-and-disable-setgid.patch
  ganglia-0013-downgrade-udp-recv-buffer-length-check.patch
  ganglia-0014-Report-mem-as-float-to-avoid-uint32-overflow.patch
  ganglia-0015-Fix-for-issue-246-minor-typo-in-conversion-from-sflo.patch
  ganglia-0016-The-way-forward-is-sometimes-the-way-back.patch
  ganglia-0017-Fix-wrong-steal-values-being-reported-for-multi_cpu.patch
  ganglia-0018-PEP8-changed-indentation-resulting-in-wrong-summatio.patch
  ganglia-0019-issue-266-requiring-dhcp-and-network-interfaces-to-b.patch
  ganglia-0020-Fix-segfault-with-TCP-listener-thread-on-exit.patch
  ganglia-0021-fix-net-byte-packet-stats-on-32-bit-linux.patch
  ganglia-0022-spaces-may-not-appear-in-some-parts-of-the-rrdtool-d.patch
  ganglia-0023-Fix-hash-collisions.patch
  ganglia-0024-Add-regular-Slab-memory-to-linux-memory-metrics.patch
  ganglia-0025-Report-the-Linux-specific-slab-memory-metric.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ganglia.spec ++++++
--- /var/tmp/diff_new_pack.SwIJp2/_old  2018-04-04 11:07:32.447424888 +0200
+++ /var/tmp/diff_new_pack.SwIJp2/_new  2018-04-04 11:07:32.447424888 +0200
@@ -34,6 +34,31 @@
 Patch2:         gmetad-service-btrfs-check.patch
 Patch3:         detect_aarch.patch
 Patch4:         add_unknown_arch.patch
+Patch5:         
ganglia-0001-avoid-segfault-when-fd-leaked-and-reached-fd-number-.patch
+Patch6:         ganglia-0002-Ignore-hostname-line-in-Apache-2.4.16.patch
+Patch7:         ganglia-0003-Avoid-KeyError-for-new-metric-groups.patch
+Patch8:         
ganglia-0004-Metric-currestab-unlike-all-the-other-one-is-an-abso.patch
+Patch9:         ganglia-0005-ensure-the-num-DS-is-always-of-type-GAUGE.patch
+Patch10:        
ganglia-0006-Fix-race-condition-where-new-metrics-are-added-while.patch
+Patch11:        ganglia-0007-fix-indent-to-use-whitespace.patch
+Patch12:        ganglia-0008-support-fs-size-for-ZFS-on-Linux.patch
+Patch13:        
ganglia-0009-Fix-server-definition-type-of-cpu_steal-float.patch
+Patch14:        ganglia-0010-Fixes-245.patch
+Patch15:        ganglia-0011-Fixed-44.patch
+Patch16:        ganglia-0012-Fix-disable-setuid-and-disable-setgid.patch
+Patch17:        ganglia-0013-downgrade-udp-recv-buffer-length-check.patch
+Patch18:        ganglia-0014-Report-mem-as-float-to-avoid-uint32-overflow.patch
+Patch19:        
ganglia-0015-Fix-for-issue-246-minor-typo-in-conversion-from-sflo.patch
+Patch20:        ganglia-0016-The-way-forward-is-sometimes-the-way-back.patch
+Patch21:        
ganglia-0017-Fix-wrong-steal-values-being-reported-for-multi_cpu.patch
+Patch22:        
ganglia-0018-PEP8-changed-indentation-resulting-in-wrong-summatio.patch
+Patch23:        
ganglia-0019-issue-266-requiring-dhcp-and-network-interfaces-to-b.patch
+Patch24:        
ganglia-0020-Fix-segfault-with-TCP-listener-thread-on-exit.patch
+Patch25:        ganglia-0021-fix-net-byte-packet-stats-on-32-bit-linux.patch
+Patch26:        
ganglia-0022-spaces-may-not-appear-in-some-parts-of-the-rrdtool-d.patch
+Patch27:        ganglia-0023-Fix-hash-collisions.patch
+Patch28:        
ganglia-0024-Add-regular-Slab-memory-to-linux-memory-metrics.patch
+Patch29:        ganglia-0025-Report-the-Linux-specific-slab-memory-metric.patch
 BuildRequires:  fdupes
 BuildRequires:  libapr1-devel
 BuildRequires:  libart_lgpl-devel
@@ -159,6 +184,31 @@
 %patch2
 %patch3
 %patch4
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
+%patch10 -p1
+%patch11 -p1
+%patch12 -p1
+%patch13 -p1
+%patch14 -p1
+%patch15 -p1
+%patch16 -p1
+%patch17 -p1
+%patch18 -p1
+%patch19 -p1
+%patch20 -p1
+%patch21 -p1
+%patch22 -p1
+%patch23 -p1
+%patch24 -p1
+%patch25 -p1
+%patch26 -p1
+%patch27 -p1
+%patch28 -p1
+%patch29 -p1
 
 %build
 export LIBS="-ltirpc"

++++++ ganglia-0001-avoid-segfault-when-fd-leaked-and-reached-fd-number-.patch 
++++++
From: Hiroshi Miura <miur...@linux.com>
Date: Sun, 6 Apr 2014 10:33:08 +0900
Git-commit: 3224076c55fdc9f68fcd29bed83f401e9bbc5b0b
References: bsc#1087487
Subject: [PATCH] avoid segfault when fd leaked and reached fd number limit.

Signed-off-by: Hiroshi Miura <miur...@linux.com>
Acked-by: John Jolly <jjo...@suse.de>
---
 gmond/gmond.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/gmond/gmond.c b/gmond/gmond.c
index fe51fab0..4b2fb6ef 100644
--- a/gmond/gmond.c
+++ b/gmond/gmond.c
@@ -2011,13 +2011,20 @@ process_tcp_accept_channel(const apr_pollfd_t *desc, 
apr_time_t now)
   channel        = desc->client_data;
 
   /* Create a context for the client connection */
-  apr_pool_create(&client_context, global_context);
+  status = apr_pool_create(&client_context, global_context);
+  if(status != APR_SUCCESS)
+    {
+      return;
+    }
 
   /* Accept the connection */
   status = apr_socket_accept(&client, server, client_context);
   if(status != APR_SUCCESS)
     {
-      goto close_accept_socket;
+      debug_msg("failed to accept");
+      /* Failed to accept, socket was not created
+       * Clear a prepared client context */
+      goto clear_client_context;
     }
 
   /* Set the timeout for writing to the client */
@@ -2125,6 +2132,7 @@ process_tcp_accept_channel(const apr_pollfd_t *desc, 
apr_time_t now)
 close_accept_socket:
   apr_socket_shutdown(client, APR_SHUTDOWN_READ);
   apr_socket_close(client);
+clear_client_context:
   apr_pool_destroy(client_context);
 }
 
-- 
2.13.6

++++++ ganglia-0002-Ignore-hostname-line-in-Apache-2.4.16.patch ++++++
From: Nick Le Mouton <n...@noodles.net.nz>
Date: Tue, 18 Aug 2015 13:09:28 +1200
Git-commit: ab0d0337550cc3e23e06a23c4f600214bb2abfc9
References: bsc#1087487
Subject: [PATCH] Ignore hostname line in Apache 2.4.16

Acked-by: John Jolly <jjo...@suse.de>
---
 gmond/python_modules/apache_status/apache_status.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gmond/python_modules/apache_status/apache_status.py 
b/gmond/python_modules/apache_status/apache_status.py
index e33e5ea9..580e8931 100755
--- a/gmond/python_modules/apache_status/apache_status.py
+++ b/gmond/python_modules/apache_status/apache_status.py
@@ -86,6 +86,10 @@ def get_metrics():
                     for sck in split_line[1]:
                         metrics[ Scoreboard_bykey[sck] ] += 1
                 else:
+                    # Apache > 2.4.16 inserts the hostname as the first line, 
so ignore
+                    if len(split_line) == 1:
+                        continue
+                    
                     if long_metric_name in Metric_Map:
                         metric_name = Metric_Map[long_metric_name]
                     else:
-- 
2.13.6

++++++ ganglia-0003-Avoid-KeyError-for-new-metric-groups.patch ++++++
From: Brian Bockelman <bbock...@cse.unl.edu>
Date: Thu, 29 Oct 2015 12:02:09 -0500
Git-commit: ba7c26f5b72c031cfc754b6ff524306a351089e9
References: bsc#1087487
Subject: [PATCH] Avoid KeyError for new metric groups.

If a metric group shows up in the network file sometime after initial
module startup, a KeyError may occur in get_metrics.  This causes the
netstats module to be non-functional until gmond is restarted.

Particularly, the IcmpMsg group will not be present until the first
IcmpMsg has been processed.
Acked-by: John Jolly <jjo...@suse.de>
---
 gmond/python_modules/network/netstats.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gmond/python_modules/network/netstats.py 
b/gmond/python_modules/network/netstats.py
index f9c6795f..bd455b5b 100644
--- a/gmond/python_modules/network/netstats.py
+++ b/gmond/python_modules/network/netstats.py
@@ -46,6 +46,8 @@ def get_metrics():
                     count = 0
                     metrics = re.split("\s+", line)
                     metric_group = metrics[0].replace(":", "").lower()
+                    if metric_group not in stats_pos:
+                        continue
                     new_metrics[metric_group] = dict()
                     for value in metrics:
                         # Skip first
-- 
2.13.6

++++++ ganglia-0004-Metric-currestab-unlike-all-the-other-one-is-an-abso.patch 
++++++
From: Vladimir <vl...@vuksan.com>
Date: Mon, 9 Nov 2015 13:36:39 -0500
Git-commit: 1692e34d72fa735b6f0627df4c8a3b55d3ece6fa
References: bsc#1087487
Subject: [PATCH] Metric currestab unlike all the other one is an absolute
 value and not a counter. Need to treat it separately

Acked-by: John Jolly <jjo...@suse.de>
---
 gmond/python_modules/network/netstats.py | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/gmond/python_modules/network/netstats.py 
b/gmond/python_modules/network/netstats.py
index f9c6795f..4581e710 100644
--- a/gmond/python_modules/network/netstats.py
+++ b/gmond/python_modules/network/netstats.py
@@ -19,6 +19,8 @@ stats_files = ["/proc/net/netstat", "/proc/net/snmp"]
 
 LAST_METRICS = copy.deepcopy(METRICS)
 METRICS_CACHE_MAX = 5
+# Metrics that are not counters but absolute values
+ABSOLUTE_VALUES = [ "currestab" ]
 
 stats_pos = {}
 
@@ -69,12 +71,15 @@ def get_metrics():
 def get_value(name):
     """Return a value for the requested metric"""
 
-    metrics = get_metrics()[0]
+    # get metrics
+    [curr_metrics, last_metrics] = get_metrics()
 
-    name = name[len(NAME_PREFIX):]  # remove prefix from name
+    parts = name.split("_")
+    group = parts[0]
+    metric = "_".join(parts[1:])
 
     try:
-        result = metrics['data'][name]
+        result = float(curr_metrics['data'][group][metric])    
     except StandardError:
         result = 0
 
@@ -208,12 +213,18 @@ def metric_init(params):
         file.close()
 
     for group in stats_pos:
-        for item in stats_pos[group]:
-            descriptors.append(create_desc(Desc_Skel, {
-                    "name"       : group + "_" + stats_pos[group][item],
-                    "description": stats_pos[group][item],
-                    'groups'     : group
-                    }))
+       for item in stats_pos[group]:
+           if stats_pos[group][item] in ABSOLUTE_VALUES:
+               descriptors.append(create_desc(Desc_Skel, {
+                   "name"       : group + "_" + stats_pos[group][item],
+                    "call_back"  : get_value,
+                   "groups"     : group
+                   }))
+            else:
+               descriptors.append(create_desc(Desc_Skel, {
+                   "name"       : group + "_" + stats_pos[group][item],
+                   "groups"     : group
+                   }))
 
     descriptors.append(create_desc(Desc_Skel, {
         "name"       : "tcpext_tcploss_percentage",
-- 
2.13.6

++++++ ganglia-0005-ensure-the-num-DS-is-always-of-type-GAUGE.patch ++++++
From: Dennis Klein <d.kl...@gsi.de>
Date: Fri, 8 Jan 2016 18:59:44 +0100
Git-commit: ab3d7de6eef9fd0a5af0b8837f4b324aa3c7d96a
References: bsc#1087487
Subject: [PATCH] ensure the num DS is always of type GAUGE

Acked-by: John Jolly <jjo...@suse.de>
---
 gmetad/rrd_helpers.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gmetad/rrd_helpers.c b/gmetad/rrd_helpers.c
index 740799a5..e38c6514 100644
--- a/gmetad/rrd_helpers.c
+++ b/gmetad/rrd_helpers.c
@@ -276,8 +276,8 @@ RRD_create( char *rrd, int summary, unsigned int step,
            heartbeat);
    argv[argc++] = sum;
    if (summary) {
-      sprintf(num,"DS:num:%s:%d:U:U", 
-              data_source_type,
+      sprintf(num,"DS:num:%s:%d:U:U",
+              "GAUGE",
               heartbeat);
       argv[argc++] = num;
    }
-- 
2.13.6

++++++ ganglia-0006-Fix-race-condition-where-new-metrics-are-added-while.patch 
++++++
From: Mijo Safradin <mijo.safra...@googlemail.com>
Date: Mon, 25 Jan 2016 00:03:47 +0100
Git-commit: 1d52319118bf25ebdf02093ad1fc148ffcad5ddd
References: bsc#1087487
Subject: [PATCH] Fix race condition where new metrics are added while old
 metric still gets send to carbon server. The carbon log is reporting invalid
 metrics.

Acked-by: John Jolly <jjo...@suse.de>
---
 gmetad/gmetad.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gmetad/gmetad.c b/gmetad/gmetad.c
index 60ade92c..e04368fe 100644
--- a/gmetad/gmetad.c
+++ b/gmetad/gmetad.c
@@ -610,12 +610,12 @@ main ( int argc, char *argv[] )
          /* Sum the new values */
          hash_foreach(root.authority, do_root_summary, NULL );
 
-         /* summary completed */
-         pthread_mutex_unlock(root.sum_finished);
-
          /* Save them to RRD */
          hash_foreach(root.metric_summary, write_root_summary, NULL);
 
+         /* summary completed */
+         pthread_mutex_unlock(root.sum_finished);
+
          /* Remember our last run */
          now = apr_time_now();
          last_metadata = now;  //Updating global variable
-- 
2.13.6

++++++ ganglia-0007-fix-indent-to-use-whitespace.patch ++++++
From: kobtea <kobtea9...@gmail.com>
Date: Tue, 16 Feb 2016 19:45:34 +0900
Git-commit: 88731a031cde1b308779a97e5850582f1394b16a
References: bsc#1087487
Subject: [PATCH] fix indent to use whitespace

Acked-by: John Jolly <jjo...@suse.de>
---
 gmond/python_modules/network/netstats.py | 34 ++++++++++++++++----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/gmond/python_modules/network/netstats.py 
b/gmond/python_modules/network/netstats.py
index e8efa26f..66c378d2 100644
--- a/gmond/python_modules/network/netstats.py
+++ b/gmond/python_modules/network/netstats.py
@@ -20,7 +20,7 @@ stats_files = ["/proc/net/netstat", "/proc/net/snmp"]
 LAST_METRICS = copy.deepcopy(METRICS)
 METRICS_CACHE_MAX = 5
 # Metrics that are not counters but absolute values
-ABSOLUTE_VALUES = [ "currestab" ]
+ABSOLUTE_VALUES = ["currestab"]
 
 stats_pos = {}
 
@@ -81,7 +81,7 @@ def get_value(name):
     metric = "_".join(parts[1:])
 
     try:
-        result = float(curr_metrics['data'][group][metric])    
+        result = float(curr_metrics['data'][group][metric])
     except StandardError:
         result = 0
 
@@ -215,18 +215,18 @@ def metric_init(params):
         file.close()
 
     for group in stats_pos:
-       for item in stats_pos[group]:
-           if stats_pos[group][item] in ABSOLUTE_VALUES:
-               descriptors.append(create_desc(Desc_Skel, {
-                   "name"       : group + "_" + stats_pos[group][item],
+        for item in stats_pos[group]:
+            if stats_pos[group][item] in ABSOLUTE_VALUES:
+                descriptors.append(create_desc(Desc_Skel, {
+                    "name"       : group + "_" + stats_pos[group][item],
                     "call_back"  : get_value,
-                   "groups"     : group
-                   }))
+                    "groups"     : group
+                }))
             else:
-               descriptors.append(create_desc(Desc_Skel, {
-                   "name"       : group + "_" + stats_pos[group][item],
-                   "groups"     : group
-                   }))
+                descriptors.append(create_desc(Desc_Skel, {
+                    "name"       : group + "_" + stats_pos[group][item],
+                    "groups"     : group
+                }))
 
     descriptors.append(create_desc(Desc_Skel, {
         "name"       : "tcpext_tcploss_percentage",
@@ -234,7 +234,7 @@ def metric_init(params):
         "description": "TCP percentage loss, tcploss / insegs + outsegs",
         "units"      : "pct",
         'groups'     : 'tcpext'
-        }))
+    }))
 
     descriptors.append(create_desc(Desc_Skel, {
         "name"       : "tcp_attemptfails_percentage",
@@ -242,7 +242,7 @@ def metric_init(params):
         "description": "TCP attemptfail percentage, tcpattemptfail / insegs + 
outsegs",
         "units"      : "pct",
         'groups'     : 'tcp'
-        }))
+    }))
 
     descriptors.append(create_desc(Desc_Skel, {
         "name"       : "tcp_retrans_percentage",
@@ -250,7 +250,7 @@ def metric_init(params):
         "description": "TCP retrans percentage, retranssegs / insegs + 
outsegs",
         "units"      : "pct",
         'groups'     : 'tcp'
-        }))
+    }))
 
     return descriptors
 
@@ -260,12 +260,12 @@ def metric_cleanup():
     pass
 
 
-#This code is for debugging and unit testing
+# This code is for debugging and unit testing
 if __name__ == '__main__':
     descriptors = metric_init(PARAMS)
     while True:
         for d in descriptors:
             v = d['call_back'](d['name'])
-            print '%s = %s' % (d['name'],  v)
+            print '%s = %s' % (d['name'], v)
         print 'Sleeping 15 seconds'
         time.sleep(15)
-- 
2.13.6

++++++ ganglia-0008-support-fs-size-for-ZFS-on-Linux.patch ++++++
From: Ben Kurtz <bku...@ucsd.edu>
Date: Thu, 10 Mar 2016 22:38:27 -0800
Git-commit: 1c85925e5b1ae99f08c44ea2b3b9567c21f3de9f
References: bsc#1087487
Subject: [PATCH] support fs size for ZFS on Linux

ZFS mounts don't start with '/dev/', so look out for that when skipping mount 
entries
Acked-by: John Jolly <jjo...@suse.de>
---
 libmetrics/linux/metrics.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libmetrics/linux/metrics.c b/libmetrics/linux/metrics.c
index 62e7314b..dec85483 100644
--- a/libmetrics/linux/metrics.c
+++ b/libmetrics/linux/metrics.c
@@ -1388,7 +1388,8 @@ float find_disk_space(double *total_size, double 
*total_free)
       if (!strncmp(mode, "ro", 2)) continue;
       if (remote_mount(device, type)) continue;
       if (strncmp(device, "/dev/", 5) != 0 &&
-          strncmp(device, "/dev2/", 6) != 0) continue;
+          strncmp(device, "/dev2/", 6) != 0 &&
+          strncmp(type, "zfs", 3) != 0) continue;
       thispct = device_space(mount, device, total_size, total_free);
       debug_msg("Counting device %s (%.2f %%)", device, thispct);
       if (!max || max<thispct)
-- 
2.13.6

++++++ ganglia-0009-Fix-server-definition-type-of-cpu_steal-float.patch ++++++
From: =?UTF-8?q?Anders=20Bj=C3=B6rklund?= <and...@itension.se>
Date: Sun, 31 Jan 2016 20:31:42 +0100
Git-commit: ca5b7514d6b5d2b35ad8c1d01dd340be8b670f45
References: bsc#1087487
Subject: [PATCH] Fix server definition type of cpu_steal (float)

Acked-by: John Jolly <jjo...@suse.de>
---
 gmetad/server.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gmetad/server.c b/gmetad/server.c
index 28188e75..59c76244 100644
--- a/gmetad/server.c
+++ b/gmetad/server.c
@@ -68,7 +68,7 @@ static const struct metricinfo
   {
   "cpu_sintr", cpu_sintr_func, g_float},
   {
-  "cpu_steal", cpu_steal_func, g_uint16},
+  "cpu_steal", cpu_steal_func, g_float},
   {
   "load_one", load_one_func, g_float},
   {
-- 
2.13.6

++++++ ganglia-0010-Fixes-245.patch ++++++
From: Jesse Becker <haw...@gmail.com>
Date: Mon, 2 May 2016 21:53:36 -0400
Git-commit: 6887ef08f151ec7fc303b0d9c6cb15614d0f1ca9
References: bsc#1087487
Subject: [PATCH] Fixes #245

Acked-by: John Jolly <jjo...@suse.de>
---
 gmond/g25_config.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gmond/g25_config.c b/gmond/g25_config.c
index d295ab64..98721817 100644
--- a/gmond/g25_config.c
+++ b/gmond/g25_config.c
@@ -373,5 +373,6 @@ print_ganglia_25_config( char *path )
    dotconf_cleanup(configfile);
 
    print_config(path, &gmond_config);
+   fclose(fp);
    return 0;
 }
-- 
2.13.6

++++++ ganglia-0011-Fixed-44.patch ++++++
From: Jesse Becker <haw...@gmail.com>
Date: Mon, 2 May 2016 23:03:44 -0400
Git-commit: 92a5c1229984dea573a0298ba05020187faf4e84
References: bsc#1087487
Subject: [PATCH] Fixed #44

Keep a list of module@path that we've loaded, and error out if we try to
load the same thing more than once.
Acked-by: John Jolly <jjo...@suse.de>
---
 gmond/gmond.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gmond/gmond.c b/gmond/gmond.c
index 7790e981..b2f54ffc 100644
--- a/gmond/gmond.c
+++ b/gmond/gmond.c
@@ -2298,6 +2298,7 @@ load_metric_modules( void )
 {
     cfg_t *tmp;
     int j;
+    apr_hash_t *modules_loaded = apr_hash_make(global_context);
 
     tmp = cfg_getsec( config_file, "modules");
     for (j = 0; j < cfg_size(tmp, "module"); j++) 
@@ -2309,6 +2310,7 @@ load_metric_modules( void )
         apr_array_header_t *modParams_list = NULL;
         int k, modEnabled;
         apr_status_t merge_ret;
+        char *module_key = NULL;
 
         cfg_t *module = cfg_getnsec(tmp, "module", j);
 
@@ -2345,6 +2347,17 @@ load_metric_modules( void )
           }
         modName = cfg_getstr(module, "name");
         modparams = cfg_getstr(module, "params");
+
+
+        /* Check that we haven't loaded this module already, now
+         * that we've pulled the module name and path */
+        module_key = apr_pstrcat(global_context, modName, ":", modPath, NULL);
+        debug_msg("loading %s @ %s", modName, modPath);
+        if (NULL != apr_hash_get(modules_loaded, module_key, 
APR_HASH_KEY_STRING)) {
+            err_quit("Attempt to load module %s @ %s more than once.", 
modName, modPath);
+            continue;
+        }
+
         modParams_list = apr_array_make(global_context, 2, sizeof(mmparam));
 
         for (k = 0; k < cfg_size(module, "param"); k++) 
@@ -2372,6 +2385,7 @@ load_metric_modules( void )
             continue;
           }
         debug_msg("loaded module: %s", modName);
+        apr_hash_set(modules_loaded, module_key, APR_HASH_KEY_STRING, 
apr_pstrdup(global_context, "true"));
 
         /*
          * Retrieve the pointer to the module structure through the module 
name.
-- 
2.13.6

++++++ ganglia-0012-Fix-disable-setuid-and-disable-setgid.patch ++++++
From: =?UTF-8?q?Anders=20Bj=C3=B6rklund?= <and...@itension.se>
Date: Wed, 10 Sep 2014 14:00:51 +0200
Git-commit: 01faf41c5d4ef726db9497fb01e3afe558d342db
References: bsc#1087487
Subject: [PATCH] Fix --disable-setuid and --disable-setgid

Acked-by: John Jolly <jjo...@suse.de>
---
 configure.ac | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index fe7983bf..72a1b087 100644
--- a/configure.ac
+++ b/configure.ac
@@ -214,8 +214,8 @@ AC_DEFINE(SUPPORT_GEXEC, 1, SUPPORT_GEXEC), 
AC_DEFINE(SUPPORT_GEXEC, 0, SUPPORT_
 setuid_user=nobody
 AC_ARG_ENABLE(setuid,
 [  --enable-setuid=USER    turn on setuid support (default setuid=nobody) ],
-[if test x"$enableval" != xno; then no_setuid=0; setuid_user=$enableval ; fi],
-[ no_setuid=0 ])
+[if test x"$enableval" != xno; then no_setuid=0; setuid_user=$enableval ; else 
no_setuid=1; fi],
+[ no_setuid=1 ])
 AC_DEFINE_UNQUOTED(NO_SETUID, $no_setuid, NO_SETUID)
 AC_DEFINE_UNQUOTED(SETUID_USER, "$setuid_user", SETUID_USER)
 AC_SUBST(setuid_user)
@@ -223,7 +223,7 @@ AC_SUBST(setuid_user)
 setgid_group=daemon
 AC_ARG_ENABLE(setgid,
 [  --enable-setgid=GROUP   turn on setgid support (default setgid=no) ],
-[if test x"$enableval" != xno; then no_setgid=0; setgid_group=$enableval ; fi],
+[if test x"$enableval" != xno; then no_setgid=0; setgid_group=$enableval ; 
else no_setgid=1; fi],
 [ no_setgid=1 ])
 AC_DEFINE_UNQUOTED(NO_SETGID, $no_setgid, NO_SETGID)
 AC_DEFINE_UNQUOTED(SETGID_GROUP, "$setgid_group", SETGID_GROUP)
-- 
2.13.6

++++++ ganglia-0013-downgrade-udp-recv-buffer-length-check.patch ++++++
From: Chris Burroughs <chris.burrou...@gmail.com>
Date: Mon, 17 Oct 2016 18:06:11 -0400
Git-commit: e267c6cf690c679b2010bc36bf8e400f865097b8
References: bsc#1087487
Subject: [PATCH] downgrade udp recv buffer length check

The 2x SO_RCVBUF behavior is specific to Linux.  When requesting the
size of a buffer an OS might reasonably say it's exactly the size you
just asked for.  This is the behavior on Illumos and FreeBSD.

To avoid a thicket of environment specific conditionals while
accommodating Linux, downgrade to a log warning instead of
EXIT_FAILURE.

NOTE: Removed the now misleading APR 0.9.4 warning.  That version was
released in 2003.
Acked-by: John Jolly <jjo...@suse.de>
---
 gmond/gmond.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/gmond/gmond.c b/gmond/gmond.c
index 507ef61b..a188dfd9 100644
--- a/gmond/gmond.c
+++ b/gmond/gmond.c
@@ -775,16 +775,15 @@ setup_listen_channels_pollset( void )
 
                   if(buffer)
                     {
-                      /* RB: getsockopt() returns double SO_RCVBUF since 
kernel reserves overhead space */
+                      /* NOTE: getsockopt() returns double SO_RCVBUF on Linux 
for reserved overhead space */
                       if(rx_buf_sz!=(buffer*2))
                         {
-                          err_msg("Error setting UDP receive buffer for port 
%d bind=%s to size: %d.\n",
+                          err_msg("WARNING When setting UDP receive buffer for 
port %d bind=%s to size: %d.\n",
                             port, bindaddr? bindaddr: "unspecified", 
(apr_int32_t) buffer);
-                          err_msg("Reported buffer size by OS: %d : does not 
match config setting %d.\n",
-                            (int) (rx_buf_sz/2), (int) buffer);
-                          err_msg("NOTE: only supported on systems that have 
Apache Portable Runtime library version 0.9.4 or higher.\n");
-                          err_msg("Check Operating System (kernel) limits, 
change or disable buffer size. Exiting.\n");
-                          exit(EXIT_FAILURE);
+                          err_msg("Reported raw buffer size by OS: %d : config 
setting %d. Unable to verify\n",
+                            (int) rx_buf_sz, (int) buffer);
+                          err_msg("NOTE: Linux will report twice the 
configured value.  See socket(7).\n");
+                          err_msg("Check Operating System (kernel) limits, 
change or disable buffer size.\n");
                         }
                       else
                         { /* RB: Eureka */
-- 
2.13.6

++++++ ganglia-0014-Report-mem-as-float-to-avoid-uint32-overflow.patch ++++++
From: =?UTF-8?q?Anders=20Bj=C3=B6rklund?= <and...@psqr.se>
Date: Fri, 28 Oct 2016 21:02:05 +0200
Git-commit: c85fe651478bac58c44b8dfe21b0f2962043a0fd
References: bsc#1087487
Subject: [PATCH] Report mem as float, to avoid uint32 overflow

Fixes #260.
Acked-by: John Jolly <jjo...@suse.de>
---
 gmond/python_modules/process/procstat.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gmond/python_modules/process/procstat.py 
b/gmond/python_modules/process/procstat.py
index b26849b2..93ff9a9c 100644
--- a/gmond/python_modules/process/procstat.py
+++ b/gmond/python_modules/process/procstat.py
@@ -383,6 +383,8 @@ def metric_init(params):
 
         mem = {
             'units': 'B',
+            'value_type': 'float',
+            'format': '%.0f',
             'description': 'The total memory utilization'}
     )
 
-- 
2.13.6

++++++ ganglia-0015-Fix-for-issue-246-minor-typo-in-conversion-from-sflo.patch 
++++++
From: sc-gj <glenn.l.jenk...@uwtsd.ac.uk>
Date: Mon, 5 Dec 2016 10:12:05 +0000
Git-commit: 1af4cf1253974ee1c0d6592671ce001cd7689c85
References: bsc#1087487
Subject: [PATCH] Fix for issue #246 - minor typo in conversion from sflow data
 to gmond internal metric structures caused a crash when this data was used to
 generate XML for output.

Acked-by: John Jolly <jjo...@suse.de>
---
 gmond/sflow.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gmond/sflow.c b/gmond/sflow.c
index 8c62b5d8..5e633634 100644
--- a/gmond/sflow.c
+++ b/gmond/sflow.c
@@ -303,7 +303,8 @@ submit_sflow_string(Ganglia_host *hostdata, char 
*metric_prefix, EnumSFLOWGMetri
   char mtitle_buf[SFLOW_MAX_METRIC_NAME_LEN];
   if(ok || sflowCFG.submit_null_str) {
     set_metric_name_and_title(&mname, &mtitle, mname_buf, mtitle_buf, 
metric_prefix, tag);
-    fmsg.id = vmsg.id = gmetric_uint;
+    //fmsg.id = vmsg.id = gmetric_uint;
+    fmsg.id = vmsg.id = gmetric_string;
     fmsg.Ganglia_metadata_msg_u.gfull.metric.type = "string";
     vmsg.Ganglia_value_msg_u.gstr.metric_id.name = mname;
     vmsg.Ganglia_value_msg_u.gstr.str = (ok ? (char *)val : sflowCFG.null_str);
@@ -1188,6 +1189,7 @@ processCounterSample(SFlowXDR *x, char **errorMsg)
     SFLOWXDR_skip(x,4);
     
     machine_type = SFLOWXDR_next(x);
+
     os_name = SFLOWXDR_next(x);
     osrelease_len = SFLOWXDR_next(x);
     if(osrelease_len > 0 && osrelease_len <= SFLOW_MAX_OSRELEASE_LEN) {
-- 
2.13.6

++++++ ganglia-0016-The-way-forward-is-sometimes-the-way-back.patch ++++++
From: David M Noriega <david.nori...@locationlabs.com>
Date: Fri, 10 Feb 2017 15:45:30 -0800
Git-commit: d1cb65515671d0e3b5fa2c4e16bef5360ad026d6
References: bsc#1087487
Subject: [PATCH] The way forward is sometimes the way back

RE: c8ca8bc68fae775d588aeef8e35db3f9255b48c3

The assumption that the sflow vm metric will always be of the form
name.vcpu_num is incorrect for environments where the virt name is the
fqdn.
Acked-by: John Jolly <jjo...@suse.de>
---
 gmetad/gmetad.c      | 2 +-
 gmetad/process_xml.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gmetad/gmetad.c b/gmetad/gmetad.c
index e04368fe..3e212937 100644
--- a/gmetad/gmetad.c
+++ b/gmetad/gmetad.c
@@ -323,7 +323,7 @@ write_root_summary(datum_t *key, datum_t *val, void *arg)
        return 0;
 
    /* Don't write a summary for metris that appears to be sFlow VM metrics */
-   if (gmetad_config.unsummarized_sflow_vm_metrics && (p = strchr(name, '.')) 
!= NULL && *(p+1) == 'v')
+   if (gmetad_config.unsummarized_sflow_vm_metrics && (p = strrchr(name, '.')) 
!= NULL && *(p+1) == 'v')
      return 0;
 
    ganglia_scoreboard_inc(METS_SUMRZ_ROOT);
diff --git a/gmetad/process_xml.c b/gmetad/process_xml.c
index 15abc75c..fc28701e 100644
--- a/gmetad/process_xml.c
+++ b/gmetad/process_xml.c
@@ -1172,7 +1172,7 @@ finish_processing_source(datum_t *key, datum_t *val, void 
*arg)
       return 0;
 
    /* Don't save to RRD if this metrics appears to be an sFlow VM metrics */
-   if (gmetad_config.unsummarized_sflow_vm_metrics && (p = strchr(name, '.')) 
!= NULL && *(p+1) == 'v')
+   if (gmetad_config.unsummarized_sflow_vm_metrics && (p = strrchr(name, '.')) 
!= NULL && *(p+1) == 'v')
        return 0;
 
    switch (tt->type)
-- 
2.13.6

++++++ ganglia-0017-Fix-wrong-steal-values-being-reported-for-multi_cpu.patch 
++++++
From: =?UTF-8?q?Anders=20Bj=C3=B6rklund?= <and...@psqr.se>
Date: Wed, 15 Feb 2017 16:55:53 +0100
Git-commit: 61a8835ff420b8e3e90cadcdd47afbad030dff7c
References: bsc#1087487
Subject: [PATCH] Fix wrong steal values being reported for multi_cpu

Due to a copy/paste error in a3833fa42cc8b5bca75d8c1e78baec643cfadf53,
the wrong values (user cpu) were being used for steal cpu comparisons.
Acked-by: John Jolly <jjo...@suse.de>
---
 gmond/modules/cpu/mod_multicpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gmond/modules/cpu/mod_multicpu.c b/gmond/modules/cpu/mod_multicpu.c
index 253e0969..cdda8d53 100644
--- a/gmond/modules/cpu/mod_multicpu.c
+++ b/gmond/modules/cpu/mod_multicpu.c
@@ -457,7 +457,7 @@ static cpu_util *init_metric (apr_pool_t *p, 
apr_array_header_t *ar, int cpu_cou
 static g_val_t multi_cpu_steal_func (int cpu_index)
 {
     char *p;
-    cpu_util *cpu = &(cpu_user[cpu_index]);
+    cpu_util *cpu = &(cpu_steal[cpu_index]);
 
     p = update_file(&proc_stat);
     if((proc_stat.last_read.tv_sec != cpu->stamp.tv_sec) &&
-- 
2.13.6

++++++ ganglia-0018-PEP8-changed-indentation-resulting-in-wrong-summatio.patch 
++++++
From: Vladimir <vl...@vuksan.com>
Date: Mon, 6 Mar 2017 10:31:10 -0500
Git-commit: a5869c224ee9c3499f19238b688b02a48d3dc3f2
References: bsc#1087487
Subject: [PATCH] PEP8 changed indentation resulting in wrong summation

Acked-by: John Jolly <jjo...@suse.de>
---
 gmond/python_modules/network/multi_interface.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gmond/python_modules/network/multi_interface.py 
b/gmond/python_modules/network/multi_interface.py
index 3f9b45d0..456704b8 100644
--- a/gmond/python_modules/network/multi_interface.py
+++ b/gmond/python_modules/network/multi_interface.py
@@ -247,7 +247,7 @@ def get_aggregates(name):
         except KeyError:
             delta = 0.0
 
-    sum += delta
+        sum += delta
 
     return sum
 
-- 
2.13.6

++++++ ganglia-0019-issue-266-requiring-dhcp-and-network-interfaces-to-b.patch 
++++++
From: arlion <arl...@arlionprojects.com>
Date: Tue, 11 Apr 2017 10:16:08 -0400
Git-commit: a3d519b29ce952c84f9012eaefa11497f65d4391
References: bsc#1087487
Subject: [PATCH] issue 266, requiring dhcp and network interfaces to be UP
 before starting gmond

Acked-by: John Jolly <jjo...@suse.de>
---
 gmetad-python/gmetad-python.service.in | 2 +-
 gmetad/gmetad.service.in               | 2 +-
 gmond/gmond.service.in                 | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gmetad-python/gmetad-python.service.in 
b/gmetad-python/gmetad-python.service.in
index 16918db7..11243979 100644
--- a/gmetad-python/gmetad-python.service.in
+++ b/gmetad-python/gmetad-python.service.in
@@ -1,6 +1,6 @@
 [Unit]
 Description=Ganglia Meta Daemon in Python
-After=network.target
+After=network-online.target
 
 [Service]
 ExecStart=@bindir@/gmetad.py -f
diff --git a/gmetad/gmetad.service.in b/gmetad/gmetad.service.in
index 8234e90e..d7800655 100644
--- a/gmetad/gmetad.service.in
+++ b/gmetad/gmetad.service.in
@@ -1,6 +1,6 @@
 [Unit]
 Description=Ganglia Meta Daemon
-After=network.target
+After=network-online.target
 
 [Service]
 Type=forking
diff --git a/gmond/gmond.service.in b/gmond/gmond.service.in
index 3fd136b4..13774e80 100644
--- a/gmond/gmond.service.in
+++ b/gmond/gmond.service.in
@@ -1,6 +1,6 @@
 [Unit]
 Description=Ganglia Monitor Daemon
-After=network.target
+After=network-online.target
 
 [Service]
 Type=forking
-- 
2.13.6

++++++ ganglia-0020-Fix-segfault-with-TCP-listener-thread-on-exit.patch ++++++
From: Junichi TANAKA <junsa...@gmail.com>
Date: Tue, 25 Apr 2017 23:16:36 +0900
Git-commit: d63782c18ddeae5b71c976e5b8ef58a0d488beaa
References: bsc#1087487
Subject: [PATCH] Fix segfault with TCP listener thread on exit

Acked-by: John Jolly <jjo...@suse.de>
---
 gmond/gmond.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/gmond/gmond.c b/gmond/gmond.c
index a188dfd9..d01555db 100644
--- a/gmond/gmond.c
+++ b/gmond/gmond.c
@@ -3315,6 +3315,7 @@ main ( int argc, char *argv[] )
 {
   apr_time_t now, next_collection, last_cleanup;
   apr_pool_t *cleanup_context;
+  apr_thread_t *tcp_listener_thread = NULL;
 
   gmond_argv = argv;
 
@@ -3436,8 +3437,7 @@ main ( int argc, char *argv[] )
   /* Create TCP listener thread */
   if(!deaf)
     {
-      apr_thread_t *thread;
-      if (apr_thread_create(&thread, NULL, tcp_listener, NULL, global_context) 
!= APR_SUCCESS)
+      if (apr_thread_create(&tcp_listener_thread, NULL, tcp_listener, NULL, 
global_context) != APR_SUCCESS)
         {
           err_msg("Failed to create TCP listener thread. Exiting.\n");
           exit(EXIT_FAILURE);
@@ -3498,6 +3498,16 @@ main ( int argc, char *argv[] )
         }
     }
 
+  if(tcp_listener_thread)
+    {
+      apr_status_t status = SUCCESS;
+      if((status = apr_thread_join(&status, tcp_listener_thread)) != 
APR_SUCCESS)
+        {
+          char buff[512];
+          debug_msg("apr_thread_join returned unexpected status %d = %s\n", 
status, apr_strerror(status, buff, 511));
+        }
+    }
+
   apr_pool_destroy(global_context);
 
   if(reload_required == 1)
-- 
2.13.6

++++++ ganglia-0021-fix-net-byte-packet-stats-on-32-bit-linux.patch ++++++
From: ben <bku...@users.noreply.github.com>
Date: Wed, 5 Jul 2017 20:14:05 +0000
Git-commit: 3da760b509a61227a468ddd28bbd53efeab50ac7
References: bsc#1087487
Subject: [PATCH] fix net byte/packet stats on 32-bit linux

32-bit linux systems often use 32-bit values for network byte/packet counters, 
but we've been assuming 64-bit rollover if the system supports strtoull.  Per 
d17a120fe4a9905122ab521c5608d752e57246b6, this was because some 32-bit systems 
use 64-bit network byte/packet counters, so it's not sufficient to check system 
type.  Instead, just see if the previous value looks like a 32-bit or 64-bit 
value - if someone's going from a value that fits in 32 bits to one that's 
overflowed 64 in between checks, a) that's absurd bandwidth, and b) it's no 
longer a reasonable assumption that they only rolled over *once* either.
Acked-by: John Jolly <jjo...@suse.de>
---
 libmetrics/linux/metrics.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/libmetrics/linux/metrics.c b/libmetrics/linux/metrics.c
index 3ec35802..a13cc1cd 100644
--- a/libmetrics/linux/metrics.c
+++ b/libmetrics/linux/metrics.c
@@ -264,7 +264,11 @@ void update_ifdata ( char *caller )
                        l_bytes_in += rbi - ns->rbi;
                     } else {
                        debug_msg("update_ifdata(%s) - Overflow in rbi: 
%"PRI_STAT" -> %"PRI_STAT,caller,ns->rbi,rbi);
-                       l_bytes_in += STAT_MAX - ns->rbi + rbi;
+                       if ( ns->rbi <= ULONG_MAX ) { /* assume it's more 
reasonable that the counter rolled over at ULONG_MAX than ULLONG_MAX */
+                          l_bytes_in += ULONG_MAX - ns->rbi + rbi;
+                       } else {
+                          l_bytes_in += STAT_MAX - ns->rbi + rbi;
+                       }
                     }
                     ns->rbi = rbi;
 
@@ -273,7 +277,11 @@ void update_ifdata ( char *caller )
                        l_pkts_in += rpi - ns->rpi;
                     } else {
                        debug_msg("updata_ifdata(%s) - Overflow in rpi: 
%"PRI_STAT" -> %"PRI_STAT,caller,ns->rpi,rpi);
-                       l_pkts_in += STAT_MAX - ns->rpi + rpi;
+                       if ( ns->rpi <= ULONG_MAX ) {
+                          l_pkts_in += ULONG_MAX - ns->rpi + rpi;
+                       } else {
+                          l_pkts_in += STAT_MAX - ns->rpi + rpi;
+                       }
                     }
                     ns->rpi = rpi;
 
@@ -286,7 +294,11 @@ void update_ifdata ( char *caller )
                        l_bytes_out += rbo - ns->rbo;
                     } else {
                        debug_msg("update_ifdata(%s) - Overflow in rbo: 
%"PRI_STAT" -> %"PRI_STAT,caller,ns->rbo,rbo);
-                       l_bytes_out += STAT_MAX - ns->rbo + rbo;
+                       if ( ns->rbo <= ULONG_MAX ) {
+                          l_bytes_out += ULONG_MAX - ns->rbo + rbo;
+                       } else {
+                          l_bytes_out += STAT_MAX - ns->rbo + rbo;
+                       }
                     }
                     ns->rbo = rbo;
 
@@ -295,7 +307,11 @@ void update_ifdata ( char *caller )
                        l_pkts_out += rpo - ns->rpo;
                     } else {
                        debug_msg("update_ifdata(%s) - Overflow in rpo: 
%"PRI_STAT" -> %"PRI_STAT,caller,ns->rpo,rpo);
-                       l_pkts_out += STAT_MAX - ns->rpo + rpo;
+                       if ( ns->rpo <= ULONG_MAX ) {
+                          l_pkts_out += ULONG_MAX - ns->rpo + rpo;
+                       } else {
+                          l_pkts_out += STAT_MAX - ns->rpo + rpo;
+                       }
                     }
                     ns->rpo = rpo;
                   }
-- 
2.13.6

++++++ ganglia-0022-spaces-may-not-appear-in-some-parts-of-the-rrdtool-d.patch 
++++++
From: scottnotrobot <scottnotro...@gmail.com>
Date: Tue, 8 Aug 2017 14:34:28 -0700
Git-commit: 8372a282d648350c7a54b6221eee0e2706e6a88c
References: bsc#1087487
Subject: [PATCH] spaces may not appear in some parts of the rrdtool dump

Acked-by: John Jolly <jjo...@suse.de>
---
 contrib/removespikes.pl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/contrib/removespikes.pl b/contrib/removespikes.pl
index e52908d3..7061cea8 100755
--- a/contrib/removespikes.pl
+++ b/contrib/removespikes.pl
@@ -97,10 +97,10 @@ while (<FICH>) {
   $cdo=0;
   if ($linea=~/^(.*)<row>/) { $tstamp=$1; }
   if ($linea=~/(<row>.*)$/) { $tresto=$1; }
-  if (/<v>\s\d\.\d+e.(\d+)\s<\/v>/) {
+  if (/<v>\s?\d\.\d+e.(\d+)\s?<\/v>/) {
     @dump = split(/<\/v>/, $tresto);
     for ($lino=0; $lino<=$#dump-1; $lino++) {   # scans DS's within each row 
-      if ( $dump[$lino]=~/\d\.\d+e.(\d+)\s/ ) { # make sure it is a number 
(and not NaN)
+      if ( $dump[$lino]=~/\d\.\d+e.(\d+)\s?/ ) { # make sure it is a number 
(and not NaN)
         $a=substr("0$lino",-2).":".$1;
         $exp{$a}++;                             # store exponents
         $tot{substr("0$lino",-2)}++;            # and keep a per DS total
@@ -146,11 +146,11 @@ while (<FICH>) {
   $cdo=0;
   if ($linea=~/^(.*)<row>/) { $tstamp=$1; }     # Grab timestamp
   if ($linea=~/(<row>.*)$/) { $tresto=$1; }     # grab rest-of-line :-)
-  if (/<v>\s\d\.\d+e.(\d+)\s<\/v>/) {           # are there DS's?
+  if (/<v>\s?\d\.\d+e.(\d+)\s?<\/v>/) {           # are there DS's?
     @dump=split(/<\/v>/, $tresto);              # split them
     if ($linbak ne '') {
       for ($lino=0;$lino<=$#dump-1;$lino++) {   # for each DS:
-        if ($dump[$lino]=~/\d\.\d+e.(\d+)\s/) { # grab number (and not a NaN)
+        if ($dump[$lino]=~/\d\.\d+e.(\d+)\s?/) { # grab number (and not a NaN)
          $c=$&;
           $a=$1*1;                              # and exponent
           $b=substr("0$lino",-2).":$1";         # calculate the max percentage 
of this DS
-- 
2.13.6

++++++ ganglia-0023-Fix-hash-collisions.patch ++++++
From: Junichi TANAKA <junsa...@gmail.com>
Date: Wed, 31 Jan 2018 23:08:22 +0900
Git-commit: 48dbbd380cfcb4c61a3910ae16ad56ad97d4cf0b
References: bsc#1087487
Subject: [PATCH] Fix hash collisions

Acked-by: John Jolly <jjo...@suse.de>
---
 lib/hash.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/hash.c b/lib/hash.c
index a1d41e76..de922533 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -346,6 +346,10 @@ hash_delete (datum_t *key, hash_t * hash)
   for (; bucket != NULL; last = bucket, bucket = bucket->next)
     {
       node_t tmp;
+      if (bucket->key && !hash_keycmp(hash, key, bucket->key))
+        {
+          continue;
+        }
       if (bucket == &hash->node[i]) 
         {
           tmp.key = bucket->key;
-- 
2.13.6

++++++ ganglia-0024-Add-regular-Slab-memory-to-linux-memory-metrics.patch ++++++
From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= <anders.f.bjorkl...@gmail.com>
Date: Sat, 3 Feb 2018 12:51:54 +0100
Git-commit: 91b5b4c58d1aeedf99a601ae16b796125ce3da07
References: bsc#1087487
Subject: [PATCH] Add regular Slab memory to linux memory metrics

Previously only reporting reclaimable slabs, but not total slab...
There are also unreclaim slabs, can view them all with slabtop(1):

    Slab %lu
        In-kernel data structures cache.

    SReclaimable %lu (since Linux 2.6.19)
        Part of Slab, that might be reclaimed, such as caches.

    SUnreclaim %lu (since Linux 2.6.19)
        Part of Slab, that cannot be reclaimed on memory pressure.
Acked-by: John Jolly <jjo...@suse.de>
---
 ganglia.pod                    |  1 +
 gmetad/server.c                |  5 ++++-
 gmond/modules/memory/mod_mem.c |  3 +++
 libmetrics/libmetrics.h        |  2 ++
 libmetrics/linux/metrics.c     | 34 ++++++++++++++++++++++++++++++++++
 5 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/ganglia.pod b/ganglia.pod
index 6149ca1a..542c5ddf 100644
--- a/ganglia.pod
+++ b/ganglia.pod
@@ -609,6 +609,7 @@ is only partially complete).
   mem_cached    Amount of cached memory                  l,f
   mem_free      Amount of available memory               l,f
   mem_shared    Amount of shared memory                  l,f
+  mem_slab      Amount of in-kernel data struct cache    l
   mem_sreclaimable    Amount of slab reclaimable memory  l (kernel >= 2.6.19)
   mem_total     Amount of available memory               l,f
   mtu           Network maximum transmission unit        l,f
diff --git a/gmetad/server.c b/gmetad/server.c
index a2cd0ac8..9cd03403 100644
--- a/gmetad/server.c
+++ b/gmetad/server.c
@@ -119,6 +119,8 @@ static const struct metricinfo
   #ifdef LINUX
   "mem_sreclaimable", mem_sreclaimable_func, g_float},
   {
+  "mem_slab", mem_slab_func, g_float},
+  {
   #endif
   #ifdef SOLARIS
   "bread_sec", bread_sec_func, g_float},
@@ -894,7 +896,8 @@ status_report( client_t *client , char *callback)
          systemOffset += snprintf (systemBuf + systemOffset, METRICSBUFSIZE > 
systemOffset ? METRICSBUFSIZE - systemOffset : 0, "\"%s\":%u,", 
metrics[i].name, (unsigned) val.uint32);
       }
 #ifdef LINUX
-      else if(strcmp(metrics[i].name, "mem_sreclaimable") == 0){
+      else if(strcmp(metrics[i].name, "mem_slab") == 0 ||
+              strcmp(metrics[i].name, "mem_sreclaimable") == 0){
          memoryOffset += snprintf (memoryBuf + memoryOffset, METRICSBUFSIZE > 
memoryOffset ? METRICSBUFSIZE - memoryOffset : 0, "\"%s\":%f,", 
metrics[i].name, val.f);
       }
 #endif
diff --git a/gmond/modules/memory/mod_mem.c b/gmond/modules/memory/mod_mem.c
index feb8d99c..deef9615 100644
--- a/gmond/modules/memory/mod_mem.c
+++ b/gmond/modules/memory/mod_mem.c
@@ -50,6 +50,8 @@ static g_val_t mem_metric_handler ( int metric_index )
 #ifdef LINUX
     case 7:
         return mem_sreclaimable_func();
+    case 8:
+        return mem_slab_func();
 #endif
 #if HPUX
     case 7:
@@ -79,6 +81,7 @@ static Ganglia_25metric mem_metric_info[] =
     {0, "swap_total", 1200, GANGLIA_VALUE_FLOAT, "KB", "zero", "%.0f", 
UDP_HEADER_SIZE+8, "Total amount of swap space displayed in KBs"},
 #ifdef LINUX
     {0, "mem_sreclaimable", 180, GANGLIA_VALUE_FLOAT, "KB", "both", "%.0f", 
UDP_HEADER_SIZE+8, "Amount of reclaimable slab memory"},
+    {0, "mem_slab",    180, GANGLIA_VALUE_FLOAT, "KB", "both", "%.0f", 
UDP_HEADER_SIZE+8, "Amount of in-kernel data structures cache"},
 #endif
 #if HPUX
     {0, "mem_arm",     180, GANGLIA_VALUE_FLOAT, "KB", "both", "%.0f", 
UDP_HEADER_SIZE+8, "mem_arm"},
diff --git a/libmetrics/libmetrics.h b/libmetrics/libmetrics.h
index d487f542..f74a6f5e 100644
--- a/libmetrics/libmetrics.h
+++ b/libmetrics/libmetrics.h
@@ -79,7 +79,9 @@ void libmetrics_init( void );
  g_val_t location_func(void);
 
 #ifdef LINUX
+ g_val_t mem_slab_func (void);
  g_val_t mem_sreclaimable_func (void);
+ g_val_t mem_sunreclaim_func (void);
 #endif
 
 /* the following are additional internal metrics added by swagner
diff --git a/libmetrics/linux/metrics.c b/libmetrics/linux/metrics.c
index a13cc1cd..38d882e4 100644
--- a/libmetrics/linux/metrics.c
+++ b/libmetrics/linux/metrics.c
@@ -1294,6 +1294,23 @@ mem_buffers_func ( void )
 }
 
 g_val_t
+mem_slab_func ( void )
+{
+   char *p;
+   g_val_t val;
+
+   p = strstr( update_file(&proc_meminfo), "Slab:" );
+   if(p) {
+     p = skip_token(p);
+     val.f = atof( p );
+   } else {
+     val.f = 0;
+   }
+
+   return val;
+}
+
+g_val_t
 mem_sreclaimable_func ( void )
 {
    char *p;
@@ -1311,6 +1328,23 @@ mem_sreclaimable_func ( void )
 }
 
 g_val_t
+mem_sunreclaim_func ( void )
+{
+   char *p;
+   g_val_t val;
+
+   p = strstr( update_file(&proc_meminfo), "SUnreclaim:" );
+   if(p) {
+     p = skip_token(p);
+     val.f = atof( p );
+   } else {
+     val.f = 0;
+   }
+
+   return val;
+}
+
+g_val_t
 mem_cached_func ( void )
 {
    char *p;
-- 
2.13.6

++++++ ganglia-0025-Report-the-Linux-specific-slab-memory-metric.patch ++++++
From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= <anders.f.bjorkl...@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 <jjo...@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


Reply via email to