Build precise queries to find exactly what you need
Press ESC to close
Nagios World Conference 2026: Sept. 14-17 in St. Paul, MN | Learn More
Your review has been submitted and is pending approval.
Check file for pattern Written in Python 2.6
Current Version
1
Last Release Date
2013-10-21
Owner
Nguyen Duc Trung Dung
Website
http://www.cloudarch.club
Download URL
https://exchange.nagios.org/wp-content/uploads/project-files/2013/10/check_pattern.py
License
GPL
Compatible With
check file for pattern
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)
--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
You must be logged in to submit a review.
To:
From: