Page 1 of 1

Powershell script with first argument containing a space

Posted: Tue Oct 24, 2023 7:59 am
by riahc3
I have the following check:

/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

From what you can tell, the issue is that the argument contains a space and there is only one argument (Ive seen examples where there is two arguments and it works)

How can I fix this? I doubt its the script per say because it passes other non space arguments correctly.

Re: Powershell script with first argument containing a space

Posted: Tue Oct 24, 2023 8:26 am
by riahc3
This makes no sense

Image

The fact that Nagios and NCPA does this in 2023 is absurd

Re: Powershell script with first argument containing a space

Posted: Tue Oct 24, 2023 5:09 pm
by bbahn
The first example (black CLI) indicates that the string is properly passed to the script, but the script could not find the resource group. This means that either the resource group doesn't exist or the script can't find it for whatever reason. This indicates that it IS working properly..

The second example (light CLI) on the other hand lends towards the issue being as you've described.

This discrepancy makes me wonder if you could explain the difference in environment that led to this?

Re: Powershell script with first argument containing a space

Posted: Wed Oct 25, 2023 2:20 am
by riahc3
bbahn wrote: Tue Oct 24, 2023 5:09 pm The second example (light CLI) on the other hand lends towards the issue being as you've described.

This discrepancy makes me wonder if you could explain the difference in environment that led to this?
Obviously Im referring to the second example.

There is no difference in the environment. As you can see, both are exactly the same and Ive also tested this against the standalone.

Ive also tested it with the parameter hard coded and it works.