snclient icon indicating copy to clipboard operation
snclient copied to clipboard

default configuration of an empty parameter

Open k9fr4n opened this issue 1 year ago • 2 comments

Hello,

I went from version 0.17 to version 0.23 on Windows. I notice a change in the value of the arguments when no values are specified in the check_command for CheckExternalScripts.

in version 0.17, the default value for an empty argument was "$" (like nsclient by the way) in version 0.23, the default value for an empty argument is "$ARG1$" (for the first argument)

Is this intended behavior?

I suggest not sending anything, this will allow you to better manage the arguments in the scripts, notably PowerShell

Thanks, Franck

k9fr4n avatar Apr 16 '24 09:04 k9fr4n

do you have an example?

sni avatar Apr 19 '24 17:04 sni

just create a powershell script like 'check_default_arg_value.ps1' with this content:

[CmdletBinding()]
param(
	[Parameter(Mandatory=$false)]$Arg1,
	[Parameter(Mandatory=$false)]$Arg2
)
Write-Host $Arg1
Write-Host $Arg2

declare the script in snclient.ini like:

check_default_arg_value = check_default_arg_value.ps1 '$ARG1$' '$ARG2$'

run the check without argument:

root@nagios:/usr/lib/nagios/plugins# ./check_nrpe -H 91.188.75.98 -c check_default_arg_value
$ARG1$
$ARG2$

before the last release:

root@nagios:/usr/lib/nagios/plugins# ./check_nrpe -H 91.188.75.98 -c check_default_arg_value
$
$

k9fr4n avatar Apr 26 '24 10:04 k9fr4n

thanks for pointing this out, should be an empty string with the next release now.

sni avatar Jul 17 '24 09:07 sni