1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

kvm_net: use print function for python3-compatibility

This commit is contained in:
Lars Kruse 2018-06-10 17:36:11 +02:00
parent f6080f5f8e
commit 67cc769c87

View file

@ -30,17 +30,17 @@ graph_category Virtualization
graph_info This graph shows the network I/O of the virtual machines graph_info This graph shows the network I/O of the virtual machines
graph_args --base 1024 graph_args --base 1024
""" """
print base_config print(base_config)
for vm in vm_names: for vm in vm_names:
print "%s_in.label %s" % (vm, vm) print("%s_in.label %s" % (vm, vm))
print "%s_in.type COUNTER" % vm print("%s_in.type COUNTER" % vm)
print "%s_in.min 0" % vm print("%s_in.min 0" % vm)
print "%s_in.draw LINE2" % vm print("%s_in.draw LINE2" % vm)
print "%s_out.negative %s_in" % (vm, vm) print("%s_out.negative %s_in" % (vm, vm))
print "%s_out.label %s" % (vm, vm) print("%s_out.label %s" % (vm, vm))
print "%s_out.type COUNTER" % vm print("%s_out.type COUNTER" % vm)
print "%s_out.min 0" % vm print("%s_out.min 0" % vm)
print "%s_out.draw LINE2" % vm print("%s_out.draw LINE2" % vm)
def clean_vm_name(vm_name): def clean_vm_name(vm_name):
@ -68,11 +68,11 @@ def fetch(vms):
f = open("/proc/net/dev", "r") f = open("/proc/net/dev", "r")
for line in f.readlines(): for line in f.readlines():
if tap in line: if tap in line:
print "%s_in.value %s" % (vms[pid], line.split()[1]) print("%s_in.value %s" % (vms[pid], line.split()[1]))
print "%s_out.value %s" % (vms[pid], line.split()[9]) print("%s_out.value %s" % (vms[pid], line.split()[9]))
break break
except Exception as inst: except Exception as inst:
print inst print(inst)
continue continue
@ -119,9 +119,9 @@ if __name__ == "__main__":
if len(sys.argv) > 1: if len(sys.argv) > 1:
if sys.argv[1] in ["autoconf", "detect"]: if sys.argv[1] in ["autoconf", "detect"]:
if detect_kvm(): if detect_kvm():
print "yes" print("yes")
else: else:
print "no" print("no")
elif sys.argv[1] == "config": elif sys.argv[1] == "config":
config(find_vm_names(list_pids()).values()) config(find_vm_names(list_pids()).values())
else: else: