* works on debian bullseye with this modification.
* removed all codestyle issues, checked with "pycodestyle" on debian bullseye, besides two "line too long"
* "config" param must not have newlines to avoid a warning in munin-update.log
the line length change doesn't make the world better... without pyflakes I already wondered, why there is an additional linebreak. now it needs two additional one to stay below 99
changes here are tested and work on Python 3.7.3 (debian buster).
in python3 filter returns an object, not an list. I think a list is required here? at least the plugin works as soon as list(...) is added.
need to change from pid to pid.decode, as pid is binary and not a string.
On Debian Stretch the cmdline is something like:
qemu-system-x86_64-enable-kvm-nameguest=vmname,debug-threads=on-S-[…]
Without null characters:
qemu-system-x86_64 -enable-kvm -name guest=vmname,debug-threads=on[…]
We need to match only guest=vmname, so the regex
"^.*guest=([a-zA-Z0-9.-_-]*).*$" is simpler and match the VM name.
The precedent regex "^.*-name\x00([a-zA-Z0-9.-_-]*)\x00\-.*$" was not matching it.
BTW, It seems that \x00 does not match correctly null characters so I removed it.
The network interface parser of this plugin was overly specific before.
It relied on a specific format of the arguments handed over to kvm while
starting the VM. For example the following format was usable:
... -netdev tap,ifname=foo,...
But kvm/qemu support a variety of ways for configuring network
interfaces via the commandline. E.g. libvirt does not use the "ifname"
parameter above. Thus VMs running on a host controlled via libvirt
cannot be tracked with this plugin.
This limititation is now clearly documented in the header of the plugin.
The old parser seemed to rely on a simple "-name foo" argument format of
kvm/qemu. The changed parser also accepts the following formats:
* name,foo=bar,baz=bot
* guest=name,foo=bar