Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-a $ARG$ doesnt recognize whitespaces #11

Open
sysadminasks opened this issue Dec 22, 2018 · 6 comments
Open

-a $ARG$ doesnt recognize whitespaces #11

sysadminasks opened this issue Dec 22, 2018 · 6 comments

Comments

@sysadminasks
Copy link

sysadminasks commented Dec 22, 2018

Hi,

Thanks for this wonderful plug in. I'm just wondering on how to pass the arguments with white spaces.

Command:
./check_nrpe -H 10.0.1.3 -p 5666 -c check_ms_iis_application_pool -a '-A .NET v2.0 Classic' -APOD 1

Error:
CRITICAL: Argument: v2.0 Value: Classic Error: Illegal arguments detected: v2.0

It seems that it is not liking the "second" space on the argument.

Best Regards,
SA

@sysadminasks
Copy link
Author

sysadminasks commented Dec 22, 2018

I also tried doing it this way but no avail.
check_ms_iis_application_pool -a '-A \".NET v2.0 Classic\"' -APOD 1

@sysadminasks
Copy link
Author

Here is the image of app pools.

image

@sysadminasks
Copy link
Author

Hi,

Do you have an update for this?
BR,

@jacklee5209
Copy link

Is the author still managing this project? I having same problem as well. There is no Help document in this Git Hub project. External Help link (https://outsideit.net/monitoring-iis-application-pools/) are not helping as well as the document are no longer exist.

Argument from Nagios server are not working. It will come back with Critical alert (CRITICAL: Application Pool "" does not exist.) no matter how you specify the App Pool.

Here is the check commands that i tried in Nagios server. Non of them is working. end up i have to hard coded the check command in nsclient++ NSC.ini config file to make it works. This is not convenience if you are managing in large infrastructure environment.

Commands that i tired in Nagios server are as below. Non of them is working.
/usr/local/nagios/libexec/check_nrpe -H 10.80.198.43 -p 5666 -t 60 -c check_iis_pool -a '-A poolname'
/usr/local/nagios/libexec/check_nrpe -H 10.80.198.43 -p 5666 -t 60 -c check_iis_pool -a "-A poolname"
/usr/local/nagios/libexec/check_nrpe -H 10.80.198.43 -p 5666 -t 60 -c check_iis_pool -a '--ApplicationPool poolname'
/usr/local/nagios/libexec/check_nrpe -H 10.80.198.43 -p 5666 -t 60 -c check_iis_pool -a "--ApplicationPool poolname"
it will given error as following: CRITICAL: Application Pool "" does not exist.

@Ads87
Copy link

Ads87 commented Sep 30, 2021

I've just come across this same issue in using ncpa
check_ncpa.py -H x.x.x.x -t 'token' -M 'plugins/check_ms_iis_application_pool.ps1' -a '-A Poolname'

Running it in Verbose Mode:
check_ncpa.py -H x.x.x.x -t 'token' -M 'plugins/check_ms_iis_application_pool.ps1' -v -a '-A Poolname'

shows that the issue for me is with the ncpa_check.py (python script) as it calls:
https://x.x.x.x:5693/api/agent/plugins/check_ms_iis_application_pool.ps1/-A/Poolname?token=token&check=1
File returned contained:
{
"returncode": 2,
"stdout": "CRITICAL: Application Pool "" does not exist."
}
CRITICAL: Application Pool "" does not exist.

This shows the 'slash' (/) between -A and Poolname rather than the 'expected' whitespace.
Using the local Browser instance of NCPA shows that the Arg works fine if the whitespace is in situ. or has the 'Slash'

Using the browser version the suggested call is actually:
check_ncpa.py -H x.x.x.x -t 'token' -M 'plugins/check_ms_iis_application_pool.ps1/-A/Poolname'
This then works fine, though as does:
check_ncpa.py -H x.x.x.x -t 'token' -M 'plugins/check_ms_iis_application_pool.ps1/-A Poolname'

Whilst this doesn't solve the nrpe issue - i hope it helps, as it does show that the plugin does work fine, and supports the whitespace. it may be more of an issue as to how the command is passing the arguments through to the check_iis_pool

@ashok-redd
Copy link

Got this working for an application pool with space in name, by making slight change to the code(near line #225) as below:

switch -regex -casesensitive ($CurrentArg) {
'^(-A|--ApplicationPool)$' {

                if ($value) {
                    $IISStruct.ApplicationPool = $Value -replace '^\$',''
                    $IISStruct.ApplicationPool = $IISStruct.ApplicationPool -replace '"',''
                }

and while passing the argument -A "pool name" double quotes need to be used for pool name. I hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants