Skip to content

Commit 0833bef

Browse files
committed
pmdanetcheck: update for Python 3.14
Keep using the old 'fork' default with multiprocessing, ctypes can't be pickled so that's the only option. Adjust url_get to handle received bytes as strings. Improve NTP server autodetect by detecting also the pool directive.
1 parent 9adddd2 commit 0833bef

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/pmdas/netcheck/modules/url_get.python

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class PCPNetcheckModule(PCPNetcheckModuleBase):
131131
handle = urlget.urlopen(req, context=ctx)
132132
while data:
133133
data = handle.read()
134-
content += data
134+
content += str(data)
135135
end_time = time()
136136
hosts[host] = 0
137137
timings[host] = end_time - start_time

src/pmdas/netcheck/pmdanetcheck.python

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ try:
1919
except ImportError:
2020
import ConfigParser as configparser
2121

22+
import multiprocessing as mp
2223
import importlib
2324
import traceback
2425
import hashlib
@@ -253,7 +254,7 @@ class NetcheckPMDA(PMDA):
253254
with open("/etc/chrony.conf") as chrony_conf:
254255
for line in chrony_conf:
255256
fields = line.strip().split()
256-
if fields and (fields[0] == 'server' or fields[0] == 'peer') and fields[1]:
257+
if fields and (fields[0] in ['server', 'peer', 'pool']) and fields[1]:
257258
ntp.add(fields[1])
258259
return ",".join(ntp)
259260

@@ -419,4 +420,5 @@ class NetcheckPMDA(PMDA):
419420

420421

421422
if __name__ == '__main__':
423+
mp.set_start_method('fork')
422424
NetcheckPMDA('netcheck', 152).run()

0 commit comments

Comments
 (0)