mickem / nscp

NSClient++
http://nsclient.org
GNU General Public License v2.0
239 stars 94 forks source link

Check_WMI detail-syntax confusion #660

Open kochd opened 4 years ago

kochd commented 4 years ago

Issue and Steps to Reproduce

nscp.exe client --module "CheckWMI" -b ^
 -q "check_wmi" ^
 -a query="Select BuildNumber from win32_OperatingSystem" ^
 -a detail-syntax="You have build %(BuildNumber)" ^
 -a show-all

I am using this example from the documentation and its not behaving like its documented. According to the doc this should replace %(BuildNumber) with the actual result from query. For me the output is:

You have build (BuildNumber)|

Using the alternative Syntax ${BuildNumber} the result is

You have build 7601|

This one works. However one a more complex query (multiple fields + multiple lines) there is another issue:

"C:\Program Files\NSClient++\nscp.exe" client --module "CheckWMI" -b ^
-q "check_wmi" ^
-a "show-all" ^
-a query="select DiskReadBytesPerSec,DiskWriteBytesPerSec,DiskReadsPerSec,DiskWritesPerSec,PercentIdleTime from Win32_PerfFormattedData_PerfDisk_PhysicalDisk" ^
-a detail-syntax="Hello %(DiskReadBytesPerSec)"

Results in:

Hello (DiskReadBytesPerSec), Hello (DiskReadBytesPerSec),...

But when using the alternative Syntax ${BuildNumber} the result is just the perfdata delimiter:

|

Expected Behavior

It should work like documented

Actual Behavior

See above

Details

Additional Details

None