Compare commits

...
Sign in to create a new pull request.

33 commits

Author SHA1 Message Date
Terje Røsten
c3c5e6fa74 Some refactoring 2025-09-29 18:23:03 +02:00
Terje Røsten
266569fcb8 Port to epel10
Add TZ patches
Remove legacy libart_lgpl-devel buildreq
Fix URL
2025-09-28 21:48:55 +02:00
Fedora Release Engineering
66edd50471 Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-23 20:56:47 +00:00
Python Maint
a157a44a4e Rebuilt for Python 3.14 2025-06-02 19:55:46 +02:00
Terje Rosten
e2eca71c61 Follow PHP quote rules 2025-04-05 21:05:46 +02:00
Terje Røsten
c0f6480f78 Use sysusers on FC43+
Fix changelog
2025-03-29 14:42:56 +01:00
Fedora Release Engineering
70b3e9078b Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-16 19:08:37 +00:00
Terje Røsten
83e544951e Add forgotten int() conversion patch
Add forgotten int() conversion patch
Add forgotten int() conversion patch
Add forgotten int() conversion patch
Add forgotten int() conversion patch
Add forgotten int() conversion patch
2024-11-04 20:19:13 +01:00
Terje Røsten
1281146712 Various fixes to improve Python 3 support
Add back regex support on Fedora (patch from Debian, thanks!)
2024-10-16 17:37:12 +02:00
Terje Røsten
687891e888 Add patch to improve compat with PHP 8 2024-09-28 14:36:52 +02:00
Miroslav Suchý
29ae55186f convert license to SPDX
This is part of https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_4
2024-08-28 09:52:33 +02:00
Fedora Release Engineering
f4cccbd59d Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-17 23:54:26 +00:00
Terje Rosten
b9009b58fd Fix filename of patch 2024-06-24 20:09:24 +02:00
Terje Rosten
349830c918 Add Python 3 support in gmond 2024-06-24 19:58:40 +02:00
Software Management Team
620bef47c6 Eliminate use of obsolete %patchN syntax (#2283636) 2024-05-30 12:46:46 +02:00
Terje Rosten
5d847ad8fb Bump release 2024-03-10 11:23:06 +01:00
Terje Rosten
285b8167f5 Update to commit 185ab6b 2024-03-10 11:21:06 +01:00
Terje Rosten
99c85226e8 Add more PHP8 patches 2024-03-03 19:59:28 +01:00
Terje Rosten
b17383b80b Upgrade to ganglia web 3.7.6 2024-02-24 18:49:05 +01:00
Terje Rosten
8648f6c307 Fix GCC 14 issue 2024-02-05 19:57:54 +01:00
Fedora Release Engineering
1dc62b1ef9 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-24 12:16:29 +00:00
Fedora Release Engineering
559d39e862 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-19 20:02:23 +00:00
Fedora Release Engineering
fa7db9ef40 Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-19 20:31:28 +00:00
Fedora Release Engineering
8c6c2dff07 Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-19 04:07:37 +00:00
Terje Rosten
31762b54b3 Fix various bugs 2023-01-12 18:33:11 +01:00
Fedora Release Engineering
9a78407166 Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-21 03:52:07 +00:00
Fedora Release Engineering
b8b2bfb7c7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-20 03:39:44 +00:00
Terje Rosten
2bea70ceb0 Need sasl bits to build 2021-09-09 21:43:54 +02:00
Terje Rosten
e79cdf6807 Minor cosmetics 2021-09-09 21:23:16 +02:00
Fedora Release Engineering
bd93a38b48 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-21 23:34:39 +00:00
Zbigniew Jędrzejewski-Szmek
7a6681606f Rebuilt for updated systemd-rpm-macros
See https://pagure.io/fesco/issue/2583.
2021-03-02 16:13:45 +01:00
Fedora Release Engineering
d13c5c3863 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-26 06:08:05 +00:00
Tom Stellard
04abe53473 Add BuildRequires: make
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot
2020-12-18 23:03:08 +00:00
21 changed files with 4139 additions and 193 deletions

1
.gitignore vendored
View file

@ -14,3 +14,4 @@ ganglia-3.1.7.tar.gz
/ganglia-web-3.7.1.tar.gz
/ganglia-web-3.7.2.tar.gz
/ganglia-web-3.7.5.tar.gz
/ganglia-web-3.7.6.tar.gz

View file

@ -0,0 +1,60 @@
From 4ca52a1be8ef9b2ce1c62fdb4e5ba4db44132ad0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Terje=20R=C3=B8sten?= <terjeros@gmail.com>
Date: Tue, 15 Oct 2024 20:24:40 +0200
Subject: [PATCH] Fix return value from mod_python init
---
gmond/modules/python/mod_python.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/gmond/modules/python/mod_python.c b/gmond/modules/python/mod_python.c
index 484429e..cdfeb7e 100644
--- a/gmond/modules/python/mod_python.c
+++ b/gmond/modules/python/mod_python.c
@@ -601,11 +601,14 @@ static struct PyModuleDef moduledef = {
#define INITERROR return NULL
PyMODINIT_FUNC PyInit_metric_init(apr_pool_t *p)
+
#else
+
#define INITERROR return
static int pyth_metric_init (apr_pool_t *p)
#endif
+
{
DIR *dp;
struct dirent *entry;
@@ -796,6 +799,16 @@ static int pyth_metric_init (apr_pool_t *p)
#endif
}
+#if PY_MAJOR_VERSION >= 3
+static int pyth_metric_init (apr_pool_t *p) {
+ if (PyInit_metric_init(p) == NULL) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+#endif
+
static apr_status_t pyth_metric_cleanup ( void *data)
{
PyObject *pcleanup, *pobj;
@@ -913,11 +926,7 @@ static g_val_t pyth_metric_handler( int metric_index )
mmodule python_module =
{
STD_MMODULE_STUFF,
-#if PY_MAJOR_VERSION >= 3
- (int (*)(apr_pool_t *))PyInit_metric_init,
-#else
pyth_metric_init,
-#endif
NULL,
NULL, /* defined dynamically */
pyth_metric_handler,
--
2.47.0

View file

@ -0,0 +1,34 @@
From 092f16cafa0a1ef5f001a35b54dd896f601f1428 Mon Sep 17 00:00:00 2001
From: Vladimir Vuksan <44271-vvuksan-fastly@users.noreply.drupalcode.org>
Date: Mon, 5 May 2025 10:16:00 -0400
Subject: [PATCH 1/2] Sanitize input for timezone
---
graph.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/graph.php b/graph.php
index e8a7a9c..fdf9c86 100644
--- a/graph.php
+++ b/graph.php
@@ -946,7 +946,7 @@ function rrdgraph_cmd_build($rrdtool_graph,
$command = '';
if (isset($_SESSION['tz']) && ($_SESSION['tz'] != ''))
- $command .= "TZ='" . $_SESSION['tz'] . "' ";
+ $command .= "TZ='" . escapeshellcmd($_SESSION['tz']) . "' ";
$command .=
$conf['rrdtool'] .
@@ -1123,7 +1123,7 @@ function output_data_to_external_format($rrdtool_graph_series,
$command = '';
if (isset($_SESSION['tz']) && ($_SESSION['tz'] != ''))
- $command .= "TZ='" . $_SESSION['tz'] . "' ";
+ $command .= "TZ='" . escapeshellcmd($_SESSION['tz']) . "' ";
$command .= $rrdtool .
" xport --start '" . $rrdtool_graph_start .
--
2.51.0

1080
0002-2to3-pass.patch Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,25 @@
From bd2a339a510f0da021d3adededdfa98006f03001 Mon Sep 17 00:00:00 2001
From: Vladimir Vuksan <44271-vvuksan-fastly@users.noreply.drupalcode.org>
Date: Mon, 5 May 2025 10:30:48 -0400
Subject: [PATCH 2/2] Validate that the supplied timezone is a valid timezone
---
header.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/header.php b/header.php
index 729fe27..a50c41b 100644
--- a/header.php
+++ b/header.php
@@ -1,7 +1,7 @@
<?php
session_start();
-if (isset($_GET['tz'])) {
+if (isset($_GET['tz']) && in_array($_GET['tz'], timezone_identifiers_list())) {
$_SESSION['tz'] = $_GET['tz'];
}
--
2.51.0

534
0003-Ruff-pass.patch Normal file
View file

@ -0,0 +1,534 @@
From 0be29755dcea7e19bc347b273fa38787ecb57252 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Terje=20R=C3=B8sten?= <terjeros@gmail.com>
Date: Mon, 14 Oct 2024 20:27:57 +0200
Subject: [PATCH 3/3] Ruff pass
---
.../apache_status/apache_status.py | 5 +--
gmond/python_modules/cpu/cpu_stats.py | 3 --
gmond/python_modules/db/DBUtil.py | 6 ++--
gmond/python_modules/db/mysql.py | 2 +-
gmond/python_modules/db/redis.py | 4 +--
gmond/python_modules/db/riak.py | 9 +++---
gmond/python_modules/disk/diskstat.py | 4 +--
gmond/python_modules/disk/multidisk.py | 4 +--
gmond/python_modules/memcached/memcached.py | 6 ++--
gmond/python_modules/memory/mem_stats.py | 3 --
.../python_modules/network/multi_interface.py | 2 +-
gmond/python_modules/network/netstats.py | 4 +--
gmond/python_modules/network/tcpconn.py | 6 ++--
gmond/python_modules/network/traffic1.py | 4 +--
gmond/python_modules/nfs/nfsstats.py | 6 ++--
gmond/python_modules/process/procstat.py | 32 +++++++++----------
gmond/python_modules/ssl/entropy.py | 5 ++-
gmond/python_modules/varnish/varnish.py | 2 +-
gmond/python_modules/vm_stats/vm_stats.py | 1 -
gmond/python_modules/xen/xenstats.py | 2 --
20 files changed, 50 insertions(+), 60 deletions(-)
diff --git a/gmond/python_modules/apache_status/apache_status.py b/gmond/python_modules/apache_status/apache_status.py
index fba14ee..d375d74 100755
--- a/gmond/python_modules/apache_status/apache_status.py
+++ b/gmond/python_modules/apache_status/apache_status.py
@@ -2,9 +2,10 @@
# -*- coding: utf-8 -*-
import os
-import threading
import time
-import urllib.request, urllib.error, urllib.parse
+import urllib.request
+import urllib.error
+import urllib.parse
import traceback
import re
import copy
diff --git a/gmond/python_modules/cpu/cpu_stats.py b/gmond/python_modules/cpu/cpu_stats.py
index 16d6165..ab518cc 100644
--- a/gmond/python_modules/cpu/cpu_stats.py
+++ b/gmond/python_modules/cpu/cpu_stats.py
@@ -1,6 +1,3 @@
-import sys
-import traceback
-import os
import re
import time
import copy
diff --git a/gmond/python_modules/db/DBUtil.py b/gmond/python_modules/db/DBUtil.py
index 66f8a78..c7e7473 100644
--- a/gmond/python_modules/db/DBUtil.py
+++ b/gmond/python_modules/db/DBUtil.py
@@ -28,7 +28,7 @@ pure python collections.defaultdict substitute
#from collections import defaultdict
try:
from collections import defaultdict
-except:
+except ImportError:
class defaultdict(dict):
def __init__(self, default_factory=None, *a, **kw):
if (default_factory is not None and
@@ -79,9 +79,9 @@ def longish(x):
try:
return int(x)
except ValueError:
- if(x.endswith(',')):
+ if x.endswith(','):
return longish(x[:-1])
- if(is_hex(x.lower()) == True):
+ if is_hex(x.lower()):
return hexlongish(x)
#print "X==(%s)(%s)(%s)" %(x, x[:-1],hexlongish(x)), sys.exc_info()[0]
return longish(x[:-1])
diff --git a/gmond/python_modules/db/mysql.py b/gmond/python_modules/db/mysql.py
index 065a6cd..5aae1cf 100644
--- a/gmond/python_modules/db/mysql.py
+++ b/gmond/python_modules/db/mysql.py
@@ -354,7 +354,7 @@ def get_stat(name):
logging.debug("fetching %s" % name)
try:
return mysql_stats[label]
- except:
+ except KeyError:
logging.error("failed to fetch %s" % name)
return 0
else:
diff --git a/gmond/python_modules/db/redis.py b/gmond/python_modules/db/redis.py
index 9101b49..285a625 100755
--- a/gmond/python_modules/db/redis.py
+++ b/gmond/python_modules/db/redis.py
@@ -34,7 +34,7 @@ def metric_handler(name):
if metric_handler.auth is not None:
s.send("*2\r\n$4\r\nAUTH\r\n$%d\r\n%s\r\n" % (len(metric_handler.auth), metric_handler.auth))
result = s.recv(100)
- if not 'OK' in result:
+ if 'OK' not in result:
return 0
s.send("*1\r\n$4\r\nINFO\r\n")
#logging.debug("sent INFO")
@@ -83,7 +83,7 @@ def metric_handler(name):
v = cps
#logging.debug("submittincg metric %s is %s" % (n, int(v)))
metric_handler.info[n] = int(v) # TODO Use value_type.
- except Exception as e:
+ except Exception:
#logging.debug("caught exception %s" % e)
pass
s.close()
diff --git a/gmond/python_modules/db/riak.py b/gmond/python_modules/db/riak.py
index 499a04f..a399931 100755
--- a/gmond/python_modules/db/riak.py
+++ b/gmond/python_modules/db/riak.py
@@ -24,7 +24,9 @@ import os
import sys
import threading
import time
-import urllib.request, urllib.error, urllib.parse
+import urllib.request
+import urllib.error
+import urllib.parse
import traceback
import json
@@ -44,7 +46,7 @@ def floatable(str):
try:
float(str)
return True
- except:
+ except ValueError:
return False
@@ -102,7 +104,6 @@ class UpdateMetricThread(threading.Thread):
def metric_of(self, name):
val = 0
- mp = name.split("_")[0]
if name in self.metric:
_Lock.acquire()
val = self.metric[name]
@@ -1062,6 +1063,6 @@ if __name__ == '__main__':
except KeyboardInterrupt:
time.sleep(0.2)
os._exit(1)
- except:
+ except Exception:
traceback.print_exc()
os._exit(1)
diff --git a/gmond/python_modules/disk/diskstat.py b/gmond/python_modules/disk/diskstat.py
index 79962ca..aea335f 100644
--- a/gmond/python_modules/disk/diskstat.py
+++ b/gmond/python_modules/disk/diskstat.py
@@ -386,7 +386,7 @@ def get_stat(name):
try:
return stats[dev][label]
- except:
+ except Exception:
logging.warning('failed to fetch [' + dev + '] ' + name)
return 0
else:
@@ -394,7 +394,7 @@ def get_stat(name):
try:
return stats[label]
- except:
+ except Exception:
logging.warning('failed to fetch ' + name)
return 0
diff --git a/gmond/python_modules/disk/multidisk.py b/gmond/python_modules/disk/multidisk.py
index b26bf59..5ad59b5 100644
--- a/gmond/python_modules/disk/multidisk.py
+++ b/gmond/python_modules/disk/multidisk.py
@@ -108,8 +108,8 @@ def metric_init(params):
global descriptors
f = open('/proc/mounts', 'r')
- for l in f:
- line = l.split()
+ for buff in f:
+ line = buff.split()
if line[3].startswith('ro'):
continue
elif Remote_Mount(line[0], line[2]):
diff --git a/gmond/python_modules/memcached/memcached.py b/gmond/python_modules/memcached/memcached.py
index 8bdb57c..b5c3df4 100644
--- a/gmond/python_modules/memcached/memcached.py
+++ b/gmond/python_modules/memcached/memcached.py
@@ -26,7 +26,7 @@ def floatable(str):
try:
float(str)
return True
- except:
+ except ValueError:
return False
@@ -58,7 +58,7 @@ class UpdateMetricThread(threading.Thread):
return
try:
self.join()
- except:
+ except Exception:
pass
def run(self):
@@ -396,6 +396,6 @@ if __name__ == '__main__':
except KeyboardInterrupt:
time.sleep(0.2)
os._exit(1)
- except:
+ except Exception:
traceback.print_exc()
os._exit(1)
diff --git a/gmond/python_modules/memory/mem_stats.py b/gmond/python_modules/memory/mem_stats.py
index b0cdc16..0a6dd6a 100644
--- a/gmond/python_modules/memory/mem_stats.py
+++ b/gmond/python_modules/memory/mem_stats.py
@@ -1,6 +1,3 @@
-import sys
-import traceback
-import os
import re
diff --git a/gmond/python_modules/network/multi_interface.py b/gmond/python_modules/network/multi_interface.py
index e4b1b04..c9f898f 100644
--- a/gmond/python_modules/network/multi_interface.py
+++ b/gmond/python_modules/network/multi_interface.py
@@ -94,7 +94,7 @@ def metric_init(params):
Desc_Skel = {
'name' : 'XXX',
'call_back' : get_delta,
- 'time_max' : 60,
+ 'time_max' : time_max,
'value_type' : 'float',
'format' : '%.0f',
'units' : '/s',
diff --git a/gmond/python_modules/network/netstats.py b/gmond/python_modules/network/netstats.py
index ba0c56f..ec65d1e 100644
--- a/gmond/python_modules/network/netstats.py
+++ b/gmond/python_modules/network/netstats.py
@@ -2,11 +2,11 @@
#
# /proc/net/netstat
-import sys
import re
import time
import copy
-import string
+
+NAME_PREFIX = 'netstat_'
PARAMS = {}
diff --git a/gmond/python_modules/network/tcpconn.py b/gmond/python_modules/network/tcpconn.py
index b97d0ed..cf55a6d 100644
--- a/gmond/python_modules/network/tcpconn.py
+++ b/gmond/python_modules/network/tcpconn.py
@@ -31,6 +31,8 @@
#******************************************************************************/
import os
+import threading
+import time
OBSOLETE_POPEN = False
try:
@@ -39,8 +41,6 @@ except ImportError:
import popen2
OBSOLETE_POPEN = True
-import threading
-import time
_WorkerThread = None # Worker thread object
_glock = threading.Lock() # Synchronization lock
@@ -230,7 +230,7 @@ class NetstatThread(threading.Thread):
def shutdown(self):
self.shuttingdown = True
- if self.popenChild != None:
+ if self.popenChild is not None:
try:
self.popenChild.wait()
except OSError as e:
diff --git a/gmond/python_modules/network/traffic1.py b/gmond/python_modules/network/traffic1.py
index 9f1078f..c5fdcba 100644
--- a/gmond/python_modules/network/traffic1.py
+++ b/gmond/python_modules/network/traffic1.py
@@ -67,8 +67,8 @@ class UpdateTrafficThread(threading.Thread):
def update_metric(self):
f = open(self.proc_file, "r")
- for l in f:
- a = l.split(":")
+ for buff in f:
+ a = buff.split(":")
dev = a[0].lstrip()
if dev != self.target_device:
continue
diff --git a/gmond/python_modules/nfs/nfsstats.py b/gmond/python_modules/nfs/nfsstats.py
index 618b1be..2d3d279 100644
--- a/gmond/python_modules/nfs/nfsstats.py
+++ b/gmond/python_modules/nfs/nfsstats.py
@@ -10,8 +10,6 @@
# 2) the code is structured in a way intended to make it easy to repurpose
# the code for extracting other information out of /proc
-import os
-import stat
import re
import time
import syslog
@@ -262,7 +260,7 @@ def metric_init(params):
else:
tests_passed = False
break
- except:
+ except Exception:
tests_passed = False
break
if not tests_passed:
@@ -362,7 +360,7 @@ def get_value(name):
for i in range(0, len(descriptors)):
if descriptors[i]['name'] == name:
break
- contents = file(descriptors[i]['file']).read()
+ contents = open(descriptors[i]['file']).read()
m = re.search(descriptors[i]['re'], contents, flags=re.MULTILINE)
m_value = m.group(1)
diff --git a/gmond/python_modules/process/procstat.py b/gmond/python_modules/process/procstat.py
index aad5229..e5c3f9a 100644
--- a/gmond/python_modules/process/procstat.py
+++ b/gmond/python_modules/process/procstat.py
@@ -128,14 +128,14 @@ PROCESSES = {}
def readCpu(pid):
try:
- stat = file('/proc/' + pid + '/stat', 'rt').readline().split()
+ stat = open('/proc/' + pid + '/stat', 'rt').readline().split()
#logging.debug(' stat (' + pid + '): ' + str(stat))
utime = int(stat[13])
stime = int(stat[14])
cutime = int(stat[15])
cstime = int(stat[16])
return (utime + stime + cutime + cstime)
- except:
+ except Exception:
logging.warning('failed to get (' + str(pid) + ') stats')
return 0
@@ -152,8 +152,8 @@ def get_pgid(proc):
if '.pid' in val[-4:]:
if os.path.exists(val):
logging.debug(' pidfile found')
- ppid = file(val, 'rt').readline().strip()
- pgid = file('/proc/' + ppid + '/stat', 'rt').readline().split()[4]
+ ppid = open(val, 'rt').readline().strip()
+ pgid = open('/proc/' + ppid + '/stat', 'rt').readline().split()[4]
else:
raise Exception('pidfile (' + val + ') does not exist')
@@ -195,10 +195,10 @@ def get_pgroup(ppid, pgid):
p_list = []
for stat_file in glob.glob('/proc/[1-9]*/stat'):
try:
- stat = file(stat_file, 'rt').readline().split()
+ stat = open(stat_file, 'rt').readline().split()
if stat[4] == pgid:
p_list.append(stat[0])
- except:
+ except Exception:
# likely the pid has exited. this is normal.
pass
@@ -225,7 +225,7 @@ def get_rss(pids):
try:
statm = open('/proc/' + p + '/statm', 'rt').readline().split()
#logging.debug(' statm (' + p + '): ' + str(statm))
- except:
+ except Exception:
# Process finished, ignore this mem usage
logging.warning(' failed getting statm for pid: ' + p)
continue
@@ -261,7 +261,7 @@ def test(params):
print(' PID, ARGS')
for pid in pids:
# Read from binary file containing command line arguments
- args = file('/proc/' + pid + '/cmdline', 'rt').readline().replace('\0', ' ')
+ args = open('/proc/' + pid + '/cmdline', 'rt').readline().replace('\0', ' ')
print((' ' + pid + ' ' + args))
logging.debug('success testing')
@@ -283,9 +283,9 @@ def update_stats():
logging.debug(' updating for ' + proc)
# setup storage lists
- if not proc in stats:
+ if proc not in stats:
stats[proc] = {}
- if not proc in last_val:
+ if proc not in last_val:
last_val[proc] = {}
#####
@@ -347,7 +347,7 @@ def get_stat(name):
try:
return stats[proc][label]
- except:
+ except Exception:
logging.warning('failed to fetch [' + proc + '] ' + name)
return 0
else:
@@ -355,7 +355,7 @@ def get_stat(name):
try:
return stats[label]
- except:
+ except Exception:
logging.warning('failed to fetch ' + name)
return 0
else:
@@ -420,7 +420,7 @@ def metric_init(params):
def display_proc_stat(pid):
try:
- stat = file('/proc/' + pid + '/stat', 'rt').readline().split()
+ stat = open('/proc/' + pid + '/stat', 'rt').readline().split()
fields = [
'pid', 'comm', 'state', 'ppid', 'pgrp', 'session',
@@ -438,14 +438,14 @@ def display_proc_stat(pid):
print('%15s: %s' % (f, stat[i]))
i += 1
- except:
+ except Exception:
print(('failed to get /proc/' + pid + '/stat'))
print((traceback.print_exc(file=sys.stdout)))
def display_proc_statm(pid):
try:
- statm = file('/proc/' + pid + '/statm', 'rt').readline().split()
+ statm = open('/proc/' + pid + '/statm', 'rt').readline().split()
fields = [
'size', 'rss', 'share', 'trs', 'drs', 'lrs', 'dt'
@@ -457,7 +457,7 @@ def display_proc_statm(pid):
print('%15s: %s' % (f, statm[i]))
i += 1
- except:
+ except Exception:
print(('failed to get /proc/' + pid + '/statm'))
print((traceback.print_exc(file=sys.stdout)))
diff --git a/gmond/python_modules/ssl/entropy.py b/gmond/python_modules/ssl/entropy.py
index 71193c6..bb9f67c 100644
--- a/gmond/python_modules/ssl/entropy.py
+++ b/gmond/python_modules/ssl/entropy.py
@@ -7,7 +7,6 @@
# (it can reuse the pool of bits).
# Therefore if you are running SSL on the box you want to know this.
-import sys
entropy_file = "/proc/sys/kernel/random/entropy_avail"
@@ -20,8 +19,8 @@ def metrics_handler(name):
except IOError:
return 0
- for l in f:
- line = l
+ for buff in f:
+ line = buff
return int(line)
diff --git a/gmond/python_modules/varnish/varnish.py b/gmond/python_modules/varnish/varnish.py
index b1a8573..e5c1b75 100755
--- a/gmond/python_modules/varnish/varnish.py
+++ b/gmond/python_modules/varnish/varnish.py
@@ -143,7 +143,7 @@ def metric_init(lparams):
Desc_Skel = {
'name' : 'XXX',
'call_back' : 'XXX',
- 'time_max' : 60,
+ 'time_max' : time_max,
'value_type' : 'float',
'format' : '%f',
'units' : 'XXX',
diff --git a/gmond/python_modules/vm_stats/vm_stats.py b/gmond/python_modules/vm_stats/vm_stats.py
index 2e1e8b8..8eb9c11 100644
--- a/gmond/python_modules/vm_stats/vm_stats.py
+++ b/gmond/python_modules/vm_stats/vm_stats.py
@@ -3,7 +3,6 @@
#
# /proc/vmstat
-import sys
import re
import time
import copy
diff --git a/gmond/python_modules/xen/xenstats.py b/gmond/python_modules/xen/xenstats.py
index bdb3750..1c328e4 100755
--- a/gmond/python_modules/xen/xenstats.py
+++ b/gmond/python_modules/xen/xenstats.py
@@ -18,8 +18,6 @@
# MA 02110-1301, USA.
import libvirt
-import os
-import time
descriptors = list()
conn = libvirt.openReadOnly("xen:///")
--
2.47.0

View file

@ -0,0 +1,62 @@
From 21656da69738482cca947cb70ad9ef25ac95cbfa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Terje=20R=C3=B8sten?= <terjeros@gmail.com>
Date: Mon, 14 Oct 2024 20:36:13 +0200
Subject: [PATCH 4/4] Use raw strings
---
gmond/python_modules/memory/mem_stats.py | 2 +-
gmond/python_modules/network/netstats.py | 4 ++--
gmond/python_modules/vm_stats/vm_stats.py | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gmond/python_modules/memory/mem_stats.py b/gmond/python_modules/memory/mem_stats.py
index 0a6dd6a..522268e 100644
--- a/gmond/python_modules/memory/mem_stats.py
+++ b/gmond/python_modules/memory/mem_stats.py
@@ -26,7 +26,7 @@ def metrics_handler(name):
if name == 'mem_swap_used':
return metrics_handler('mem_swap_total') - metrics_handler('mem_swap_free')
for line in file:
- parts = re.split("\s+", line)
+ parts = re.split(r"\s+", line)
if parts[0] == metric_map[name]['name'] + ":":
# All of the measurements are in kBytes. We want to change them over
# to Bytes
diff --git a/gmond/python_modules/network/netstats.py b/gmond/python_modules/network/netstats.py
index ec65d1e..3805f4b 100644
--- a/gmond/python_modules/network/netstats.py
+++ b/gmond/python_modules/network/netstats.py
@@ -46,7 +46,7 @@ def get_metrics():
for line in file:
if re.match("(.*): [0-9]", line):
count = 0
- metrics = re.split("\s+", line)
+ metrics = re.split(r"\s+", line)
metric_group = metrics[0].replace(":", "").lower()
if metric_group not in stats_pos:
continue
@@ -202,7 +202,7 @@ def metric_init(params):
# Lines with
if not re.match("(.*): [0-9]", line):
count = 0
- mapping = re.split("\s+", line)
+ mapping = re.split(r"\s+", line)
metric_group = mapping[0].replace(":", "").lower()
stats_pos[metric_group] = dict()
for metric in mapping:
diff --git a/gmond/python_modules/vm_stats/vm_stats.py b/gmond/python_modules/vm_stats/vm_stats.py
index 8eb9c11..fc5a241 100644
--- a/gmond/python_modules/vm_stats/vm_stats.py
+++ b/gmond/python_modules/vm_stats/vm_stats.py
@@ -46,7 +46,7 @@ def get_metrics():
# convert to dict
metrics = {}
for line in file:
- parts = re.split("\s+", line)
+ parts = re.split(r"\s+", line)
metrics[parts[0]] = parts[1]
# update cache
--
2.47.0

View file

@ -0,0 +1,27 @@
From 1d9688e7059d0a93c27bf4e74f26ad3cf1120837 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Terje=20R=C3=B8sten?= <terjeros@gmail.com>
Date: Mon, 4 Nov 2024 20:06:47 +0100
Subject: [PATCH 5/5] First loop might contain non integer input
---
gmond/python_modules/network/netstats.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gmond/python_modules/network/netstats.py b/gmond/python_modules/network/netstats.py
index 3805f4b..76f6b68 100644
--- a/gmond/python_modules/network/netstats.py
+++ b/gmond/python_modules/network/netstats.py
@@ -52,6 +52,10 @@ def get_metrics():
continue
new_metrics[metric_group] = dict()
for value in metrics:
+ try:
+ value = int(value)
+ except ValueError:
+ value = -1
# Skip first
if count > 0 and value >= 0 and count in stats_pos[metric_group]:
metric_name = stats_pos[metric_group][count]
--
2.47.0

1413
ganglia-3.7.2-185ab6.patch Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,11 +0,0 @@
--- gmond/python_modules/apache_status/apache_status.py.orig 2015-08-19 09:34:42.310000000 +1200
+++ gmond/python_modules/apache_status/apache_status.py 2015-08-19 09:35:33.989000000 +1200
@@ -86,6 +86,8 @@
for sck in split_line[1]:
metrics[ Scoreboard_bykey[sck] ] += 1
else:
+ if len(split_line) == 1:
+ continue
if long_metric_name in Metric_Map:
metric_name = Metric_Map[long_metric_name]
else:

View file

@ -0,0 +1,32 @@
diff --git a/configure.ac b/configure.ac
index fe7983b..d0a6d18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -319,22 +319,17 @@ if test x"$enable_python" = xyes; then
if test -n "$PYTHON_BIN"; then
# find out python version
AC_MSG_CHECKING(Python version)
- PyVERSION=`$PYTHON_BIN -c ['import sys; print sys.version[:3]'`]
- PyMAJVERSION=`$PYTHON_BIN -c ['import sys; print sys.version[:1]'`]
+ PyVERSION=`$PYTHON_BIN -c ['import sys; print("%s.%s%s" % (sys.version_info.major, sys.version_info.minor, sys.abiflags))'`]
+ PyMAJVERSION=`$PYTHON_BIN -c ['import sys; print(sys.version_info.major)'`]
AC_MSG_RESULT($PyVERSION)
PYTHON_VERSION=$PyVERSION
AC_SUBST(PYTHON_VERSION)
-
- PyEXEC_INSTALLDIR=`$PYTHON_BIN -c "import sys; print sys.exec_prefix"`
- if test -f "$PyEXEC_INSTALLDIR/include/python/Python.h"; then
- PYTHON_INCLUDES="-I$PyEXEC_INSTALLDIR/include/python"
+ PyINC_DIR=`$PYTHON_BIN -c ['import sysconfig; print(sysconfig.get_paths()["include"])'`]
+ if test -f "$PyINC_DIR/Python.h"; then
+ PYTHON_INCLUDES="-I$PyINC_DIR"
else
- if test -f "$PyEXEC_INSTALLDIR/include/python$PyVERSION/Python.h"; then
- PYTHON_INCLUDES="-I$PyEXEC_INSTALLDIR/include/python$PyVERSION"
- else
PYTHON_INCLUDES=""
enable_python="no"
- fi
fi
AC_SUBST(PYTHON_INCLUDES)
else

View file

@ -0,0 +1,33 @@
--- ganglia-3.7.2/gmond/gmond.c~ 2015-07-01 21:49:35.000000000 +0200
+++ ganglia-3.7.2/gmond/gmond.c 2024-02-05 19:54:03.584404224 +0100
@@ -2060,7 +2060,7 @@
debug_msg("failed to allocate gzip stream");
goto close_accept_socket;
}
- apr_status_t r = apr_socket_data_set(client, strm, GZIP_KEY, &zstream_destroy);
+ apr_status_t r = apr_socket_data_set(client, strm, GZIP_KEY, (int (*)(void *))&zstream_destroy);
if (r != APR_SUCCESS)
{
debug_msg("failed to set socket user data");
diff --git a/gmetad/rrd_helpers.c b/gmetad/rrd_helpers.c
index 740799a..3f39071 100644
--- a/gmetad/rrd_helpers.c
+++ b/gmetad/rrd_helpers.c
@@ -199,7 +199,7 @@ reconnect:
static int
RRD_update( char *rrd, const char *sum, const char *num, unsigned int process_time )
{
- char *argv[3];
+ const char *argv[3];
int argc = 3;
char val[128];
@@ -235,7 +235,7 @@ RRD_create( char *rrd, int summary, unsigned int step,
unsigned int process_time, ganglia_slope_t slope)
{
const char *data_source_type = "GAUGE";
- char *argv[128];
+ const char *argv[128];
int argc=0;
int heartbeat;
char s[16], start[64];

126
ganglia-3.7.2-pcre2.patch Normal file
View file

@ -0,0 +1,126 @@
From https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1000041
--- ganglia.orig/configure.ac
+++ ganglia/configure.ac
@@ -520,14 +520,20 @@
echo "Added -L$libpcrepath/${LIB_SUFFIX} to LDFLAGS"
fi
if test x"$libpcre" == xyes ; then
- AC_CHECK_HEADERS([pcre/pcre.h pcre.h])
- AC_CHECK_LIB(pcre, pcre_compile)
- if test x"$ac_cv_lib_pcre_pcre_compile" = xyes; then
- echo "Found a suitable pcre library"
- else
- echo "libpcre not found, specify --with-libpcre=no to build without PCRE support"
- exit 1;
- fi
+ AC_CHECK_HEADERS([pcre2.h], [], [], [[#define PCRE2_CODE_UNIT_WIDTH 8]])
+ LIBS="$LIBS -lpcre2-8"
+ AC_MSG_CHECKING([for pcre2_match_data_create in -lpcre2-8])
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[#define PCRE2_CODE_UNIT_WIDTH 8
+ #include <pcre2.h>
+ ]],
+ [[pcre2_match_data *md;
+ md = pcre2_match_data_create (16, NULL);]])],
+ [AC_DEFINE([HAVE_LIBPCRE], [1], [Define if the PCRE2 library is available])
+ AC_MSG_RESULT([yes])
+ AC_MSG_RESULT([Found a suitable pcre library])],
+ [AC_MSG_RESULT([no])
+ AC_MSG_FAILURE([libpcre not found, specify --with-libpcre=no to build without PCRE support], [1])])
else
echo "building without PCRE support"
fi
--- ganglia.orig/gmond/gmond.c
+++ ganglia/gmond/gmond.c
@@ -38,11 +38,8 @@
#include <apr_version.h>
#ifdef HAVE_LIBPCRE
-#if defined (HAVE_PCRE_PCRE_H)
-#include <pcre/pcre.h>
-#else
-#include <pcre.h>
-#endif
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include <pcre2.h>
#endif
#include "cmdline.h" /* generated by cmdline.sh which runs gengetopt */
@@ -2650,10 +2647,11 @@
if(name_match != NULL)
{
- pcre *pcre_re;
- const char *pcre_err_ptr;
- int pcre_err_offset;
- int pcre_ovector[PCRE_OVECCOUNT];
+ pcre2_code *pcre_re;
+ pcre2_match_data *pcre_md;
+ int pcre_err_ptr;
+ size_t pcre_err_offset;
+ size_t *pcre_ovector;
int pcre_rc;
apr_hash_index_t *hi;
@@ -2662,9 +2660,9 @@
const char *key;
int found = 0;
- if((pcre_re = pcre_compile(name_match, 0, &pcre_err_ptr, &pcre_err_offset, NULL)) == NULL)
+ if((pcre_re = pcre2_compile((PCRE2_SPTR)name_match, PCRE2_ZERO_TERMINATED, 0, &pcre_err_ptr, &pcre_err_offset, NULL)) == NULL)
{
- err_msg ("pcre_compile failed on %s\n", name_match);
+ err_msg ("pcre2_compile failed on %s\n", name_match);
exit (1);
}
@@ -2676,6 +2674,8 @@
exit(EXIT_FAILURE);
}
+ pcre_md = pcre2_match_data_create(PCRE_OVECCOUNT, NULL);
+
for(hi = apr_hash_first(p, metric_callbacks);
hi;
hi = apr_hash_next(hi))
@@ -2683,17 +2683,17 @@
Ganglia_metric_callback *cb;
apr_hash_this(hi, (const void**)&key, NULL, &val);
- if((pcre_rc = pcre_exec(pcre_re, NULL, key, strlen(key), 0, 0, pcre_ovector, PCRE_OVECCOUNT)) < 1)
+ if((pcre_rc = pcre2_match(pcre_re, (PCRE2_SPTR)key, strlen(key), 0, 0, pcre_md, NULL)) < 1)
{
switch(pcre_rc)
{
- case PCRE_ERROR_NOMATCH:
+ case PCRE2_ERROR_NOMATCH:
break;
case 0:
/* output vector not big enough */
default:
/* unexpected error */
- err_msg ("unexpected pcre_exec error\n");
+ err_msg ("unexpected pcre2_match error\n");
exit (1);
}
}
@@ -2703,6 +2703,8 @@
char *title_tmpl = cfg_getstr ( metric, "title");
float value_threshold = cfg_getfloat( metric, "value_threshold");
+ pcre_ovector = pcre2_get_ovector_pointer(pcre_md);
+
if(title_tmpl != NULL)
{
struct iovec *ptrs;
@@ -2772,6 +2774,8 @@
if (!found)
err_msg("Unable to find any metric information for '%s'. Possible that a module has not been loaded.\n", name_match);
+ pcre2_match_data_free(pcre_md);
+ pcre2_code_free(pcre_re);
}
else
#endif

View file

@ -1,13 +0,0 @@
--- gmond/sflow.c.orig 2016-12-02 09:56:38.744353600 +0000
+++ gmond/sflow.c 2016-12-02 09:47:45.666353600 +0000
@@ -303,7 +303,8 @@
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);

View file

@ -0,0 +1,176 @@
diff --git a/gmond/modules/python/mod_python.c b/gmond/modules/python/mod_python.c
index ed5a401..484429e 100644
--- a/gmond/modules/python/mod_python.c
+++ b/gmond/modules/python/mod_python.c
@@ -29,6 +29,10 @@
*
* Author: Brad Nicholes (bnicholes novell.com)
* Jon Carey (jcarey novell.com)
+*
+* Modified for Python3 support, based on code at https://docs.python.org/3.5/howto/cporting.html
+* Tom Crane (T.Crane@rhul.ac.uk), June 2024.
+*
******************************************************************************/
#include <Python.h>
@@ -51,12 +55,23 @@
/*
* Backward compatibility for 2.1 to 2.4
*/
+#if PY_MAJOR_VERSION < 3
#if PY_MINOR_VERSION < 5
#define Py_ssize_t int
#if PY_MINOR_VERSION < 3
#define PyInt_AsUnsignedLongMask PyInt_AsLong
#endif
#endif
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+# define PyInt_AsLong(x) (PyLong_AsLong((x)))
+# define PyInt_Check(x) (PyLong_Check((x)))
+# define PyString_Check(x) (PyUnicode_Check((x)))
+# define PyString_AsString(x) (PyUnicode_AsUTF8((x)))
+# define PyInt_AsUnsignedLongMask(x) (PyLong_AsUnsignedLongMask((x)))
+# define PyString_FromString(x) (PyUnicode_FromString((x)))
+#endif
/*
* Declare ourselves so the configuration routines can find and know us.
@@ -540,7 +555,57 @@ static PyMethodDef GangliaMethods[] = {
{NULL, NULL, 0, NULL}
};
+struct module_state {
+ PyObject *error;
+};
+
+#if PY_MAJOR_VERSION >= 3
+#define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
+#else
+#define GETSTATE(m) (&_state)
+static struct module_state _state;
+#endif
+
+static PyObject *
+error_out(PyObject *m) {
+ struct module_state *st = GETSTATE(m);
+ PyErr_SetString(st->error, "something bad happened");
+ return NULL;
+}
+
+#if PY_MAJOR_VERSION >= 3
+
+static int ganglia_traverse(PyObject *m, visitproc visit, void *arg) {
+ Py_VISIT(GETSTATE(m)->error);
+ return 0;
+}
+
+static int ganglia_clear(PyObject *m) {
+ Py_CLEAR(GETSTATE(m)->error);
+ return 0;
+}
+
+
+static struct PyModuleDef moduledef = {
+ PyModuleDef_HEAD_INIT,
+ "ganglia",
+ NULL,
+ sizeof(struct module_state),
+ GangliaMethods,
+ NULL,
+ ganglia_traverse,
+ ganglia_clear,
+ NULL
+};
+
+#define INITERROR return NULL
+
+PyMODINIT_FUNC PyInit_metric_init(apr_pool_t *p)
+#else
+#define INITERROR return
+
static int pyth_metric_init (apr_pool_t *p)
+#endif
{
DIR *dp;
struct dirent *entry;
@@ -563,29 +628,41 @@ static int pyth_metric_init (apr_pool_t *p)
if (!path) {
err_msg("[PYTHON] Missing python module path.\n");
- return -1;
+ INITERROR;
}
if (access(path, F_OK))
{
/* 'path' does not exist */
err_msg("[PYTHON] Can't open the python module path %s.\n", path);
- return -1;
+ INITERROR;
}
if (access(path, R_OK))
{
/* Don't have read access to 'path' */
err_msg("[PYTHON] Can't read from the python module path %s.\n", path);
- return -1;
+ INITERROR;
}
/* Init Python environment */
/* Set up the python path to be able to load module from our module path */
Py_Initialize();
- Py_InitModule("ganglia", GangliaMethods);
+#if PY_MAJOR_VERSION >= 3
+ PyObject *module = PyModule_Create(&moduledef);
+#else
+ PyObject *module = Py_InitModule("ganglia", GangliaMethods);
+#endif
+ if (module == NULL)
+ INITERROR;
+ struct module_state *st = GETSTATE(module);
+ st->error = PyErr_NewException("ganglia.Error", NULL, NULL);
+ if (st->error == NULL) {
+ Py_DECREF(module);
+ INITERROR;
+ }
PyObject *sys_path = PySys_GetObject("path");
PyObject *addpath = PyString_FromString(path);
PyList_Append(sys_path, addpath);
@@ -598,7 +675,7 @@ static int pyth_metric_init (apr_pool_t *p)
/* Error: Cannot open the directory - Shouldn't happen */
/* Log? */
err_msg("[PYTHON] Can't open the python module path %s.\n", path);
- return -1;
+ INITERROR;
}
i = 0;
@@ -712,7 +789,11 @@ static int pyth_metric_init (apr_pool_t *p)
memset (mi, 0, sizeof(*mi));
python_module.metrics_info = (Ganglia_25metric *)metric_info->elts;
+#if PY_MAJOR_VERSION >= 3
+ return module;
+#else
return 0;
+#endif
}
static apr_status_t pyth_metric_cleanup ( void *data)
@@ -832,7 +913,11 @@ static g_val_t pyth_metric_handler( int metric_index )
mmodule python_module =
{
STD_MMODULE_STUFF,
+#if PY_MAJOR_VERSION >= 3
+ (int (*)(apr_pool_t *))PyInit_metric_init,
+#else
pyth_metric_init,
+#endif
NULL,
NULL, /* defined dynamically */
pyth_metric_handler,

View file

@ -0,0 +1,169 @@
From:
https://bugzilla.redhat.com/show_bug.cgi?id=2180500
diff --git a/api/host.php b/api/host.php
index 5eb026c..5cee9ec 100644
--- a/api/host.php
+++ b/api/host.php
@@ -87,7 +87,7 @@ switch ( $_GET['action'] ) {
$reports["excluded_reports"] = array_unique($reports["excluded_reports"]);
$additional_cluster_img_html_args = array();
$additional_cluster_img_html_args['h'] = $hostname;
- $additional_cluster_img_html_args['st'] = $cluster[LOCALTIME];
+ $additional_cluster_img_html_args['st'] = $cluster['LOCALTIME'];
$additional_cluster_img_html_args['m'] = $metricname;
$additional_cluster_img_html_args['r'] = $range;
$additional_cluster_img_html_args['s'] = $sort;
@@ -152,7 +152,7 @@ switch ( $_GET['action'] ) {
$graph_arguments['z'] = $size;
$graph_arguments['jr'] = $jobrange;
$graph_arguments['js'] = $jobstart;
- $graph_arguments['st'] = $cluster[LOCALTIME];
+ $graph_arguments['st'] = $cluster['LOCALTIME'];
# Adding units to graph 2003 by Jason Smith <smithj4@bnl.gov>.
if ($v['UNITS']) {
$graph_arguments['vl'] = $metrics[$cluster_url]['UNITS'];
diff --git a/dwoo/Dwoo/Core.php b/dwoo/Dwoo/Core.php
index 8ec104b..fc62cde 100644
--- a/dwoo/Dwoo/Core.php
+++ b/dwoo/Dwoo/Core.php
@@ -1250,7 +1250,7 @@ class Dwoo_Core
}
unset($varstr);
- while (list($k, $sep) = each($m[1])) {
+ foreach($m[1] as $k => $sep){
if ($sep === '.' || $sep === '[' || $sep === '') {
// strip enclosing quotes if present
$m[2][$k] = preg_replace('#^(["\']?)(.*?)\1$#', '$2', $m[2][$k]);
@@ -1425,7 +1425,7 @@ class Dwoo_Core
$cur = $this->scope;
}
- while (list($k, $sep) = each($m[1])) {
+ foreach($m[1] as $k => $sep){
if ($sep === '.' || $sep === '[' || $sep === '') {
if ((is_array($cur) || $cur instanceof ArrayAccess) && isset($cur[$m[2][$k]])) {
$cur = $cur[$m[2][$k]];
@@ -1470,7 +1470,7 @@ class Dwoo_Core
$cur =& $this->scope;
$last = array(array_pop($m[1]), array_pop($m[2]));
- while (list($k, $sep) = each($m[1])) {
+ foreach($m[1] as $k => $sep){
if ($sep === '.' || $sep === '[' || $sep === '') {
if (is_array($cur) === false) {
$cur = array();
diff --git a/dwoo/Dwoo/Data.php b/dwoo/Dwoo/Data.php
index c5f292e..d841546 100644
--- a/dwoo/Dwoo/Data.php
+++ b/dwoo/Dwoo/Data.php
@@ -71,7 +71,7 @@ class Dwoo_Data implements Dwoo_IDataProvider
public function mergeData(array $data)
{
$args = func_get_args();
- while (list(,$v) = each($args)) {
+ foreach($args as $v){
if (is_array($v)) {
$this->data = array_merge($this->data, $v);
}
@@ -90,7 +90,7 @@ class Dwoo_Data implements Dwoo_IDataProvider
{
if (is_array($name)) {
reset($name);
- while (list($k,$v) = each($name))
+ foreach($name as $k => $v)
$this->data[$k] = $v;
} else {
$this->data[$name] = $val;
diff --git a/dwoo/plugins/builtin/blocks/textformat.php b/dwoo/plugins/builtin/blocks/textformat.php
index fb0f422..61ec1d6 100644
--- a/dwoo/plugins/builtin/blocks/textformat.php
+++ b/dwoo/plugins/builtin/blocks/textformat.php
@@ -67,7 +67,7 @@ class Dwoo_Plugin_textformat extends Dwoo_Block_Plugin
// gets paragraphs
$pgs = explode("\n", str_replace(array("\r\n", "\r"), "\n", $this->buffer));
- while (list($i,) = each($pgs)) {
+ foreach($pgs as $i){
if (empty($pgs[$i])) {
continue;
}
diff --git a/dwoo/plugins/builtin/functions/capitalize.php b/dwoo/plugins/builtin/functions/capitalize.php
index d04f39b..de57c20 100644
--- a/dwoo/plugins/builtin/functions/capitalize.php
+++ b/dwoo/plugins/builtin/functions/capitalize.php
@@ -25,7 +25,7 @@ function Dwoo_Plugin_capitalize(Dwoo_Core $dwoo, $value, $numwords=false)
} else {
$bits = explode(' ', (string) $value);
$out = '';
- while (list(,$v) = each($bits)) {
+ foreach($bits as $v){
if (preg_match('#^[^0-9]+$#', $v)) {
$out .= ' '.mb_convert_case($v, MB_CASE_TITLE, $dwoo->getCharset());
} else {
diff --git a/host_view.php b/host_view.php
index ca05c8d..3b54b35 100644
--- a/host_view.php
+++ b/host_view.php
@@ -329,7 +329,7 @@ $cluster_url = rawurlencode($clustername);
$baseGraphArgs = "c=$cluster_url&amp;h=" . $user['hostname']
. "&amp;r=" . $user['range'] . "&amp;z=$size&amp;jr=$jobrange"
- . "&amp;js=$jobstart&amp;st=$cluster[LOCALTIME]";
+ . "&amp;js=$jobstart&amp;st=" . $cluster['LOCALTIME'];
if ($user['cs'])
$baseGraphArgs .= "&amp;cs=" . rawurlencode($user['cs']);
if ($user['ce'])
diff --git a/lib/GangliaAuth.php b/lib/GangliaAuth.php
index 01ca10d..bda8f84 100644
--- a/lib/GangliaAuth.php
+++ b/lib/GangliaAuth.php
@@ -94,7 +94,7 @@ class GangliaAuth {
}
protected function getMagicQuotesGpc() {
- return get_magic_quotes_gpc();
+ return false;
}
}
?>
diff --git a/metric_group_view.php b/metric_group_view.php
index 13dc0a1..617a3aa 100644
--- a/metric_group_view.php
+++ b/metric_group_view.php
@@ -105,7 +105,7 @@ $cluster_url = rawurlencode($clustername);
$baseGraphArgs = "c=$cluster_url&amp;h=$hostname"
. "&amp;r=$range&amp;z=$size&amp;jr=$jobrange"
- . "&amp;js=$jobstart&amp;st=$cluster[LOCALTIME]";
+ . "&amp;js=$jobstart&amp;st={$cluster['LOCALTIME']}";
if ($cs)
$baseGraphArgs .= "&amp;cs=" . rawurlencode($cs);
if ($ce)
diff --git a/mobile_helper.php b/mobile_helper.php
index d9e20cb..2b384ad 100644
--- a/mobile_helper.php
+++ b/mobile_helper.php
@@ -268,7 +268,7 @@ foreach ($metrics as $metric_name => $metric_attributes) {
else {
$metric_graphargs = "c=".rawurlencode($clustername)."&amp;h=".rawurlencode($hostname)."&amp;v=".rawurlencode($metric_attributes['VAL'])
."&amp;m=$metric_name&amp;r=".rawurlencode($range)."&amp;z=$size&amp;jr=$jobrange"
- ."&amp;js=$jobstart&amp;st=$cluster[LOCALTIME]";
+ ."&amp;js=$jobstart&amp;st=$cluster['LOCALTIME']";
if ($cs)
$metric_graphargs .= "&amp;cs=" . rawurlencode($cs);
if ($ce)
diff --git a/physical_view.php b/physical_view.php
index 8d5c3bc..a0d4111 100644
--- a/physical_view.php
+++ b/physical_view.php
@@ -99,7 +99,7 @@ function physical_racks() {
else {
ksort($racks);
reset($racks);
- while (list($rack,) = each($racks)) {
+ foreach($racks as $rack){
# In our convention, y=0 is close to the floor. (Easier to wire up)
krsort($racks[$rack]);
}

View file

@ -0,0 +1,121 @@
diff --git a/Makefile b/Makefile
index 6d2dd1b..a3ab48a 100644
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@ PHPCBF = phpcbf
##########################################################
# Gweb version
-GWEB_VERSION = 3.7.5
+GWEB_VERSION = 3.7.7
DIST_NAME = ganglia-web
DIST_DIR = $(DIST_NAME)-$(GWEB_VERSION)
diff --git a/cluster_view.php b/cluster_view.php
index 998ad65..fed4ed8 100644
--- a/cluster_view.php
+++ b/cluster_view.php
@@ -372,7 +372,7 @@ function get_cluster_overview($showhosts,
$overview["cluster_load"] = join(", ", $cluster_load);
$avg_cpu_num = find_avg($clustername, "", "cpu_num");
- if ($avg_cpu_num == 0)
+ if ((float)$avg_cpu_num == 0)
$avg_cpu_num = 1;
$cluster_util =
sprintf("%.0f%%",
diff --git a/ganglia.php b/ganglia.php
index 262b88e..3d1b325 100644
--- a/ganglia.php
+++ b/ganglia.php
@@ -350,7 +350,7 @@ function Gmetad () {
}
if ($debug) print "<br/>DEBUG: Creating parser\n";
- if ( isset($context) && is_array($context) && isset($SKIP_GMETAD_CONTEXTS) && is_array($SKIP_GMETAD_CONTEXTS) && in_array($context, $SKIP_GMETAD_CONTEXTS) ) {
+ if ( is_array($SKIP_GMETAD_CONTEXTS) && in_array($context, $SKIP_GMETAD_CONTEXTS) ) {
return TRUE;
}
$parser = xml_parser_create();
diff --git a/get_ganglia.php b/get_ganglia.php
index 50e5fe8..d9c4f2e 100644
--- a/get_ganglia.php
+++ b/get_ganglia.php
@@ -7,7 +7,7 @@
# If we are in compare_hosts, views and decompose_graph context we shouldn't attempt
# any connections to the gmetad
-if (! in_array($context, $SKIP_GMETAD_CONTEXTS) ) {
+if (! ( is_array($SKIP_GMETAD_CONTEXTS) && in_array($context, $SKIP_GMETAD_CONTEXTS) ) ) {
if (! Gmetad($conf['ganglia_ip'], $conf['ganglia_port']) )
{
print "<H4>There was an error collecting ganglia data ".
diff --git a/graph.php b/graph.php
index e8a7a9c..bf34014 100644
--- a/graph.php
+++ b/graph.php
@@ -1552,7 +1552,7 @@ if ($sourcetime) {
// Fix from Phil Radden, but step is not always 15 anymore.
if ($range == "month")
- $rrdtool_graph['end'] = floor($rrdtool_graph['end'] / 672) * 672;
+ $rrdtool_graph['end'] = floor((int)$rrdtool_graph['end'] / 672) * 672;
///////////////////////////////////////////////////////////////////////////////
// Are we generating aggregate graphs
diff --git a/meta_view.php b/meta_view.php
index aa79e15..e6490af 100644
--- a/meta_view.php
+++ b/meta_view.php
@@ -119,7 +119,7 @@ foreach ( $sorted_sources as $source => $val )
$clusname = $source == $self ? '' : $source;
$avg_cpu_num = find_avg($clusname, "", "cpu_num");
- if ($avg_cpu_num == 0) $avg_cpu_num = 1;
+ if ((float)$avg_cpu_num == 0) $avg_cpu_num = 1;
$cluster_util = sprintf("%.0f", ((double) find_avg($clusname, "", "load_one") / $avg_cpu_num ) * 100);
$sources[$source]["name"] = $name;
diff --git a/mobile_helper.php b/mobile_helper.php
index db45bb7..d9e20cb 100644
--- a/mobile_helper.php
+++ b/mobile_helper.php
@@ -266,7 +266,7 @@ foreach ($metrics as $metric_name => $metric_attributes) {
} else if (isset($reports[$metric_name]) and $reports[$metric])
continue;
else {
- $metric_graphargs = "c=".rawurlencode($clustername)."&amp;h=".rawurlencode($hostname)."&amp;v=".rawurlencode($metric_attributes[VAL])
+ $metric_graphargs = "c=".rawurlencode($clustername)."&amp;h=".rawurlencode($hostname)."&amp;v=".rawurlencode($metric_attributes['VAL'])
."&amp;m=$metric_name&amp;r=".rawurlencode($range)."&amp;z=$size&amp;jr=$jobrange"
."&amp;js=$jobstart&amp;st=$cluster[LOCALTIME]";
if ($cs)
diff --git a/pie.php b/pie.php
index 0e94bbe..24afad9 100644
--- a/pie.php
+++ b/pie.php
@@ -276,7 +276,11 @@ $to = 0;
$x; //PHPCS
$y; //PHPCS
- $pie_count = count( $angles );
+ if is_null( $angles ) {
+ $pie_count = 0;
+ } else {
+ $pie_count = count( $angles );
+ }
$PIE_THICKNESS = ($this->diameter * 0.075);
for( $j = ($this->center_y+$PIE_THICKNESS); $j > $this->center_y; $j-- ) {
diff --git a/templates/default/footer.tpl b/templates/default/footer.tpl
index af9fb5e..548a8e4 100644
--- a/templates/default/footer.tpl
+++ b/templates/default/footer.tpl
@@ -92,7 +92,7 @@ Loading view, please wait...<img src="img/spinner.gif" />
<div align="center" class="footer" style="font-size:small;clear:both;" {if $hide_footer} style="visibility:hidden;display:none;" {/if}>
<hr />
Ganglia Web Frontend version {$webfrontend_version}
-<a href="http://ganglia.sourceforge.net/downloads.php?component=ganglia-webfrontend&amp;version={$webfrontend_version}">Check for Updates.</a><br />
+<a href="https://github.com/ganglia/ganglia-web" target="_blank">Check for Updates.</a><br />
Ganglia Web Backend <i>({$webbackend_component})</i> version {$webbackend_version}
<a href="http://ganglia.sourceforge.net/downloads.php?component={$webbackend_component}&amp;version={$webbackend_version}">Check for Updates.</a><br />

View file

@ -1,132 +0,0 @@
diff --git a/conf_default.php.in b/conf_default.php.in
index 9efa9ef..f7602cd 100644
--- a/conf_default.php.in
+++ b/conf_default.php.in
@@ -135,6 +135,7 @@ $conf['cpu_gnice_color'] = "fff261";
# Colors for the MEMORY report graph
#
$conf['mem_used_color'] = "5555cc";
+$conf['mem_available_color'] = "2030F4";
$conf['mem_shared_color'] = "0000aa";
$conf['mem_cached_color'] = "33cc33";
$conf['mem_slab_color'] = "66e533";
diff --git a/functions.php b/functions.php
index be9fa4a..afbb586 100644
--- a/functions.php
+++ b/functions.php
@@ -1121,8 +1121,8 @@ function build_aggregate_graph_config ($graph_type,
$line_width,
$hreg,
$mreg,
- $glegend,
- $exclude_host_from_legend_label,
+ $glegend = NULL,
+ $exclude_host_from_legend_label = false,
$sortit = true) {
global $conf, $index_array, $hosts, $grid, $clusters, $debug, $metrics;
diff --git a/graph.d/mem_report.php b/graph.d/mem_report.php
index d443965..58d167d 100644
--- a/graph.d/mem_report.php
+++ b/graph.d/mem_report.php
@@ -48,6 +48,8 @@ function graph_mem_report ( &$rrdtool_graph ) {
$bmem_slab_defs = '';
$bmem_buffers_defs = '';
$bmem_used_cdef = "CDEF:'bmem_used'='bmem_total','bmem_free',-,'bmem_cached',-";
+ $bmem_available_defs = '';
+ $bmem_realused_cdef = '';
if (file_exists("$rrd_dir/mem_shared.rrd")) {
$bmem_used_cdef .= ",'bmem_shared',UN,0,'bmem_shared',IF,-";
@@ -67,6 +69,12 @@ function graph_mem_report ( &$rrdtool_graph ) {
."CDEF:'bmem_buffers'=mem_buffers,1024,* ";
}
+ if (file_exists("$rrd_dir/mem_available.rrd")) {
+ $bmem_realused_cdef = "CDEF:'bmem_realused'='bmem_total','bmem_available',- ";
+ $bmem_available_defs = "DEF:'mem_available'='${rrd_dir}/mem_available.rrd':'sum':AVERAGE "
+ ."CDEF:'bmem_available'=mem_available,1024,* ";
+ }
+
$series = "DEF:'mem_total'='${rrd_dir}/mem_total.rrd':'sum':AVERAGE "
."CDEF:'bmem_total'=mem_total,1024,* "
.$bmem_shared_defs
@@ -76,6 +84,8 @@ function graph_mem_report ( &$rrdtool_graph ) {
."CDEF:'bmem_cached'=mem_cached,1024,* "
.$bmem_slab_defs
.$bmem_buffers_defs
+ .$bmem_available_defs
+ .$bmem_realused_cdef
."$bmem_used_cdef "
."AREA:'bmem_used'#${conf['mem_used_color']}:'Use${rmspace}' ";
@@ -188,6 +198,22 @@ function graph_mem_report ( &$rrdtool_graph ) {
}
}
+ if (file_exists("$rrd_dir/mem_available.rrd")) {
+ $series .= "LINE2:'bmem_realused'#${conf['mem_available_color']}:'Avail${rmspace}' ";
+
+ if ( $conf['graphreport_stats'] ) {
+ $series .= "CDEF:available_pos=bmem_available,0,INF,LIMIT "
+ . "VDEF:available_last=available_pos,LAST "
+ . "VDEF:available_min=available_pos,MINIMUM "
+ . "VDEF:available_avg=available_pos,AVERAGE "
+ . "VDEF:available_max=available_pos,MAXIMUM "
+ . "GPRINT:'available_last':' ${space1}Now\:%6.1lf%s' "
+ . "GPRINT:'available_min':'${space1}Min\:%6.1lf%s${eol1}' "
+ . "GPRINT:'available_avg':'${space2}Avg\:%6.1lf%s' "
+ . "GPRINT:'available_max':'${space1}Max\:%6.1lf%s\\l' ";
+ }
+ }
+
$series .= "LINE2:'bmem_total'#${conf['cpu_num_color']}:'Total${rmspace}' ";
if ( $conf['graphreport_stats'] ) {
diff --git a/header.php b/header.php
index 91af0a2..729fe27 100644
--- a/header.php
+++ b/header.php
@@ -263,7 +263,7 @@ if ($initgrid or $gridwalk)
# Use cookie so we dont have to pass gridstack around within this site.
# Cookie values are automatically urlencoded. Expires in a day.
if ( !isset($_COOKIE["gs"]) or $_COOKIE["gs"] != $gridstack_str )
- setcookie("gs", $gridstack_str, time() + 86400);
+ setcookie("gs", $gridstack_str, time() + 86400, NULL, NULL, true, true);
}
# Invariant: back pointer is second-to-last element of gridstack. Grid stack
diff --git a/lib/GangliaAuth.php b/lib/GangliaAuth.php
index 4a4d1da..01ca10d 100644
--- a/lib/GangliaAuth.php
+++ b/lib/GangliaAuth.php
@@ -82,14 +82,14 @@ class GangliaAuth {
// this is how a user 'logs in'.
public function setAuthCookie($user, $group=null) {
- setcookie('ganglia_auth', json_encode( array('user'=>$user, 'group'=>$group, 'token'=>$this->getAuthToken($user)) ) );
+ setcookie('ganglia_auth', json_encode( array('user'=>$user, 'group'=>$group, 'token'=>$this->getAuthToken($user)) ), NULL, NULL, NULL, true, true );
$this->user = $user;
$this->group = $group;
$this->tokenIsValid = true;
}
public function destroyAuthCookie() {
- setcookie('ganglia_auth', '', time());
+ setcookie('ganglia_auth', '', time(), NULL, NULL, true, true);
self::$auth = null;
}
diff --git a/templates/default/cluster_host_metric_graphs.tpl b/templates/default/cluster_host_metric_graphs.tpl
index dbd80ab..95bc8aa 100644
--- a/templates/default/cluster_host_metric_graphs.tpl
+++ b/templates/default/cluster_host_metric_graphs.tpl
@@ -42,7 +42,7 @@
{/foreach}
{/if}
{/if}
- {if $index % $hostcols == 0}
+ {if $index % max(1, $hostcols) == 0}
</tr><tr>
{/if}
{math "$index + 1" assign="index"}

View file

@ -1,23 +1,43 @@
%global gangver 3.7.2
%global webver 3.7.5
%global webver 3.7.6
%global systemd 1
%global _hardened_build 1
%if 0%{?fedora} && 0%{?fedora} < 31
%global with_python 1
%if 0%{?rhel} == 7
%global py2 1
%else
%global py3 1
%endif
%if 0%{?rhel} && 0%{?rhel} < 8
%global py2 1
%if 0%{?fedora} || 0%{?rhel} > 9
%global pcre2 1
%global autoconf_fix 1
%endif
%if 0%{?fedora} || 0%{?rhel} > 7
%global tirpc 1
%global php_xml 1
%endif
%if 0%{?fedora} > 42
%global sysusers 1
%else
%global legacy_users 1
%endif
%if 0%{?fedora} || 0%{?rhel} > 6
%global httpd24 1
%endif
Summary: Distributed Monitoring System
Name: ganglia
Version: %{gangver}
Release: 33%{?dist}
License: BSD
URL: http://ganglia.sourceforge.net/
Release: 62%{?dist}
# Automatically converted from old format: BSD - review is highly recommended.
License: LicenseRef-Callaway-BSD
URL: https://github.com/ganglia
Source0: http://downloads.sourceforge.net/sourceforge/ganglia/ganglia-%{version}.tar.gz
Source1: https://github.com/ganglia/ganglia-web/archive/%{webver}/ganglia-web-%{webver}.tar.gz
Source2: gmond.service
@ -25,15 +45,27 @@ Source3: gmetad.service
Source4: ganglia-httpd24.conf.d
Source5: ganglia-httpd.conf.d
Source6: conf.php
Patch0: ganglia-web-3.7.2-path.patch
Patch1: ganglia-3.7.2-apache.patch
Patch2: ganglia-3.7.2-sflow.patch
Patch3: ganglia-3.7.2-tirpc-hack.patch
Patch4: ganglia-web-5ee6b7.patch
Source7: ganglia.sysusers.conf
Patch0: ganglia-3.7.2-185ab6.patch
Patch1: ganglia-3.7.2-gcc14-cast.patch
Patch10: ganglia-3.7.2-tirpc-hack.patch
Patch20: ganglia-web-3.7.2-path.patch
Patch21: ganglia-web-3.7.6-pr-379.patch
Patch22: ganglia-web-3.7.6-php8.patch
Patch23: 0001-Sanitize-input-for-timezone.patch
Patch24: 0002-Validate-that-the-supplied-timezone-is-a-valid-timez.patch
Patch30: ganglia-gmond-python2to3.patch
Patch31: 0002-2to3-pass.patch
Patch32: 0003-Ruff-pass.patch
Patch33: 0004-Use-raw-strings.patch
Patch34: 0005-First-loop-might-contain-non-integer-input.patch
Patch35: 0001-Fix-return-value-from-mod_python-init.patch
Patch40: ganglia-3.7.2-autoconf-python3.patch
Patch50: ganglia-3.7.2-pcre2.patch
%if 0%{?systemd}
BuildRequires: systemd
%endif
%if 0%{?fedora} > 27 || 0%{?rhel} > 7
%if 0%{?tirpc}
BuildRequires: rpcgen
BuildRequires: libtirpc-devel
BuildRequires: autoconf
@ -41,15 +73,21 @@ BuildRequires: automake
BuildRequires: libtool
%endif
BuildRequires: apr-devel >= 1
BuildRequires: cyrus-sasl-devel
BuildRequires: expat-devel
BuildRequires: freetype-devel
BuildRequires: gcc
BuildRequires: libart_lgpl-devel
BuildRequires: libconfuse-devel
BuildRequires: libmemcached-devel
BuildRequires: libpng-devel
BuildRequires: make
%if 0%{?pcre2}
BuildRequires: pcre2-devel
%else
BuildRequires: pcre-devel
%endif
%{?py2:BuildRequires: python2-devel}
%{?py3:BuildRequires: python3-devel}
BuildRequires: rrdtool-devel
BuildRequires: rsync
BuildRequires: /usr/bin/pod2man
@ -66,6 +104,9 @@ Requires: rrdtool
Requires: php
Requires: php-gd
Requires: %{name}-gmetad = %{gangver}-%{release}
%if 0%{?php_xml}
Requires: php-xml
%endif
%description web
This package provides a web frontend to display the XML tree published
by ganglia, and to provide historical graphs of collected
@ -112,14 +153,30 @@ This gmond daemon provides the ganglia service within a single cluster
or Multicast domain.
%if 0%{?py2}
%package -n python2-ganglia-gmond
%package python2-gmond
Summary: Ganglia Monitor daemon python DSO and metric modules
Requires: ganglia-gmond
Requires: python2
%{?python_provide:%python_provide python2-ganglia-gmond}
%{?python_provide:%python_provide python2-gmond}
# Remove before F30
Provides: ganglia-gmond-python = %{version}-%{release}
%description -n python2-ganglia-gmond
Provides: ganglia-python = %{version}-%{release}
%description python2-gmond
Ganglia is a scalable, real-time monitoring and execution environment
with all execution requests and statistics expressed in an open
well-defined XML format.
This package provides the gmond python DSO and python gmond modules,
which can be loaded via the DSO at gmond daemon start time.
%endif
%if 0%{?py3}
%package python3-gmond
Summary: Ganglia Monitor daemon python3 DSO and metric modules
Requires: ganglia-gmond
Requires: python3
%{?python_provide:%python_provide python3-gmond}
Provides: gmond-python = %{version}-%{release}
%description python3-gmond
Ganglia is a scalable, real-time monitoring and execution environment
with all execution requests and statistics expressed in an open
well-defined XML format.
@ -139,25 +196,39 @@ programmers can use to build scalable cluster or grid applications
%prep
%setup -q
%patch -P 0 -p1
%patch -P 1 -p1
%patch -P 30 -p1
%{?py3:%patch -P 31 -p1}
%{?py3:%patch -P 32 -p1}
%{?py3:%patch -P 33 -p1}
%{?py3:%patch -P 34 -p1}
%{?py3:%patch -P 35 -p1}
%patch -P 40 -p1
%if 0%{?tirpc}
%patch -P 10 -p1
%endif
%if 0%{?pcre2}
%patch -P 50 -p1
%endif
# fix broken systemd support
install -m 0644 %{SOURCE2} gmond/gmond.service.in
install -m 0644 %{SOURCE3} gmetad/gmetad.service.in
%patch1 -p0
%patch2 -p0
%if 0%{?fedora} > 27 || 0%{?rhel} > 7
%patch3 -p1
%endif
# web part
%setup -q -T -D -a 1
mv ganglia-web-%{webver} web
pushd web
%patch0 -p1
%patch4 -p1
%patch -P 20 -p1
%patch -P 21 -p1
%patch -P 22 -p1
%patch -P 23 -p1
%patch -P 24 -p1
popd
%build
touch Makefile.am
%if 0%{?fedora} > 27 || 0%{?rhel} > 7
%if 0%{?tirpc}
aclocal -I m4
autoheader
automake --add-missing --copy --foreign 2>/dev/null
@ -165,6 +236,18 @@ libtoolize --automake --copy
automake --add-missing --copy --foreign
autoconf -f || exit 1
%endif
%if 0%{?autoconf_fix}
pushd libmetrics
aclocal -I m4
autoheader
automake --add-missing --copy --foreign 2>/dev/null
libtoolize --automake --copy
automake --add-missing --copy --foreign
autoconf -f || exit 1
popd
%endif
export CFLAGS="%{optflags} -fcommon"
%configure \
--enable-setuid=ganglia \
@ -173,8 +256,15 @@ export CFLAGS="%{optflags} -fcommon"
--with-memcached \
--disable-static \
--enable-shared \
--with-libpcre=yes \
%if 0%{?with_python}
--enable-python \
%if 0%{?py2}
--with-python=%{__python2} \
%endif
%if 0%{?py3}
--with-python=%{__python3} \
%endif
%else
--disable-python \
%endif
@ -200,7 +290,7 @@ make %{?_smp_mflags}
make install DESTDIR=%{buildroot}
## Create directory structures
%{?py2:mkdir -p %{buildroot}%{_libdir}/ganglia/python_modules}
%{?with_python:mkdir -p %{buildroot}%{_libdir}/ganglia/python_modules}
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}/rrds
## Install services
@ -216,9 +306,10 @@ install -Dp -m 0755 gmetad/gmetad.init %{buildroot}%{_sysconfdir}/init.d/gmetad
LD_LIBRARY_PATH=lib/.libs gmond/gmond -t | %{__perl} -pe 's|nobody|ganglia|g' \
> %{buildroot}%{_sysconfdir}/ganglia/gmond.conf
%if 0%{?py2}
%if 0%{?with_python}
## Python bits
# Copy the python metric modules and .conf files
mkdir -p %{buildroot}%{_sysconfdir}/ganglia/conf.d
cp -p gmond/python_modules/conf.d/*.pyconf %{buildroot}%{_sysconfdir}/ganglia/conf.d/
cp -p gmond/modules/conf.d/*.conf %{buildroot}%{_sysconfdir}/ganglia/conf.d/
cp -p gmond/python_modules/*/*.py %{buildroot}%{_libdir}/ganglia/python_modules/
@ -233,7 +324,7 @@ ln -s ../../..%{_sysconfdir}/%{name}/conf.php \
popd
## httpd config
%if 0%{?fedora} >= 18
%if 0%{?httpd24}
install -Dp -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf
%else
install -Dp -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf
@ -261,17 +352,25 @@ rm -f %{buildroot}%{_libdir}/*.la
# Remove execute bit
chmod 0644 %{buildroot}%{_datadir}/%{name}/header.php
%{?py2:chmod 0644 %{buildroot}%{_libdir}/%{name}/python_modules/*.py}
%{?with_python:chmod 0644 %{buildroot}%{_libdir}/%{name}/python_modules/*.py}
chmod 0644 %{buildroot}%{_datadir}/%{name}/css/smoothness/jquery-ui-1.10.2.custom.css
chmod 0644 %{buildroot}%{_datadir}/%{name}/css/smoothness/jquery-ui-1.10.2.custom.min.css
# Remove shebang
%{?py2:sed -i '1{\@^#!@d}' %{buildroot}%{_libdir}/%{name}/python_modules/*.py}
%{?with_python:sed -i '1{\@^#!@d}' %{buildroot}%{_libdir}/%{name}/python_modules/*.py}
# Sysusers
%if 0%{?sysusers}
install -m0644 -D %{SOURCE7} %{buildroot}%{_sysusersdir}/ganglia.conf
%endif
%if 0%{?legacy_users}
%pre
## Add the "ganglia" user
/usr/sbin/useradd -c "Ganglia Monitoring System" \
-s /sbin/nologin -r -d %{_localstatedir}/lib/%{name} ganglia 2> /dev/null || :
%endif
%if 0%{?systemd}
%post gmond
@ -328,7 +427,10 @@ end
%{_libdir}/libganglia*.so.*
%dir %{_libdir}/ganglia
%{_libdir}/ganglia/*.so
%{?py2:%exclude %{_libdir}/ganglia/modpython.so}
%{?with_python:%exclude %{_libdir}/ganglia/modpython.so}
%if 0%{?sysusers}
%{_sysusersdir}/ganglia.conf
%endif
%files gmetad
%dir %{_localstatedir}/lib/%{name}
@ -358,13 +460,22 @@ end
%{_mandir}/man1/gstat.1*
%{_mandir}/man1/gmetric.1*
%dir %{_sysconfdir}/ganglia
%{?py2:%dir %{_sysconfdir}/ganglia/conf.d}
%{?with_python:%dir %{_sysconfdir}/ganglia/conf.d}
%config(noreplace) %{_sysconfdir}/ganglia/gmond.conf
%{?py2:%config(noreplace) %{_sysconfdir}/ganglia/conf.d/*.conf}
%{?py2:%exclude %{_sysconfdir}/ganglia/conf.d/modpython.conf}
%{?with_python:%config(noreplace) %{_sysconfdir}/ganglia/conf.d/*.conf}
%{?with_python:%exclude %{_sysconfdir}/ganglia/conf.d/modpython.conf}
%if 0%{?py2}
%files -n python2-ganglia-gmond
%files python2-gmond
%dir %{_libdir}/ganglia/python_modules/
%{_libdir}/ganglia/python_modules/*.py*
%{_libdir}/ganglia/modpython.so*
%config(noreplace) %{_sysconfdir}/ganglia/conf.d/*.pyconf*
%config(noreplace) %{_sysconfdir}/ganglia/conf.d/modpython.conf
%endif
%if 0%{?py3}
%files python3-gmond
%dir %{_libdir}/ganglia/python_modules/
%{_libdir}/ganglia/python_modules/*.py*
%{_libdir}/ganglia/modpython.so*
@ -390,6 +501,103 @@ end
%dir %attr(0755,apache,apache) %{_localstatedir}/lib/%{name}-web/dwoo/compiled
%changelog
* Mon Sep 29 2025 Terje Rosten <terjeros@gmail.com> - 3.7.2-62
- Some refactoring
* Sun Sep 28 2025 Terje Rosten <terjeros@gmail.com> - 3.7.2-61
- Port to epel10
- Add TZ patches
- Remove legacy libart_lgpl-devel buildreq
- Fix URL
* Wed Jul 23 2025 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-60
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Mon Jun 02 2025 Python Maint <python-maint@redhat.com> - 3.7.2-59
- Rebuilt for Python 3.14
* Sat Apr 05 2025 Terje Rosten <terjeros@gmail.com> - 3.7.2-58
- Follow PHP quote rules
* Sat Mar 29 2025 Terje Rosten <terjeros@gmail.com> - 3.7.2-57
- Use sysusers on FC43+
- Fix changelog
* Thu Jan 16 2025 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-56
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Mon Nov 04 2024 Terje Rosten <terjeros@gmail.com> - 3.7.2-55
- Add forgotten int() conversion patch
* Tue Oct 15 2024 Terje Rosten <terjeros@gmail.com> - 3.7.2-54
- Various fixes to improve Python 3 support
- Add back regex support on Fedora (patch from Debian, thanks!)
* Sat Sep 28 2024 Terje Rosten <terjeros@gmail.com> - 3.7.2-53
- Add patch to improve compat with PHP 8
* Wed Aug 28 2024 Miroslav Suchý <msuchy@redhat.com> - 3.7.2-52
- convert license to SPDX
* Wed Jul 17 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-51
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Mon Jun 24 2024 Terje Rosten <terje.rosten@ntnu.no> - 3.7.2-50
- Various fixes to add Python 3 support for Fedora 40+
* Tue Jun 11 2024 Tom Crane <t.crane@rhul.ac.uk> - 3.7.2-49
- Update gmond for Python3 modules support
* Sun Mar 10 2024 Terje Rosten <terje.rosten@ntnu.no> - 3.7.2-48
- Update to commit 185ab6b
* Sun Mar 03 2024 Terje Rosten <terje.rosten@ntnu.no> - 3.7.2-47
- Add more PHP8 patches
* Sat Feb 24 2024 Terje Rosten <terje.rosten@ntnu.no> - 3.7.2-46
- Upgrade to ganglia web 3.7.6
* Mon Feb 05 2024 Terje Rosten <terje.rosten@ntnu.no> - 3.7.2-45
- Fix GCC 14 issue
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-44
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-43
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-42
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-41
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Thu Jan 12 2023 Terje Rosten <terje.rosten@ntnu.no> - 3.7.2-40
- Fix implicit dep on php-xml (rhbz#2016302)
- Remove dep on pcre in Fedora 38+ (rhbz#2128294)
- RHEL7+ have httpd 2.4 too
- Simplify fedora conditionals
- Fix autoconf problem in libmetrics
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-39
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-38
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Sep 09 2021 Terje Rosten <terje.rosten@ntnu.no> - 3.7.2-37
- Need sasl bits to build
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-36
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.7.2-35
- Rebuilt for updated systemd-rpm-macros
See https://pagure.io/fesco/issue/2583.
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.2-34
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Oct 08 2020 Germano Massullo <germano.massullo@gmail.com> - 3.7.2-33
- removed all occurrencies of "# systemd" after %%endif since they are not allowed.

1
ganglia.sysusers.conf Normal file
View file

@ -0,0 +1 @@
u ganglia - 'Ganglia Monitoring System' /var/lib/ganglia -

View file

@ -1,2 +1,2 @@
SHA512 (ganglia-web-3.7.5.tar.gz) = 3df0c8dc51d411d29beb00bcd66d617115ad72a576bec25ce7e4e96ba9f2d7099daa1e6f738cfcc6cab60e9af72303e8af51eeaa2ade2fa219ac075106f2e521
SHA512 (ganglia-3.7.2.tar.gz) = a88955e59421a447e5752a9bfe5f599d989a7a5a0141141ab3601d1ab250be4eebbede8bcef8baa151b2f9deaf3f56e30aef8ea709f3cc820a79fa3d3961e0df
SHA512 (ganglia-web-3.7.6.tar.gz) = 6b84dfabfd37e4818c09824a64f4b7f8be30a21a7b4173df4562a4c42bf30115f1182489ab40b23193cc4ef2b15bd714e400203dabf45e6531068b5eb6c69f7d