Log Files

check_pattern

Description:

Check file for pattern
Written in Python 2.6

Current Version

1

Last Release Date

2013-10-21

Compatible With

  • Nagios 3.x

License

GPL


Project Files
Project Notes
check_pattern is used to scan the lines of a file for expressions used in python. It allow to schedule check on several time and send matched result to file or mail to recipient Usage: check_pattern.py [options] Options: -h, --help show this help message and exit -p, --showpattern show pattern help -n NAME, --name=NAME name your search (Ex: errors, monster... one at time) -f FILE, --file=FILE file location -s TIMES, --schedule=TIMES STARTTIME-ENDTIME (Ex: 07:00-17:45,19:00-20:00) default: 00:00-23:59 -o OFFDAY, --off=OFFDAY exclude days (Ex: Sunday,Saturday) default: None -e ERRORS, --error=ERRORS error patterns to search (Ex: "error|caused by" OR "^server" OR etc.) -i, --ignorecase ignore case sensitive -q, --quite do not print matched search --line=LINE number of last lines to check. Default: entire file --outfile=OUTFILE output result to FILE --mailto=OUTMAIL send result to RECIPIENT (use "mail" command)
Reviews (1) Add a Review
--line number of last lines to check. Default: entire file
by vipertje, January 31, 2020

--line= number of last lines to check. Default: entire file For this function to work and have the script check the last lines of the file instead of the first lines of the file. Replace: for i in reversed(range(0, opts.line)):#search for pattern With: for i in reversed(range((len(out)-int(opts.line)), len(out))):#search for pattern



Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4 (1)
Favorites
0
Views
33,718