Compare commits
10 Commits
66ad0f6326
...
862491ee12
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
862491ee12 | ||
|
|
439e85655d | ||
|
|
ad2493653d | ||
|
|
d7e812d8f6 | ||
|
|
edd2a23110 | ||
|
|
35a9090ebd | ||
|
|
b17cf8e1f6 | ||
|
|
7272b4f42d | ||
|
|
db8efc298d | ||
|
|
b9d5864e22 |
60
0001-Fix-return-value-from-mod_python-init.patch
Normal file
60
0001-Fix-return-value-from-mod_python-init.patch
Normal 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
|
||||
|
||||
1080
0002-2to3-pass.patch
Normal file
1080
0002-2to3-pass.patch
Normal file
File diff suppressed because it is too large
Load Diff
534
0003-Ruff-pass.patch
Normal file
534
0003-Ruff-pass.patch
Normal 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
|
||||
|
||||
62
0004-Use-raw-strings.patch
Normal file
62
0004-Use-raw-strings.patch
Normal 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
|
||||
|
||||
27
0005-First-loop-might-contain-non-integer-input.patch
Normal file
27
0005-First-loop-might-contain-non-integer-input.patch
Normal 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
|
||||
|
||||
11
conf.php
Normal file
11
conf.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
#
|
||||
# /etc/ganglia/conf.php
|
||||
#
|
||||
# You can use this file to override default settings.
|
||||
#
|
||||
# For a list of available options, see /usr/share/ganglia/conf_default.php
|
||||
#
|
||||
|
||||
?>
|
||||
1413
ganglia-3.7.2-185ab6.patch
Normal file
1413
ganglia-3.7.2-185ab6.patch
Normal file
File diff suppressed because it is too large
Load Diff
32
ganglia-3.7.2-autoconf-python3.patch
Normal file
32
ganglia-3.7.2-autoconf-python3.patch
Normal 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
|
||||
33
ganglia-3.7.2-gcc14-cast.patch
Normal file
33
ganglia-3.7.2-gcc14-cast.patch
Normal 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
126
ganglia-3.7.2-pcre2.patch
Normal 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
|
||||
|
||||
232
ganglia-3.7.2-tirpc-hack.patch
Normal file
232
ganglia-3.7.2-tirpc-hack.patch
Normal file
@ -0,0 +1,232 @@
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 95d0807..a918f57 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -9,7 +9,7 @@ GMETAD_SUBDIR =
|
||||
endif
|
||||
|
||||
EXTRA_SUBDIRS = "gmetad-python contrib solaris"
|
||||
-INCLUDES = @APR_INCLUDES@
|
||||
+INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@
|
||||
|
||||
AUTOMAKE_OPTIONS = dist-bzip2 dist-tarZ dist-zip
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index fe7983b..d98460a 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -180,6 +180,10 @@ AC_ARG_WITH( libapr,
|
||||
[ --with-libapr=PATH Specify location for libapr-1 or full path to apr-1-config],
|
||||
[if test x"$withval" != xno; then libapr="yes"; libaprpath="$withval"; fi])
|
||||
|
||||
+AC_ARG_WITH( libtirpc,
|
||||
+[ --with-libtirpc=PATH Specify location for libtirpc],
|
||||
+[if test x"$withval" != xno; then libtirpc="yes"; libtirpcpath="$withval"; fi])
|
||||
+
|
||||
AC_ARG_WITH( libexpat,
|
||||
[ --with-libexpat=DIR Specify location for libexpat],
|
||||
[if test x"$withval" != xno; then libexpat="yes"; libexpatpath="$withval"; fi])
|
||||
@@ -426,6 +430,35 @@ else
|
||||
fi
|
||||
|
||||
echo
|
||||
+echo Checking for tirpc
|
||||
+if test x"$libtiprcpath" != x && test x"$libtirpcpath" != xyes; then
|
||||
+ if test -f "$libtirpcpath" ; then
|
||||
+ LIBTIRPC_INCLUDES=`$libtirpcpath --includes`
|
||||
+ AC_SUBST(LIBTIRPC_INCLUDES)
|
||||
+ LIBTIRPC_LIBPATH=`$libtirpcpath --link-ld`
|
||||
+ LDFLAGS="$LDFLAGS -L`expr "x$LIBTIRPC_LIBPATH" : '.*-L\(.*\) '`"
|
||||
+ AC_CHECK_LIB(tirpc, xdr_string,,,[`$libtirpcpath --libs`])
|
||||
+ else
|
||||
+ CFLAGS="$CFLAGS -I$libtirpcpath/include/tirpc"
|
||||
+ LDFLAGS="$LDFLAGS -L$libtirpcpath/${LIB_SUFFIX}"
|
||||
+ echo "Added -I$libtirpcpath/include to CFLAGS"
|
||||
+ echo "Added -L$libtirpcpath/${LIB_SUFFIX} to LDFLAGS"
|
||||
+ AC_CHECK_LIB(tirpc, xdr_string)
|
||||
+ fi
|
||||
+
|
||||
+ if test x"$ac_cv_lib_tirpc_xdr_string" = xyes; then
|
||||
+ echo "Found a suitable tirpc library"
|
||||
+ else
|
||||
+ echo "libtirpc not found"
|
||||
+ exit 1;
|
||||
+ fi
|
||||
+else
|
||||
+ PKG_CHECK_MODULES([LIBTIRPC],[libtirpc])
|
||||
+ LDFLAGS="$LDFLAGS $LIBS $LIBTIRPC_LIBS"
|
||||
+ LIBTIRPC_INCLUDES="$LIBTIRPC_CFLAGS"
|
||||
+fi
|
||||
+
|
||||
+echo
|
||||
echo Checking for libmemcached
|
||||
AC_ARG_WITH( memcached,
|
||||
[ --with-memcached enable memcached metrics publishing],
|
||||
@@ -567,7 +600,6 @@ echo "Found a suitable zlib"
|
||||
echo
|
||||
|
||||
|
||||
-AC_CHECK_LIB(rpc, xdr_string)
|
||||
AC_CHECK_LIB(socket, socket)
|
||||
AC_CHECK_LIB(nsl, inet_addr)
|
||||
AC_CHECK_LIB(nsl, gethostbyaddr_r)
|
||||
@@ -606,14 +638,6 @@ AC_CHECK_HEADER([sys/mount.h], [], [],
|
||||
#endif
|
||||
])
|
||||
|
||||
-AC_CHECK_HEADERS(rpc/types.h)
|
||||
-AC_CHECK_HEADER([rpc/xdr.h], [],
|
||||
- [AC_MSG_ERROR([your system is missing the Sun RPC (ONC/RPC) libraries])],
|
||||
-[#ifdef HAVE_RPC_TYPES_H
|
||||
-# include <rpc/types.h>
|
||||
-#endif
|
||||
-])
|
||||
-
|
||||
dnl ##################################################################
|
||||
dnl Checks for typedefs.
|
||||
dnl
|
||||
diff --git a/gmetad/Makefile.am b/gmetad/Makefile.am
|
||||
index 0a4e360..9eac377 100644
|
||||
--- a/gmetad/Makefile.am
|
||||
+++ b/gmetad/Makefile.am
|
||||
@@ -11,7 +11,7 @@ GLDADD =
|
||||
GLDFLAGS =
|
||||
endif
|
||||
|
||||
-INCLUDES = @APR_INCLUDES@
|
||||
+INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@
|
||||
AM_CFLAGS = -I$(top_builddir)/lib -I$(top_builddir)/gmond -I$(top_builddir)/libmetrics -I$(top_builddir)/include $(GCFLAGS) @PROTOBUF_C_CFLAGS@
|
||||
|
||||
sbin_PROGRAMS = gmetad
|
||||
diff --git a/gmetric/Makefile.am b/gmetric/Makefile.am
|
||||
index bc7807c..4aa9542 100644
|
||||
--- a/gmetric/Makefile.am
|
||||
+++ b/gmetric/Makefile.am
|
||||
@@ -10,7 +10,7 @@ GLDADD =
|
||||
GLDFLAGS =
|
||||
endif
|
||||
|
||||
-INCLUDES = @APR_INCLUDES@
|
||||
+INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@
|
||||
|
||||
AM_CFLAGS = -I../lib -I../include $(GCFLAGS)
|
||||
|
||||
diff --git a/gmond/Makefile.am b/gmond/Makefile.am
|
||||
index 256fee3..c9ab899 100644
|
||||
--- a/gmond/Makefile.am
|
||||
+++ b/gmond/Makefile.am
|
||||
@@ -44,7 +44,7 @@ if BUILD_SFLOW
|
||||
GCFLAGS += -DSFLOW
|
||||
endif
|
||||
|
||||
-INCLUDES = @APR_INCLUDES@
|
||||
+INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@
|
||||
AM_CFLAGS = -I$(top_builddir)/lib -I$(top_builddir)/include/ -I$(top_builddir)/libmetrics $(GCFLAGS)
|
||||
|
||||
sbin_PROGRAMS = gmond
|
||||
diff --git a/gmond/modules/cpu/Makefile.am b/gmond/modules/cpu/Makefile.am
|
||||
index fd7457e..2c2b7ab 100644
|
||||
--- a/gmond/modules/cpu/Makefile.am
|
||||
+++ b/gmond/modules/cpu/Makefile.am
|
||||
@@ -25,4 +25,4 @@ modload_la_LIBADD = $(top_builddir)/libmetrics/libmetrics.la
|
||||
|
||||
endif
|
||||
|
||||
-INCLUDES = @APR_INCLUDES@
|
||||
+INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@
|
||||
diff --git a/gmond/modules/disk/Makefile.am b/gmond/modules/disk/Makefile.am
|
||||
index 0c78689..ce62aa5 100644
|
||||
--- a/gmond/modules/disk/Makefile.am
|
||||
+++ b/gmond/modules/disk/Makefile.am
|
||||
@@ -11,4 +11,4 @@ moddisk_la_LDFLAGS = -module -avoid-version
|
||||
moddisk_la_LIBADD = $(top_builddir)/libmetrics/libmetrics.la
|
||||
endif
|
||||
|
||||
-INCLUDES = @APR_INCLUDES@
|
||||
+INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@
|
||||
diff --git a/gmond/modules/example/Makefile.am b/gmond/modules/example/Makefile.am
|
||||
index e3bff6a..765b85d 100644
|
||||
--- a/gmond/modules/example/Makefile.am
|
||||
+++ b/gmond/modules/example/Makefile.am
|
||||
@@ -11,7 +11,7 @@ modexample_la_LDFLAGS = -module -avoid-version
|
||||
EXTRA_DIST = ../conf.d/example.conf
|
||||
endif
|
||||
|
||||
-INCLUDES = @APR_INCLUDES@
|
||||
+INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@
|
||||
|
||||
install:
|
||||
@echo
|
||||
diff --git a/gmond/modules/memory/Makefile.am b/gmond/modules/memory/Makefile.am
|
||||
index 82336db..f606830 100644
|
||||
--- a/gmond/modules/memory/Makefile.am
|
||||
+++ b/gmond/modules/memory/Makefile.am
|
||||
@@ -12,4 +12,4 @@ modmem_la_LDFLAGS = -module -avoid-version
|
||||
modmem_la_LIBADD = $(top_builddir)/libmetrics/libmetrics.la
|
||||
endif
|
||||
|
||||
-INCLUDES = @APR_INCLUDES@
|
||||
+INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@
|
||||
diff --git a/gmond/modules/network/Makefile.am b/gmond/modules/network/Makefile.am
|
||||
index 72a4faf..4f12e91 100644
|
||||
--- a/gmond/modules/network/Makefile.am
|
||||
+++ b/gmond/modules/network/Makefile.am
|
||||
@@ -12,4 +12,4 @@ modnet_la_LDFLAGS = -module -avoid-version
|
||||
modnet_la_LIBADD = $(top_builddir)/libmetrics/libmetrics.la
|
||||
endif
|
||||
|
||||
-INCLUDES = @APR_INCLUDES@
|
||||
+INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@
|
||||
diff --git a/gmond/modules/perl/Makefile.am b/gmond/modules/perl/Makefile.am
|
||||
index b7b095c..c6d0cce 100644
|
||||
--- a/gmond/modules/perl/Makefile.am
|
||||
+++ b/gmond/modules/perl/Makefile.am
|
||||
@@ -28,4 +28,4 @@ install-exec-hook: ../conf.d/modperl.conf README
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)/conf.d && \
|
||||
$(INSTALL_DATA) ../conf.d/modperl.conf $(DESTDIR)$(sysconfdir)/conf.d/modperl.conf
|
||||
|
||||
-INCLUDES = @APR_INCLUDES@ @PERL_INCLUDES@
|
||||
+INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@ @PERL_INCLUDES@
|
||||
diff --git a/gmond/modules/python/Makefile.am b/gmond/modules/python/Makefile.am
|
||||
index f535b07..4b130a1 100644
|
||||
--- a/gmond/modules/python/Makefile.am
|
||||
+++ b/gmond/modules/python/Makefile.am
|
||||
@@ -27,4 +27,4 @@ install-exec-hook: ../conf.d/modpython.conf README
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)/conf.d && \
|
||||
$(INSTALL_DATA) ../conf.d/modpython.conf $(DESTDIR)$(sysconfdir)/conf.d/modpython.conf
|
||||
|
||||
-INCLUDES = @APR_INCLUDES@ @PYTHON_INCLUDES@
|
||||
+INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@ @PYTHON_INCLUDES@
|
||||
diff --git a/gmond/modules/status/Makefile.am b/gmond/modules/status/Makefile.am
|
||||
index cd84069..6ce9188 100644
|
||||
--- a/gmond/modules/status/Makefile.am
|
||||
+++ b/gmond/modules/status/Makefile.am
|
||||
@@ -11,4 +11,4 @@ modgstatus_la_LDFLAGS = -module -avoid-version
|
||||
EXTRA_DIST = ../conf.d/modgstatus.conf
|
||||
endif
|
||||
|
||||
-INCLUDES = @APR_INCLUDES@
|
||||
+INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@
|
||||
diff --git a/gmond/modules/system/Makefile.am b/gmond/modules/system/Makefile.am
|
||||
index 5fc7fb3..f83a380 100644
|
||||
--- a/gmond/modules/system/Makefile.am
|
||||
+++ b/gmond/modules/system/Makefile.am
|
||||
@@ -16,4 +16,4 @@ modsys_la_LDFLAGS = -module -avoid-version
|
||||
modsys_la_LIBADD = $(top_builddir)/libmetrics/libmetrics.la
|
||||
endif
|
||||
|
||||
-INCLUDES = @APR_INCLUDES@
|
||||
+INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@
|
||||
diff --git a/lib/Makefile.am b/lib/Makefile.am
|
||||
index 935c514..e2ec77b 100644
|
||||
--- a/lib/Makefile.am
|
||||
+++ b/lib/Makefile.am
|
||||
@@ -14,7 +14,7 @@ if BUILD_SFLOW
|
||||
GCFLAGS += -DSFLOW
|
||||
endif
|
||||
|
||||
-INCLUDES = @APR_INCLUDES@
|
||||
+INCLUDES = @APR_INCLUDES@ @LIBTIRPC_INCLUDES@
|
||||
AM_CFLAGS = -I.. -I. -I$(top_builddir)/include/ $(GCFLAGS) -DSYSCONFDIR='"$(sysconfdir)"'
|
||||
|
||||
include_HEADERS = gm_protocol.h
|
||||
BIN
ganglia-3.7.2.tar.gz
Normal file
BIN
ganglia-3.7.2.tar.gz
Normal file
Binary file not shown.
176
ganglia-gmond-python2to3.patch
Normal file
176
ganglia-gmond-python2to3.patch
Normal 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,
|
||||
13
ganglia-httpd.conf.d
Normal file
13
ganglia-httpd.conf.d
Normal file
@ -0,0 +1,13 @@
|
||||
#
|
||||
# Ganglia monitoring system php web frontend
|
||||
#
|
||||
|
||||
Alias /ganglia /usr/share/ganglia
|
||||
|
||||
<Location /ganglia>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
Allow from 127.0.0.1
|
||||
Allow from ::1
|
||||
# Allow from .example.com
|
||||
</Location>
|
||||
11
ganglia-httpd24.conf.d
Normal file
11
ganglia-httpd24.conf.d
Normal file
@ -0,0 +1,11 @@
|
||||
#
|
||||
# Ganglia monitoring system php web frontend
|
||||
#
|
||||
|
||||
Alias /ganglia /usr/share/ganglia
|
||||
|
||||
<Location /ganglia>
|
||||
Require local
|
||||
# Require ip 10.1.2.3
|
||||
# Require host example.org
|
||||
</Location>
|
||||
39
ganglia-web-3.7.2-path.patch
Normal file
39
ganglia-web-3.7.2-path.patch
Normal file
@ -0,0 +1,39 @@
|
||||
From 7ab35273917c5e6a9fa3d528053d146e32013def Mon Sep 17 00:00:00 2001
|
||||
From: Terje Rosten <terje.rosten@ntnu.no>
|
||||
Date: Sun, 2 Feb 2020 09:58:43 +0100
|
||||
Subject: [PATCH] Fix paths
|
||||
|
||||
---
|
||||
Makefile | 7 +++----
|
||||
1 file changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 2d04cd9..7a6d5fd 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -2,10 +2,10 @@
|
||||
# User configurables:
|
||||
##########################################################
|
||||
# Location where gweb should be installed to (excluding conf, dwoo dirs).
|
||||
-GDESTDIR = /usr/share/ganglia-webfrontend
|
||||
+GDESTDIR = /usr/share/ganglia
|
||||
|
||||
# Location where default apache configuration should be installed to.
|
||||
-GCONFDIR = /etc/ganglia-web
|
||||
+GCONFDIR = /etc/ganglia
|
||||
|
||||
# Gweb statedir (where conf dir and Dwoo templates dir are stored)
|
||||
GWEB_STATEDIR = /var/lib/ganglia-web
|
||||
@@ -86,8 +86,7 @@ install: dist-dir
|
||||
mkdir -p $(DESTDIR)/$(GWEB_STATEDIR) && \
|
||||
rsync -a $(DIST_DIR)/conf $(DESTDIR)/$(GWEB_STATEDIR) && \
|
||||
mkdir -p $(DESTDIR)/$(GDESTDIR) && \
|
||||
- rsync --exclude "conf" -a $(DIST_DIR)/* $(DESTDIR)/$(GDESTDIR) && \
|
||||
- chown -R $(APACHE_USER):$(APACHE_GROUP) $(DESTDIR)/$(GWEB_STATEDIR)
|
||||
+ rsync --exclude "conf" -a $(DIST_DIR)/* $(DESTDIR)/$(GDESTDIR)
|
||||
|
||||
dist-gzip: dist-dir
|
||||
if [ -f $(DIST_TARBALL) ]; then \
|
||||
--
|
||||
2.24.1
|
||||
|
||||
169
ganglia-web-3.7.6-php8.patch
Normal file
169
ganglia-web-3.7.6-php8.patch
Normal 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&h=" . $user['hostname']
|
||||
. "&r=" . $user['range'] . "&z=$size&jr=$jobrange"
|
||||
- . "&js=$jobstart&st=$cluster[LOCALTIME]";
|
||||
+ . "&js=$jobstart&st=" . $cluster['LOCALTIME'];
|
||||
if ($user['cs'])
|
||||
$baseGraphArgs .= "&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..f526545 100644
|
||||
--- a/metric_group_view.php
|
||||
+++ b/metric_group_view.php
|
||||
@@ -105,7 +105,7 @@ $cluster_url = rawurlencode($clustername);
|
||||
|
||||
$baseGraphArgs = "c=$cluster_url&h=$hostname"
|
||||
. "&r=$range&z=$size&jr=$jobrange"
|
||||
- . "&js=$jobstart&st=$cluster[LOCALTIME]";
|
||||
+ . "&js=$jobstart&st=$cluster['LOCALTIME']";
|
||||
if ($cs)
|
||||
$baseGraphArgs .= "&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)."&h=".rawurlencode($hostname)."&v=".rawurlencode($metric_attributes['VAL'])
|
||||
."&m=$metric_name&r=".rawurlencode($range)."&z=$size&jr=$jobrange"
|
||||
- ."&js=$jobstart&st=$cluster[LOCALTIME]";
|
||||
+ ."&js=$jobstart&st=$cluster['LOCALTIME']";
|
||||
if ($cs)
|
||||
$metric_graphargs .= "&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]);
|
||||
}
|
||||
121
ganglia-web-3.7.6-pr-379.patch
Normal file
121
ganglia-web-3.7.6-pr-379.patch
Normal 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)."&h=".rawurlencode($hostname)."&v=".rawurlencode($metric_attributes[VAL])
|
||||
+ $metric_graphargs = "c=".rawurlencode($clustername)."&h=".rawurlencode($hostname)."&v=".rawurlencode($metric_attributes['VAL'])
|
||||
."&m=$metric_name&r=".rawurlencode($range)."&z=$size&jr=$jobrange"
|
||||
."&js=$jobstart&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&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}&version={$webbackend_version}">Check for Updates.</a><br />
|
||||
BIN
ganglia-web-3.7.6.tar.gz
Normal file
BIN
ganglia-web-3.7.6.tar.gz
Normal file
Binary file not shown.
459
ganglia.spec
Normal file
459
ganglia.spec
Normal file
@ -0,0 +1,459 @@
|
||||
%global gangver 3.7.2
|
||||
%global webver 3.7.6
|
||||
|
||||
%global systemd 1
|
||||
%global _hardened_build 1
|
||||
|
||||
%global with_python 1
|
||||
%global py2 0
|
||||
%global py3 1
|
||||
|
||||
Summary: Distributed Monitoring System
|
||||
Name: ganglia
|
||||
Version: %{gangver}
|
||||
Release: 5
|
||||
License: BSD
|
||||
URL: http://ganglia.sourceforge.net/
|
||||
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
|
||||
Source3: gmetad.service
|
||||
Source4: ganglia-httpd24.conf.d
|
||||
Source5: ganglia-httpd.conf.d
|
||||
Source6: conf.php
|
||||
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
|
||||
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
|
||||
BuildRequires: rpcgen
|
||||
BuildRequires: libtirpc-devel
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
BuildRequires: libtool
|
||||
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
|
||||
BuildRequires: pcre2-devel
|
||||
%{?py3:BuildRequires: python3-devel}
|
||||
BuildRequires: rrdtool-devel
|
||||
BuildRequires: rsync
|
||||
BuildRequires: /usr/bin/pod2man
|
||||
BuildRequires: /usr/bin/pod2html
|
||||
%description
|
||||
Ganglia is a scalable, real-time monitoring and execution environment
|
||||
with all execution requests and statistics expressed in an open
|
||||
well-defined XML format.
|
||||
|
||||
%package web
|
||||
Summary: Ganglia Web Frontend
|
||||
Version: %{webver}
|
||||
Requires: rrdtool
|
||||
Requires: php
|
||||
Requires: php-gd
|
||||
Requires: %{name}-gmetad = %{gangver}-%{release}
|
||||
Requires: php-xml
|
||||
%description web
|
||||
This package provides a web frontend to display the XML tree published
|
||||
by ganglia, and to provide historical graphs of collected
|
||||
metrics. This website is written in the PHP.
|
||||
|
||||
%package gmetad
|
||||
Summary: Ganglia Metadata collection daemon
|
||||
Requires: %{name} = %{gangver}-%{release}
|
||||
%if 0%{?systemd}
|
||||
Requires(post): systemd
|
||||
Requires(preun): systemd
|
||||
Requires(postun): systemd
|
||||
%else
|
||||
Requires(post): /sbin/chkconfig
|
||||
Requires(preun): /sbin/chkconfig
|
||||
Requires(preun): /sbin/service
|
||||
%endif
|
||||
%description gmetad
|
||||
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 gmetad daemon aggregates monitoring data from several clusters to
|
||||
form a monitoring grid. It also keeps metric history using rrdtool.
|
||||
|
||||
%package gmond
|
||||
Summary: Ganglia Monitoring daemon
|
||||
Requires: %{name} = %{gangver}-%{release}
|
||||
%if 0%{?systemd}
|
||||
Requires(post): systemd
|
||||
Requires(preun): systemd
|
||||
Requires(postun): systemd
|
||||
%else
|
||||
Requires(post): /sbin/chkconfig
|
||||
Requires(preun): /sbin/chkconfig
|
||||
Requires(preun): /sbin/service
|
||||
%endif
|
||||
%description 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 gmond daemon provides the ganglia service within a single cluster
|
||||
or Multicast domain.
|
||||
|
||||
%if 0%{?py2}
|
||||
%package python2-gmond
|
||||
Summary: Ganglia Monitor daemon python DSO and metric modules
|
||||
Requires: ganglia-gmond
|
||||
Requires: python2
|
||||
%{?python_provide:%python_provide python2-gmond}
|
||||
# Remove before F30
|
||||
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.
|
||||
|
||||
This package provides the gmond python DSO and python gmond modules,
|
||||
which can be loaded via the DSO at gmond daemon start time.
|
||||
%endif
|
||||
|
||||
%package devel
|
||||
Summary: Ganglia Library
|
||||
Requires: %{name} = %{gangver}-%{release}
|
||||
Requires: apr-devel
|
||||
Requires: libconfuse-devel
|
||||
%description devel
|
||||
The Ganglia Monitoring Core library provides a set of functions that
|
||||
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
|
||||
%patch -P 10 -p1
|
||||
%patch -P 50 -p1
|
||||
# fix broken systemd support
|
||||
install -m 0644 %{SOURCE2} gmond/gmond.service.in
|
||||
install -m 0644 %{SOURCE3} gmetad/gmetad.service.in
|
||||
# web part
|
||||
%setup -q -T -D -a 1
|
||||
mv ganglia-web-%{webver} web
|
||||
pushd web
|
||||
%patch -P 20 -p1
|
||||
%patch -P 21 -p1
|
||||
%patch -P 22 -p1
|
||||
popd
|
||||
|
||||
%build
|
||||
touch Makefile.am
|
||||
|
||||
aclocal -I m4
|
||||
autoheader
|
||||
automake --add-missing --copy --foreign 2>/dev/null
|
||||
libtoolize --automake --copy
|
||||
automake --add-missing --copy --foreign
|
||||
autoconf -f || exit 1
|
||||
|
||||
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
|
||||
|
||||
export CFLAGS="%{optflags} -fcommon"
|
||||
%configure \
|
||||
--enable-setuid=ganglia \
|
||||
--enable-setgid=ganglia \
|
||||
--with-gmetad \
|
||||
--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
|
||||
--sysconfdir=%{_sysconfdir}/ganglia
|
||||
|
||||
# Remove rpaths
|
||||
%{__sed} -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
|
||||
%{__sed} -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
|
||||
|
||||
## Default to run as user ganglia instead of nobody
|
||||
%{__perl} -pi.orig -e 's|nobody|ganglia|g' \
|
||||
gmond/gmond.conf.html ganglia.html gmond/conf.pod
|
||||
|
||||
%{__perl} -pi.orig -e 's|.*setuid_username.*|setuid_username ganglia|' \
|
||||
gmetad/gmetad.conf.in
|
||||
|
||||
## Don't have initscripts turn daemons on by default
|
||||
%{__perl} -pi.orig -e 's|2345|-|g' gmond/gmond.init gmetad/gmetad.init
|
||||
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
make install DESTDIR=%{buildroot}
|
||||
|
||||
## Create directory structures
|
||||
%{?with_python:mkdir -p %{buildroot}%{_libdir}/ganglia/python_modules}
|
||||
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}/rrds
|
||||
|
||||
## Install services
|
||||
%if 0%{?systemd}
|
||||
install -Dp -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/gmond.service
|
||||
install -Dp -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/gmetad.service
|
||||
%else
|
||||
install -Dp -m 0755 gmond/gmond.init %{buildroot}%{_sysconfdir}/init.d/gmond
|
||||
install -Dp -m 0755 gmetad/gmetad.init %{buildroot}%{_sysconfdir}/init.d/gmetad
|
||||
%endif
|
||||
|
||||
## Build default gmond.conf from gmond using the '-t' flag
|
||||
LD_LIBRARY_PATH=lib/.libs gmond/gmond -t | %{__perl} -pe 's|nobody|ganglia|g' \
|
||||
> %{buildroot}%{_sysconfdir}/ganglia/gmond.conf
|
||||
|
||||
%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/
|
||||
%endif
|
||||
|
||||
## Web bits
|
||||
pushd web
|
||||
make install DESTDIR=%{buildroot}
|
||||
install -p -m 0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/ganglia/conf.php
|
||||
ln -s ../../..%{_sysconfdir}/%{name}/conf.php \
|
||||
%{buildroot}%{_datadir}/%{name}/conf.php
|
||||
popd
|
||||
|
||||
## httpd config
|
||||
install -Dp -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf
|
||||
|
||||
## Various clean up after install:
|
||||
|
||||
## Don't install the status modules and example.conf
|
||||
rm -f %{buildroot}%{_sysconfdir}/ganglia/conf.d/{modgstatus,example}.conf
|
||||
|
||||
## Disable the diskusage module until it is configured properly
|
||||
## mv %{buildroot}%{_sysconfdir}/ganglia/conf.d/diskusage.pyconf \
|
||||
## %{buildroot}%{_sysconfdir}/ganglia/conf.d/diskusage.pyconf.off
|
||||
|
||||
## Remove unwanted files from web dir
|
||||
rm -rf %{buildroot}%{_datadir}/%{name}/{Makefile*,debian,ganglia-web.spec*,ganglia-web}
|
||||
rm -rf %{buildroot}%{_datadir}/%{name}/{conf_default.php.in,version.php.in}
|
||||
rm -rf %{buildroot}%{_localstatedir}/lib/%{name}-web/conf/sql
|
||||
|
||||
## Included as doc
|
||||
rm -rf %{buildroot}%{_datadir}/%{name}/{README,TODO,AUTHORS,COPYING}
|
||||
|
||||
## House cleaning
|
||||
rm -f %{buildroot}%{_libdir}/*.la
|
||||
|
||||
# Remove execute bit
|
||||
chmod 0644 %{buildroot}%{_datadir}/%{name}/header.php
|
||||
%{?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
|
||||
%{?with_python:sed -i '1{\@^#!@d}' %{buildroot}%{_libdir}/%{name}/python_modules/*.py}
|
||||
|
||||
%pre
|
||||
## Add the "ganglia" user
|
||||
/usr/sbin/useradd -c "Ganglia Monitoring System" \
|
||||
-s /sbin/nologin -r -d %{_localstatedir}/lib/%{name} ganglia 2> /dev/null || :
|
||||
|
||||
%if 0%{?systemd}
|
||||
%post gmond
|
||||
%systemd_post gmond.service
|
||||
|
||||
%preun gmond
|
||||
%systemd_preun gmond.service
|
||||
|
||||
%postun gmond
|
||||
%systemd_postun_with_restart gmond.service
|
||||
|
||||
%post gmetad
|
||||
%systemd_post gmetad.service
|
||||
|
||||
%preun gmetad
|
||||
%systemd_preun gmetad.service
|
||||
|
||||
%postun gmetad
|
||||
%systemd_postun_with_restart gmetad.service
|
||||
|
||||
%else
|
||||
|
||||
%post gmond
|
||||
/sbin/chkconfig --add gmond
|
||||
|
||||
%post gmetad
|
||||
/sbin/chkconfig --add gmetad
|
||||
|
||||
%preun gmetad
|
||||
if [ "$1" = 0 ]; then
|
||||
/sbin/service gmetad stop >/dev/null 2>&1 || :
|
||||
/sbin/chkconfig --del gmetad
|
||||
fi
|
||||
|
||||
%preun gmond
|
||||
if [ "$1" = 0 ]; then
|
||||
/sbin/service gmond stop >/dev/null 2>&1 || :
|
||||
/sbin/chkconfig --del gmond
|
||||
fi
|
||||
|
||||
%endif
|
||||
|
||||
# https://fedoraproject.org/wiki/Packaging:Directory_Replacement#Scriptlet_to_replace_a_symlink_to_a_directory_with_a_directory
|
||||
%pretrans web -p <lua>
|
||||
path = "/usr/share/ganglia/lib/Zend"
|
||||
st = posix.stat(path)
|
||||
if st and st.type == "link" then
|
||||
os.remove(path)
|
||||
end
|
||||
|
||||
%files
|
||||
%license COPYING
|
||||
%doc AUTHORS NEWS README ChangeLog
|
||||
%{_libdir}/libganglia*.so.*
|
||||
%dir %{_libdir}/ganglia
|
||||
%{_libdir}/ganglia/*.so
|
||||
%{?with_python:%exclude %{_libdir}/ganglia/modpython.so}
|
||||
|
||||
%files gmetad
|
||||
%dir %{_localstatedir}/lib/%{name}
|
||||
%attr(0755,ganglia,ganglia) %{_localstatedir}/lib/%{name}/rrds
|
||||
%{_sbindir}/gmetad
|
||||
%if 0%{?systemd}
|
||||
%{_unitdir}/gmetad.service
|
||||
%else
|
||||
%{_sysconfdir}/init.d/gmetad
|
||||
%endif
|
||||
%{_mandir}/man1/gmetad.1*
|
||||
%{_mandir}/man1/gmetad.py.1*
|
||||
%dir %{_sysconfdir}/ganglia
|
||||
%config(noreplace) %{_sysconfdir}/ganglia/gmetad.conf
|
||||
|
||||
%files gmond
|
||||
%{_bindir}/gmetric
|
||||
%{_bindir}/gstat
|
||||
%{_sbindir}/gmond
|
||||
%if 0%{?systemd}
|
||||
%{_unitdir}/gmond.service
|
||||
%else
|
||||
%{_sysconfdir}/init.d/gmond
|
||||
%endif
|
||||
%{_mandir}/man5/gmond.conf.5*
|
||||
%{_mandir}/man1/gmond.1*
|
||||
%{_mandir}/man1/gstat.1*
|
||||
%{_mandir}/man1/gmetric.1*
|
||||
%dir %{_sysconfdir}/ganglia
|
||||
%{?with_python:%dir %{_sysconfdir}/ganglia/conf.d}
|
||||
%config(noreplace) %{_sysconfdir}/ganglia/gmond.conf
|
||||
%{?with_python:%config(noreplace) %{_sysconfdir}/ganglia/conf.d/*.conf}
|
||||
%{?with_python:%exclude %{_sysconfdir}/ganglia/conf.d/modpython.conf}
|
||||
|
||||
%if 0%{?py2}
|
||||
%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*
|
||||
%config(noreplace) %{_sysconfdir}/ganglia/conf.d/*.pyconf*
|
||||
%config(noreplace) %{_sysconfdir}/ganglia/conf.d/modpython.conf
|
||||
%endif
|
||||
|
||||
%files devel
|
||||
%{_bindir}/ganglia-config
|
||||
%{_includedir}/*.h
|
||||
%{_libdir}/libganglia*.so
|
||||
|
||||
%files web
|
||||
%license web/COPYING
|
||||
%doc web/AUTHORS web/README web/TODO
|
||||
%config(noreplace) %{_sysconfdir}/%{name}/conf.php
|
||||
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf
|
||||
%{_datadir}/%{name}
|
||||
%dir %attr(0755,apache,apache) %{_localstatedir}/lib/%{name}-web/conf
|
||||
%config(noreplace) %attr(0644,apache,apache) %{_localstatedir}/lib/%{name}-web/conf/*.json
|
||||
%dir %attr(0755,apache,apache) %{_localstatedir}/lib/%{name}-web/dwoo
|
||||
%dir %attr(0755,apache,apache) %{_localstatedir}/lib/%{name}-web/dwoo/cache
|
||||
%dir %attr(0755,apache,apache) %{_localstatedir}/lib/%{name}-web/dwoo/compiled
|
||||
|
||||
%changelog
|
||||
* Mon Jan 06 2025 liweigang <liweigang.lwg@gmail.com> - 3.7.2-5
|
||||
- upgrade to ganglia web 3.7.6
|
||||
- add patch to improve with PHP 8
|
||||
- improve Python 3 support
|
||||
|
||||
* Fri Dec 13 2024 litian <dev11105@linx-info.com> - 3.7.2-4
|
||||
- fix %patchN is deprecated warning
|
||||
|
||||
* Tue Mar 12 2024 yaoxin <yao_xin001@hoperun.com> - 3.7.2-3
|
||||
- Disable pcre
|
||||
|
||||
* Wed Mar 02 2022 houyingchao <houyingchao@huawei.com> - 3.7.2-2
|
||||
- Fix CVE-2019-20378 CVE-2019-20379
|
||||
|
||||
* Wed Apr 14 2021 chengzihan <chengzihan2@huawei.com> - 3.7.2-1
|
||||
- package init
|
||||
10
gmetad.service
Normal file
10
gmetad.service
Normal file
@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Ganglia Meta Daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/gmetad -d 1
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
15
gmond.service
Normal file
15
gmond.service
Normal file
@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=Ganglia Meta Daemon
|
||||
After=multi-user.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart=/usr/sbin/gmond
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user