Powershell script with first argument containing a space

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Post Reply
riahc3
Posts: 59
Joined: Thu Apr 05, 2018 9:36 am

Powershell script with first argument containing a space

Post 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.
riahc3
Posts: 59
Joined: Thu Apr 05, 2018 9:36 am

Re: Powershell script with first argument containing a space

Post by riahc3 »

This makes no sense

Image

The fact that Nagios and NCPA does this in 2023 is absurd
bbahn
Posts: 112
Joined: Thu Jan 12, 2023 5:42 pm

Re: Powershell script with first argument containing a space

Post 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?
April: Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.
riahc3
Posts: 59
Joined: Thu Apr 05, 2018 9:36 am

Re: Powershell script with first argument containing a space

Post 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.
Post Reply