I created a custom batch script for monitoring a specific service on a webserver. It looks like this:
@echo off sc \\pjlm-s02 query "PAFMAlerting" | find "RUNNING" if "%ERRORLEVEL%"=="0" ( echo Service PAFMAlerting is running Exit 0 ) else ( echo Service is NOT running Exit 2 )
If I run this on any machine on the domain it recognizes the service running, but when I add this custom Sensor it always gives me Service is NOT running.
Any ideas why it would do this?
Article Comments
Yes I am. I switched the account the PRTG service runs under. I actually figured it out, it was the formatting. It now looks like this:
@echo off sc \\pjlm-s02 query "PAFMAlerting" | find "RUNNING" if "%ERRORLEVEL%"=="0" ( exit 0 ) else ( echo 100:Service is Not Running exit 2 )
The problem was that the service under ERRORLEVEL==0 would spit out a line of text before getting to exit 0 and that was conflicting with the PRTG formatting. Essentially the query returns a line of text prior to getting to the exit statement.
Nov, 2015 - Permalink
Are you using an administrative user in the credentials of PRTG and did you set the security context of the sensor to Use Windows credentials of parent device?
Nov, 2015 - Permalink