mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
Initial version
This commit is contained in:
parent
fd049b4947
commit
a8f90a4410
1 changed files with 47 additions and 0 deletions
47
plugins/other/zeomonitor
Executable file
47
plugins/other/zeomonitor
Executable file
|
@ -0,0 +1,47 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
def safe(s):
|
||||||
|
s = s.replace("-", "_")
|
||||||
|
s = s.replace(" ", "_")
|
||||||
|
s = s.replace(".", "_")
|
||||||
|
return s
|
||||||
|
|
||||||
|
def config(data):
|
||||||
|
for i in data:
|
||||||
|
print "%s.label %s"%(safe(i[0]), i[0])
|
||||||
|
if i[0].startswith("Clients"):
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
print "%s.type DERIVE"%safe(i[0])
|
||||||
|
print "graph_title zeo %s per minute"%i[0]
|
||||||
|
print "graph_args -l 0"
|
||||||
|
print "graph_vlabel n"
|
||||||
|
print "graph_period minute"
|
||||||
|
print "graph_category ZEO"
|
||||||
|
|
||||||
|
def get_data():
|
||||||
|
import sys
|
||||||
|
from socket import socket, AF_INET, SOCK_STREAM
|
||||||
|
field = sys.argv[0].split("_",1)[1]
|
||||||
|
s=socket(AF_INET, SOCK_STREAM)
|
||||||
|
s.connect(("localhost", 8101))
|
||||||
|
data=s.recv(2048).split("\n")
|
||||||
|
s.close()
|
||||||
|
data = [d.split(": ") for d in data [5:-2]]
|
||||||
|
if field:
|
||||||
|
data = [ d for d in data if safe(d[0]) == field]
|
||||||
|
return data
|
||||||
|
|
||||||
|
def sample(data):
|
||||||
|
for i in data:
|
||||||
|
print "%s.value %s"%(i[0].replace(" ","_"),i[1])
|
||||||
|
|
||||||
|
def main():
|
||||||
|
import sys
|
||||||
|
data = get_data()
|
||||||
|
if 'config' in sys.argv:
|
||||||
|
return config(data)
|
||||||
|
sample(data)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
Loading…
Add table
Add a link
Reference in a new issue