How can I check a file’s content?
Q: I need to trigger a specific alert if a file contains certain data. How can I do that?
A: Some examples of custom monitors are delivered with IPHost Network Monitor installation. One of them is a script that checks a file content (and extracts specified value from the file). This VBScript (file_content.vbs) can be used to find specific content in a given file. To use it, locate iphost_file_content.vbs file in scripts folder of IPHost Monitor installation, use ‘Run Script’ program type. The parameters expected are:
filename mode string credentials
Where ‘filename’ is the file name, ‘mode’ is either ‘C’ (count – find the number of occurrences of ‘string’) or ‘F’ (find the first numeric string after the first ‘string’ is found); credentials, if present, are of the same format as provided for ‘-l’ parameter for dirsize_kb sample program shipped with IPHost Network Monitor.
A command line example is:
"C:\ProgramData\IPHost Network Monitor\logs\error.log" C shutdown
(i.e., scan the IPHost Monitor error log file and return the number of ‘shutdown’ strings found)
For example, you can create Custom monitor with the following parameters: