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

Whitespace cleanup

* remove trailing whitespace
* remove empty lines at the end of files
This commit is contained in:
Lars Kruse 2018-08-02 02:03:42 +02:00
parent ef851f0c34
commit 17f784270a
604 changed files with 2927 additions and 2945 deletions

View file

@ -37,7 +37,7 @@ graph_args --base 1024
print "%s_read.info I/O used by virtual machine %s" % (vm, vm)
print "%s_write.label %s" % (vm, vm)
print "%s_write.type COUNTER" % vm
print "%s_write.min 0" % vm
print "%s_write.min 0" % vm
print "%s_write.draw LINE1" % vm
print "%s_write.negative %s_read" % (vm, vm)
print "%s_write.info I/O used by virtual machine %s" % (vm, vm)
@ -53,7 +53,7 @@ def clean_vm_name(vm_name):
vm_name = re.sub(suffix,'',vm_name)
return re.sub(r"[^a-zA-Z0-9_]", "_", vm_name)
def fetch(vms):
''' Fetch values for a list of pids
@param dictionnary {kvm_pid: cleaned vm name}
@ -64,11 +64,11 @@ def fetch(vms):
for line in f.readlines():
if "read_bytes" in line:
read = line.split()[1]
print "%s_read.value %s" % (vms[pid], read)
print "%s_read.value %s" % (vms[pid], read)
if "write_bytes" in line:
write = line.split()[1]
print "%s_write.value %s" % (vms[pid], write)
break
print "%s_write.value %s" % (vms[pid], write)
break
f.close()
def detect_kvm():
@ -87,14 +87,14 @@ def find_vm_names(pids):
cmdline = open("/proc/%s/cmdline" % pid, "r")
result[pid] = clean_vm_name(re.sub(r"^.*-name\x00([a-zA-Z0-9.-_-]*)\x00\-.*$",r"\1", cmdline.readline()))
return result
def list_pids():
''' Find the pid of kvm processes
@return a list of pids from running kvm
'''
pid = Popen("pidof qemu-kvm qemu-system-x86_64 kvm", shell=True, stdout=PIPE)
return pid.communicate()[0].split()
if __name__ == "__main__":
if len(sys.argv) > 1:
if sys.argv[1] in ['autoconf', 'detect']: