1
0
mirror of https://github.com/librenms/librenms-agent.git synced 2024-05-09 09:54:52 +00:00

fix: a dirty hack to prevent failing of stats when the cluster is rebuilding (#68)

because Ceph returns '-inf' which the json decompiler doesn't seem to get..
This commit is contained in:
Tuxis Internet Engineering V.O.F
2016-10-05 11:06:48 +02:00
committed by Daniel Preussker
parent dd365168a5
commit 91c251fd94
2 changed files with 10 additions and 3 deletions

View File

@ -18,7 +18,7 @@ from subprocess import check_output
import json import json
def cephdf(): def cephdf():
cephdf = check_output(["/usr/bin/ceph", "-f", "json", "df"]) cephdf = check_output(["/usr/bin/ceph", "-f", "json", "df"]).replace('-inf', '0')
s = json.loads(cephdf) s = json.loads(cephdf)
print("c:%i:%i:%i" % (s['stats']['total_bytes'], s['stats']['total_used_bytes'], s['stats']['total_avail_bytes'])) print("c:%i:%i:%i" % (s['stats']['total_bytes'], s['stats']['total_used_bytes'], s['stats']['total_avail_bytes']))
@ -31,13 +31,13 @@ def cephdf():
def osdperf(): def osdperf():
osdperf = check_output(["/usr/bin/ceph", "-f", "json", "osd", "perf"]) osdperf = check_output(["/usr/bin/ceph", "-f", "json", "osd", "perf"]).replace('-inf', '0')
for o in json.loads(osdperf)['osd_perf_infos']: for o in json.loads(osdperf)['osd_perf_infos']:
print("osd.%s:%i:%i" % (o['id'], o['perf_stats']['apply_latency_ms'], o['perf_stats']['commit_latency_ms'])) print("osd.%s:%i:%i" % (o['id'], o['perf_stats']['apply_latency_ms'], o['perf_stats']['commit_latency_ms']))
def poolstats(): def poolstats():
poolstats = check_output(["/usr/bin/ceph", "-f", "json", "osd", "pool", "stats"]) poolstats = check_output(["/usr/bin/ceph", "-f", "json", "osd", "pool", "stats"]).replace('-inf', '0')
for p in json.loads(poolstats): for p in json.loads(poolstats):
try: try:

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
librenms-agent (1.0.6) stable; urgency=low
- Fix a dirty hack to prevent failing of stats when the cluster is rebuilding
because Ceph returns '-inf' which the json decompiler doesn't seem to get..
-- Mark Schouten <mark@tuxis.nl> Tue, 05 Oct 2016 10:57:00 +0200
librenms-agent (1.0.5) stable; urgency=low librenms-agent (1.0.5) stable; urgency=low
- Include a PowerDNS Authoritative agent - Include a PowerDNS Authoritative agent