ConSol-Monitoring / snclient

SNClient+ - Cross platform monitoring agent
MIT License
50 stars 8 forks source link

default configuration of an empty parameter #110

Closed FranckSallet closed 2 months ago

FranckSallet commented 5 months ago

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

sni commented 5 months ago

do you have an example?

FranckSallet commented 5 months ago

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
$
$
sni commented 2 months ago

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