NagiosEnterprises / ncpa

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

NCPA service crashing when checking powershell script - vssadmin list writers #647

Open 17g-guy opened 4 years ago

17g-guy commented 4 years ago

Hi

I have created a Powershell script to check Windows for VSS writers that are in a failed stated. The Powershell script run from the servers directly works fine. When i run this via Nagios check_ncpa.py, I get mixed results:

This server works fine: /usr/local/nagios/libexec/check_ncpa.py -H 10.1.10.16 -s -t Password -P 5693 -M 'plugins/CheckVSSWriters.ps1' HEALTHY - All VSS Writers report Status - 'Last error: No error'

But this one returns this: /usr/local/nagios/libexec/check_ncpa.py -H 10.1.10.6 -s -t Password -P 5693 -M 'plugins/CheckVSSWriters.ps1' (which is basically no result)

If I then go to the status of the NCPA listener service, the service has stopped. Trying to manually start the service returns "Windows could not start the NCPA Listener - ncpalistener service on Local Computer - Error 5: Access Denied".

Normally after around 5 minutes, the service will then be able to be manually started again.

Nagios: 5.6.14 NCPA Client: 2.2.1 check_ncpa.py: 1.2.0 Server 2012 R2 - Latest patches

Powershell script: https://pastebin.com/mTiCF74S ncpa.cfg loglevel =debug

2020-06-26 08:51:21,448:DEBUG:handler:Initializing WebSocket
2020-06-26 08:51:21,448:DEBUG:handler:Validating WebSocket request
2020-06-26 08:51:21,480:DEBUG:psapi:Imported windowscounters into the API tree.
2020-06-26 08:51:21,480:DEBUG:psapi:Imported windowslogs into the API tree.
2020-06-26 08:51:21,480:DEBUG:pluginnodes:Running process with command line: `powershell -ExecutionPolicy Bypass -File C:\Program Files (x86)\Nagios\NCPA\plugins\CheckVSSWriters.ps1`
2020-06-26 08:51:21,839:INFO:handler:10.1.10.5 - - [2020-06-26 08:51:21] "GET /api/plugins/CheckVSSWriters.ps1/?token=PASSWORD&check=1 HTTP/1.1" 200 260 0.391000

Windows Event Log - System - 7034 - Service control manager - The NCPA Listener - ncpalistener service terminated unexpectedly. It has done this 3 time(s).

I can't see any noticeable difference between working and non working servers

Any help in troubleshooting this would be greatly appreciated

Tom

17g-guy commented 4 years ago

I don't suppose anyone has any suggestions on this?