Is there a way to monitor a file for a changing numerical value? I have a metric script that writes its output as a numerical value to a text file, and I'd like to be able to draw that output value into PTRG as a sensor value and raise a warning if it's above/below a specific numerical value. The only content of the text file would be a number that would get updated every 30 minutes or so.
Thanks! Scott
Article Comments
That does allow monitoring of a file, but only seems to be able to indicate whether the file has changed or not. I need to be able to actually display the contents of the file as the sensor output, and throw a warning/error if the number is less than 100. I am able to get the output of that custom sensor to show the value I want as "last message", but "last result" appears to be the only output that's usable, and that's only a 0/1/2 output depending on the change status of the file contents.
Scott
Dec, 2010 - Permalink
It says "This Custom Sensor returns whether a specified string occurs in a (log) file", so an actual content is performed. However this will not enable the usage of the limits then in PRTG, as it's a string.
Dec, 2010 - Permalink
Well, this seems simple enough for a small batch file. Create a file called value.bat in the \Custom Sensor\EXE folder of your PRTG installation and paste the following 3 lines:
@echo off type %1% echo :this is my value
Create a new sensor and select the value.bat file. As commandline parameter you will need to supply the filename that holds the value you want to use.
Note: the file that holds the value must not contain any linefeeds.
Regards, Gerard
Dec, 2010 - Permalink
Dear Scott,
this should be possible using the Custom Sensor LogfileReader from our PRTG User Gerard Feijth.
Best Regards.
Dec, 2010 - Permalink