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.
* Only show extinfo if stat is the GNU version
* Unify variable references
* Better legend when type is not GAUGE
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
* use 2 newlines to separate toplevel objects
* use string comparision for argument parsing instead of substring search
* remove hashes
* use perldoc style
Setting
`env.torconnectmethod 'port'`
leads to the error:
```
munin-run tor_bandwidth
env.torconnectmethod contains an invalid value. Please specify either 'port' or 'socket'.
```
Removing the quotes solves that, because the quotes are part of the variable value.
["There is no need to quote the variable content."](http://guide.munin-monitoring.org/en/stable-2.0/plugin/use.html)
Fixes
```
munin-run tor_bandwidth
File "/etc/munin/plugins/tor_bandwidth", line 450
if router[0] == "r":
^
IndentationError: expected an indented block
```
ans use single quotes constantly also for GeoIP.dat filename
Used the correct munin way by soursing "$MUNIN_LIBDIR/plugins/plugin.sh" and use clean_fieldname.
For the title I removed the replacement of / by __ and on the multigraph value I added the usage of clean_fieldname to make it backwards compatible.
Fix regression in last commit. While it added auto-detection of changing
column position it did not take into account the known change from
Java 7 > 8.
Java <8 had the Permanent Generation region which jstat columns PU, PC
While Java >=8 now has a Metaspace region (for similar purpose) with
jstat columns MU,MC.
Add re-add detection for that change to fix reporting of the values.
To simplify code uses the MU,MC labels internally and when MU,MC are
not found in jstat output it fills those with PU,PC values.
Java8.
jstat column output is not stable across JVM versions (technically
version of jstat binary used).
New columns are added not add the end of column list but in the middle
breaking access via constant index.
Following table shows the known columns per version:
Oracle JDK / OpenJDK 1.5 .. 1.7
S0C S1C S0U S1U EC EU OC OU PC PU YGC YGCT FGC FGCT GCT
Openjdk 1.8 .. 10
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT
Openjdk 11 .. 12
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT CGC CGCT GCT
Earlier commit here added support for java8+ but using version checking
if version == 1.5 > Use pre-java8 column format, else new format.
As fixing java6+7 would mean more version comparison which is ugly this
cmomit changes retrival logic to the following;
a.) Parse first line jstat output to find position for each label
b.) Then use that position to fetch value from 2nd line
That way code auto-adjusts to any ordering change without needing any
java version specific code or checks.
On the way fix 'Permanent Used' value reporting for java8 which was
broken (missing variable rename from PU -> MU when java8 support was
added).
* fix spelling mistake (thanks, codespell)
* do not hide exit code of command substitution via "local" (thanks, shellcheck)
* avoid access of potentially undefined variables (thanks, shellcheck)
* fix tabs/spaces
* avoid variable substitution in arithmetic substitution
* reduce number of successive blank lines at the top level down to two
* simplify evaluation of "printenv" output