Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

check_log.sh

Rating
0 votes
Favoured:
0
Current Version
2
Last Release Date
2011-06-20
Compatible With
  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x
  • Nagios XI
  • Nagios Fusion
Owner
Hits
159926
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
./check_log.sh
Often I 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.

Example usage:
./check_log.sh