Page 1 of 1

Unknown Command(s)

Posted: Mon Jan 30, 2017 11:12 am
by jkinning
I have a powershell script that is working on 6 out of 8 servers to monitor IIS App pool and IIS websites. On these particular servers when I try to run the command I get this:
./check_nrpe -H <host> -c check_iis8_app_pool_state -a CLICPublic
Unknown command(s): check_iis8_app_pool_state

I have the command in the nsclient.ini file and the NSClient++ is running on Windows 2012R2. I cannot figure out why the client doesn't know the command.

Re: Unknown Command(s)

Posted: Mon Jan 30, 2017 1:42 pm
by tgriep
A couple of things to try is to change the command to use back slashes and edit the lastexitcode so change the following line from

Code: Select all

check_iis8_app_pool_state=cmd /c echo scripts/powershell/check_iis8_app_pool_state.ps1 $ARG1$; exit($lastexitcode) | powershell.exe -command -
to

Code: Select all

check_iis8_app_pool_state=cmd /c echo scripts\powershell\check_iis8_app_pool_state.ps1 $ARG1$; exit $LastExitCode | powershell.exe -command -
Save the file and restart the NSClient++ service.
If you still have issues, please post the nsclient.log file so we can view the error.

Re: Unknown Command(s)

Posted: Mon Jan 30, 2017 1:49 pm
by jkinning
still getting the same thing.

Log file is attached.

Re: Unknown Command(s)

Posted: Mon Jan 30, 2017 2:51 pm
by SteveBeauchemin
If you do have existing systems that work properly - can you copy the ini file from one of those working systems, overwrite the file on the system where the problem is, and stop/start the service?

Steve B

Re: Unknown Command(s)

Posted: Mon Jan 30, 2017 3:27 pm
by dwhitfield
In addition to what @SteveBeauchemin said...
jkinning wrote:I have a powershell script
Do you mean https://raw.githubusercontent.com/ester ... _state.ps1 ? If not, could you post the code? You can PM it, if you prefer.

Re: Unknown Command(s)

Posted: Mon Jan 30, 2017 3:35 pm
by jkinning
You can close this one up. I was looking at these systems and they had two different versions of the NSClient++ installed. I uninstalled both versions and then installed one version and my checks are working.

Thanks!

Re: Unknown Command(s)

Posted: Mon Jan 30, 2017 3:38 pm
by dwhitfield
Glad to hear it is resolved. I am going to lock the thread. Please feel free to post again if you have you another issue. Thank you for using the Nagios forums!