forked from cjdmax/ceph-munin-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathceph_mds_req
executable file
·48 lines (41 loc) · 1.18 KB
/
ceph_mds_req
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/python
import munin
from subprocess import Popen, PIPE
import json
import os
class CephMDS(munin.MuninPlugin):
title = "MDS Req Count"
args = "--base 1000"
category = "Ceph"
@property
def fields(self):
f = [
("req", dict(label="req count",
info="Requests",
type="COUNTER",
min="0")),
("reply", dict(label="reply count",
info="Replys",
type="COUNTER",
min="0")),
# ("", dict(label="",
# info="s",
# type="GAUGE",
# min="0")),
]
return f
def execute(self):
if "cephmdsasok" not in os.environ:
return
cmd = "ceph --admin-daemon " + os.environ["cephmdsasok"] + " perfcounters_dump"
output = Popen(cmd.split(), stdout=PIPE).communicate()[0]
obj = json.loads(output)
mds = obj["mds"]
res = {}
def doit(n):
res[n] = mds[n]
doit("req")
doit("reply")
return res
if __name__ == "__main__":
CephMDS().run()