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

use name from commandline parameter for kvm

This commit is contained in:
Bianco Veigel 2020-07-20 19:28:22 +02:00 committed by Lars Kruse
parent 8cff506f07
commit 113008b06d
4 changed files with 29 additions and 0 deletions

View file

@ -52,6 +52,13 @@ def clean_vm_name(vm_name):
if suffix:
vm_name = re.sub(suffix,'',vm_name)
parts = vm_name.split('\x00')
if (parts[0].endswith('kvm')):
try:
return parts[parts.index('-name')+1]
except ValueError:
pass
return re.sub(r"[^a-zA-Z0-9_]", "_", vm_name)
def detect_kvm():

View file

@ -52,6 +52,13 @@ def clean_vm_name(vm_name):
if suffix:
vm_name = re.sub(suffix,'',vm_name)
parts = vm_name.split('\x00')
if (parts[0].endswith('kvm')):
try:
return parts[parts.index('-name')+1]
except ValueError:
pass
return re.sub(r"[^a-zA-Z0-9_]", "_", vm_name)
def fetch(vms):

View file

@ -49,6 +49,13 @@ def clean_vm_name(vm_name):
if suffix:
vm_name = re.sub(suffix,'',vm_name)
parts = vm_name.split('\x00')
if (parts[0].endswith('kvm')):
try:
return parts[parts.index('-name')+1]
except ValueError:
pass
return re.sub(r"[^a-zA-Z0-9_]", "_", vm_name)
def fetch(vms):

View file

@ -100,6 +100,14 @@ def clean_vm_name(vm_name):
suffix = os.getenv("vmsuffix")
if suffix:
vm_name = re.sub(suffix, "", vm_name)
parts = vm_name.split('\x00')
if (parts[0].endswith('kvm')):
try:
return parts[parts.index('-name')+1]
except ValueError:
pass
return re.sub(r"[^a-zA-Z0-9_]", "_", vm_name)