PerfCounterPlugin cannot read some counters
Hello, for some reason the plugin cannot read some (valuable) performance counters. For example "System\Threads". Tested on Windows 10 Pro 1903. Most of the counters are read.
The plugin config is:
[PerfCounterPlugin_Threads] Object=System Counter=Threads GraphTitle=Number of Threads GraphCategory=system GraphDraw=LINE GraphArgs=--base 1000 --lower-limit 0 --upper-limit 100 DropTotal=0 CounterFormat=int CounterMultiply=1.000000
The PowerShell code shows that the counter exists and has value:
PS C:\WINDOWS\system32> Get-Counter -Counter "\System\Threads"
Timestamp CounterSamples
29.2.2020 г. 19:21:26 \cl-mravunko\system\threads : 3145
The error in the application log:
ERROR:PerfCounter plugin: Threads: PdhExpandWildCardPath error=c0000bc4 ERROR:Failed to load PerfCounter plugin: [PerfCounterPlugin_Threads]
Other values that cannot be read:
\Memory\Available Bytes \Memory\Page Faults/sec \Memory\Pages/sec \Memory\Cache Bytes \System\File Read Operations/sec
Got the same issue with PerfCounterPlugin_Uptime on Windows Server 2012 RC2. No special locales.
Same issue with "\System\Systembetriebszei" and "\SQLServer:General Statistics\Connection Reset/sec". Get-Counter -Counter "\SQLServer:General Statistics\Connection Reset/sec" works in Powershell. In munin-node.exe: ERROR:PerfCounter plugin: uptime: PdhExpandWildCardPath error=c0000bc4 ERROR:Failed to load PerfCounter plugin: [PerfCounterPlugin_uptime]
if Instance option it's not specified on the configuration file the value of instance is set to "*" (/src/plugins/PerfCounterMuninNodePlugin.cpp:155) and as a consequence the path of perfcounter will be created as \\Object(*)\\Counter (/src/plugins/PerfCounterMuninNodePlugin.cpp:166) resulting in an invalid path. For example (as by the default config file) for PerfCounterPlugin_Uptime the counter path will be \\System(*)\\System Uptime and it's not valid. To solve this issue you can provide an empty Instance option on the plugin section so the counter path will be right (\\System()\\System Uptime), for example:
[PerfCounterPlugin_uptime] Object=System Counter=System Up Time Instance= GraphTitle=Uptime GraphCategory=system GraphDraw=AREA GraphArgs=--base 1000 -l 0 DropTotal=0 CounterFormat=large CounterMultiply=1.1574074074074073e-005
Tested on Windows Server 2012 RC2. Maybe it's useful to update the default munin-node.ini.
Please note, about the uptime plugin, that is common to prefer the PerfCounter version of the uptime plugin. To disable the embedded uptime plugin you can add Uptime=0 in the Plugins section (this switch can be another good addition to the default munin-node.ini).