NagiosEnterprises / ncpa

Nagios Cross-Platform Agent
Other
176 stars 95 forks source link

Run a Powershell script that requires a parameter that can have spaces #999

Closed riahc3 closed 7 months ago

riahc3 commented 9 months ago

Similar to #829 , Im running

/usr/local/nagios/libexec/check_ncpa.py -H thehost -t '' -P 5693 -M 'plugins/CheckClusterResourceGroupStatus.ps1' -a "'Cluster Group'"

But I get the following error

UNKNOWN - Resource group \'Cluster/Group\' not found

The worst part of this is

dtcXOO4

This makes no sense and is ABSURD that this happens with NCPA and Nagios XI (a paid product) in 2023.

Both sides should have logic to deal with this

riahc3 commented 9 months ago

[nagios@nagiosxi ~]$ /usr/local/nagios/libexec/check_ncpa.py -H clu -t '' -P 5693 -M 'plugins/chkspace.ps1' -q "args='My Job',args=90,args=95" C:\Program Files (x86)\Nagios\NCPA\plugins\chkspace.ps1 : Cannot process argument because the value of argument "name" is not valid. Change the value of the "name" argument and run the operation again.

Yet, in cli and in API it works

riahc3 commented 9 months ago

I think I had to do all this crap to remove it

$var = $var -replace "'","" $var = $var -replace "`"","" $var = $var -replace "\","" $var = $var -replace "/'"," "

This in Nagios:

-t '' -P 5693 -M 'plugins/Script.ps1' -a '-parameteronename "Value of parameter one" -parametertwoname 85 -parameterthreename 95'

Ugly and crap in 2023

ne-bbahn commented 9 months ago

Which version of Nagios XI are you running? image I am not encountering this issue.

ne-bbahn commented 8 months ago

If I don't get a response here, I will close this issue in a few days. It works fine for me as can be seen above.