Subject: monlogerrtrapd -- log file watcher to send mon traps
To: mon@linux.kernel.org

In the hope it may be useful to someone, here is a generic script I've
written to watch log files and send mon traps when a pattern is matched.


Dan Urist
durist@loomissayles.com
durist@world.std.com

=========
Watch for patterns in logfiles and send Mon traps.  This script daemonizes
itself, so it doesn't need to be backgrounded when it is started.

monlogerrtrapd  -U user -P password -h monhost -g group -s service -p
pattern_file [-x xpattern_file] [-t sleep] [-T throttle] logfile
[logfile...]

monlogerrtrapd  -C -p pattern_file [-x xpattern_file] logfile [logfile...]

-C                   # Check mode; reports lines we would have trapped on
and exits

-U user           # Mon trap user
-P password   # Mon trap user's password
-h monhost     # Host that runs mon
-g group          # Mon hostgroup for this trap
-s service       # Mon service name for this trap
-p pattern_file  # File containing perl regexps for error patterns,
                        # one per line
-x xpattern_file # (optional) file containing list of patterns to exclude
                        # which would otherwise match
-t sleep            # (optional) Number of seconds to sleep between file checks;
                        # default is 30.
-T throttle         # (optional) Number of minutes to wait between sending traps
                        # for the same error match and filename. If another match is
                        # seen within "throttle" minutes, the counter is reset; e.g.
                        # if throttle is 5 minutes and we get a match every 4 minutes,
                        # only one trap will be sent. Use with caution!

WARNING: Extraneous whitespace and empty lines will be interpreted as
patterns in the pattern and xpattern files!