mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
Fixing Regexp for kvm plugins to be aware of underscores in vm names (otherwise munin will not generate graphs bc. of too long filenames)
This commit is contained in:
parent
d40562033b
commit
28c4487772
4 changed files with 5 additions and 4 deletions
|
@ -68,7 +68,7 @@ def find_vm_names(pids):
|
||||||
result = {}
|
result = {}
|
||||||
for pid in pids:
|
for pid in pids:
|
||||||
cmdline = open("/proc/%s/cmdline" % pid, "r")
|
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()))
|
result[pid] = clean_vm_name(re.sub(r"^.*-name\x00([a-zA-Z0-9.-_]*)\x00\-.*$",r"\1", cmdline.readline()))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def list_pids():
|
def list_pids():
|
||||||
|
@ -99,3 +99,4 @@ if __name__ == "__main__":
|
||||||
fetch(find_vm_names(list_pids()))
|
fetch(find_vm_names(list_pids()))
|
||||||
else:
|
else:
|
||||||
fetch(find_vm_names(list_pids()))
|
fetch(find_vm_names(list_pids()))
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ def find_vm_names(pids):
|
||||||
result = {}
|
result = {}
|
||||||
for pid in pids:
|
for pid in pids:
|
||||||
cmdline = open("/proc/%s/cmdline" % pid, "r")
|
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()))
|
result[pid] = clean_vm_name(re.sub(r"^.*-name\x00([a-zA-Z0-9.-_]*)\x00\-.*$",r"\1", cmdline.readline()))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def list_pids():
|
def list_pids():
|
||||||
|
|
|
@ -82,7 +82,7 @@ def find_vm_names(pids):
|
||||||
result = {}
|
result = {}
|
||||||
for pid in pids:
|
for pid in pids:
|
||||||
cmdline = open("/proc/%s/cmdline" % pid, "r")
|
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()))
|
result[pid] = clean_vm_name(re.sub(r"^.*-name\x00([a-zA-Z0-9.-_]*)\x00\-.*$",r"\1", cmdline.readline()))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def list_pids():
|
def list_pids():
|
||||||
|
|
|
@ -84,7 +84,7 @@ def find_vm_names(pids):
|
||||||
result = {}
|
result = {}
|
||||||
for pid in pids:
|
for pid in pids:
|
||||||
cmdline = open("/proc/%s/cmdline" % pid, "r")
|
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()))
|
result[pid] = clean_vm_name(re.sub(r"^.*-name\x00([a-zA-Z0-9.-_]*)\x00\-.*$",r"\1", cmdline.readline()))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def get_vm_mac(pid):
|
def get_vm_mac(pid):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue