1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-24 09:57:09 +00:00

kvm_*: improve field names

fixed graph failure for VM names starting with digits

used "Validate filednames" Python stanza from docs to improve
clean_vm_name functions, helping graph creations for VM with names
starting with digits, like "150-121-Apache".

remember: each data source in a plugin must be identified by a field
name (in this case VM names). The characters must be [a-zA-Z0-9_],
while the first character must be [a-zA-Z_].
This commit is contained in:
Steve Baroti 2022-06-21 11:04:53 -04:00 committed by Lars Kruse
parent 7869455fcb
commit d00a5ab56b
4 changed files with 4 additions and 4 deletions

View file

@ -83,7 +83,7 @@ def clean_vm_name(vm_name):
return parts[parts.index('-name') + 1]
except ValueError:
pass
return re.sub(r"[^a-zA-Z0-9_]", "_", vm_name)
return re.sub(r"(^[^A-Za-z_]|[^A-Za-z0-9_])", "_", vm_name)
def detect_kvm():