I have a custom script sensor that runs a simple batch file that looks inside a txt file and then checks errorlevel variable for 0, 1, or 2+.
this script runs perfectly fine when executed from the command line on the machine.
PRTG though when running it, shows that it simply isn't running the "Find" command at all, but its not treating it like a bad command.
Here's the output I'm seeing that illustrates the problem:
- Here I run di as an incorrect command, and I get this error so I know its not a problem that PRTG doesn't see the Find command.
C:\XxXxXxXx\Scripts\backup\logs>di 'di' is not recognized as an internal or external command, operable program or batch file.
C:\XxXxXxXx\Scripts\backup\logs>echo.%errorlevel% 9009
- Here is the find command, set to ignore case and find the word Error in the log file in that directory. C:\XxXxXxXx\Scripts\backup\logs>find /I "Error" test.log
- This error level is for when it doesn't find anything, but there's no output from Find which isn't normal, you can see normal output from Find below. C:\XxXxXxXx\Scripts\backup\logs>echo.%errorlevel% 1
Below is the same command, run from the command line of the machine.
C:\XxXxXxXx\Scripts\backup\logs>find /I "Error" test.log
- This TEST.LOG line should be showing if the command is able run at all.
---------- TEST.LOG This is a perfectly good Error backup log.
I have other commands all referencing this file in the same script, and all are finding it. It is only the FIND commands that are exhibiting this odd behavior of no output, error code to 1.
I've given the script the full path to the file, and tested that the DIR command before the FIND was in the right directory, so I know it can see the file.
Any help would be appreciated.
Add comment