mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-24 09:57:09 +00:00
Whitespace cleanup
* remove trailing whitespace * remove empty lines at the end of files
This commit is contained in:
parent
ef851f0c34
commit
17f784270a
604 changed files with 2927 additions and 2945 deletions
|
@ -50,7 +50,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}
|
||||
|
@ -61,12 +61,12 @@ def fetch(vms):
|
|||
cmdline = open("/proc/%s/cmdline" % pid, "r")
|
||||
amount = re.sub(r"^.*-m\x00(.*)\x00-smp.*$",r"\1", cmdline.readline())
|
||||
amount = int(amount) * 1024 * 1024
|
||||
print "%s_mem.value %s" % (vms[pid], amount)
|
||||
print "%s_mem.value %s" % (vms[pid], amount)
|
||||
except:
|
||||
cmdline = open("/proc/%s/cmdline" % pid, "r")
|
||||
amount = re.sub(r"^.*-m\x00(\d+).*$",r"\1", cmdline.readline())
|
||||
amount = int(amount) * 1024 * 1024
|
||||
print "%s_mem.value %s" % (vms[pid], amount)
|
||||
print "%s_mem.value %s" % (vms[pid], amount)
|
||||
|
||||
def detect_kvm():
|
||||
''' Check if kvm is installed
|
||||
|
@ -84,14 +84,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']:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue