Text file parsing question

Remote Monitoring Agent for Linux, FreeBSD, and other UNIX-like platforms.
Post Reply
invisik
Posts: 34
Joined: Mon Jan 15, 2007 10:35 pm

Text file parsing question

Post by invisik »

Hi,

I'm using the Linux RMA on a SUSE 10 box with HostMonitor 7.10. I have one item to check /var/log/messages for the word "error" and another item to check it for the word "root".

Unfortunately, I have a process that runs every few hours that does log in remotely as root, does a few things, and then logs out. This generates alerts when I don't want it to.

I haven't found a way to exclude certain lines of text when parsing a text file. The alerts I'm getting are exactly the same each time--if I could say "Alert on anything except these strings" that would be perfect.

Is that possible? Thanks for any info...

-m
KS-Soft
Posts: 12869
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

What test method do you use? Text Log? Then you may use "Look for expression" option of the test.
Quote from the manual
Look for

string: with this option selected HostMonitor will check records in a log file for a specified string. If new record contains specified data, HostMonitor will change status of the test to "Bad"

expression: with this option selected HostMonitor will check log records using a boolean (logical) expression. Status of the test will be set to "Bad" when the text in the record satisfies the required conditions. In the expression you may use strings (must be concluded in quotes (') or double quotes (")); round brackets; logical operators "and", "or", "not".
For example: if you define expression like ('error' or 'warning') and not '16536', then HostMonitor will mark test as "Bad" when line in the log contains string 'error' or 'warning' and does not contain string '16536'
Regards
Alex
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Re: Text file parsing question

Post by KS-Soft Europe »

invisik wrote:I haven't found a way to exclude certain lines of text when parsing a text file. The alerts I'm getting are exactly the same each time--if I could say "Alert on anything except these strings" that would be perfect.
In addition to Alex, I want to say that if you are using "Text Log" test method, you may use "Optional Status processing" feature: http://www.ks-soft.net/hostmon.eng/mfra ... processing
For instance, you may enable "Use Normal status if" option with the following expression:

Code: Select all

('%SuggestedSimpleStatus%'=='DOWN') and ('Some string you want to exclude' in '%Reply%')
Regards,
Max
Post Reply