1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-25 02:18:08 +00:00

Minor bugfix

This commit is contained in:
Rodolphe Quideville 2010-08-17 16:52:36 +02:00 committed by Steve Schnepp
parent e09d89cde7
commit e1816224a9

View file

@ -33,12 +33,12 @@ graph_args --base 1024
print base_config
for vm in vm_names:
print "%s_in.label %s" % (vm, vm)
print "%s_in.type GAUGE" % vm
print "%s_in.type COUNTER" % vm
print "%s_in.min 0" % vm
print "%s_in.draw LINE2" % vm
print "%s_out.negative %s_in" % (vm, vm)
print "%s_out.label %s" % (vm, vm)
print "%s_out.type GAUGE" % vm
print "%s_out.type COUNTER" % vm
print "%s_out.min 0" % vm
print "%s_out.draw LINE2" % vm
@ -64,14 +64,15 @@ def fetch(vms):
mac = get_vm_mac(pid)
try:
tap = "tap%s" % macs[mac]
f = open("/proc/net/dev", "r")
for line in f.readlines():
if tap in line:
print "%s_in.value %s" % (vms[pid], line.split()[1])
print "%s_out.value %s" % (vms[pid], line.split()[9])
break
else:
f.close()
f = open("/proc/net/dev", "r")
for line in f.readlines():
if tap in line:
line = line.split(':')[1]
print "%s_in.value %s" % (vms[pid], line.split()[0])
print "%s_out.value %s" % (vms[pid], line.split()[8])
break
else:
f.close()
except:
continue
@ -116,7 +117,7 @@ def find_vms_tap():
res = kvm.communicate()[0].split('\n')
for line in res:
try:
tap = line.split()[0]
tap = str(int(line.split()[0]) - 1)
mac = line.split()[1]
result[mac] = tap
except: