forked from outlyerapp/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdalmatiner.py
More file actions
25 lines (22 loc) · 773 Bytes
/
dalmatiner.py
File metadata and controls
25 lines (22 loc) · 773 Bytes
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
#!/usr/bin/env python
import subprocess
import re
import sys
try:
out = subprocess.check_output(['/usr/lib/ddb/bin/ddb-admin', 'status'])
except Exception, e:
print "Plugin Failed! %s" % e
sys.exit(2)
result = "OK | "
for line in out.split("\n"):
m = re.match(r"^([^ ]+) : ([0-9]+)", line)
if m:
k, v = m.groups()
if k.split('.')[-1] in ['min', 'median', 'max', 'standard_deviation', 'harmonic_mean', 'geometric_mean', 'arithmetic_mean', 'p50', 'p75', 'p95', 'p99', 'p999']:
v = str(0.001 * float(v)) + 'ms'
# At some point we should fix floats reported by dalmatiner
elif k.split('.')[-1] == 'variance':
v = 0.000001 * float(v)
result += "%s=%s;;;; " % (k, v)
print result
sys.exit(0)