Archive

Posts Tagged ‘grep’

check log script

June 20th, 2011 4 comments

Nagios bash check_log

Its often needed to check log files for a keyword.
So I wrote a simple bash script to do that plus integrate with nagios and perfdata so it also generate
graphic.
The script is based on tail -f and grep on the logfile with nohup command, like:
nohup tail -f $LOG_FILE |grep –line-buffered “$VAR” > “$TMP” &

I recommend calling the check each 5 minutes.

Read more…