- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script to Monitor log for ERROR and mail me
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2002 06:58 AM
07-02-2002 06:58 AM
I know I can use some combination of these command : "tail -f syslog.log" along with
"egrep -i 'ERROR|WARN' | mail -s "SYSLOG ERROR" myself@domain.com" but do not
know how to put it in a script and to run 24 by 7.
Any other sugges. are welcome
Thanks a lot.
Solved! Go to Solution.
- Tags:
- syslog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2002 07:19 AM
07-02-2002 07:19 AM
Re: Script to Monitor log for ERROR and mail me
http://ciac.llnl.gov/ciac/ToolsUnixSysMon.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2002 07:27 AM
07-02-2002 07:27 AM
Re: Script to Monitor log for ERROR and mail me
Running the grep command above will result in a number of bogus pages. The grep command above doesn't track what messages it has sent a page for or not. So if you run that command 24x7, you'll be paged 24x7!!
The best way is to use an application that is set up specifically to accomplish this task so that you are not using that grep command constantly.
HP's IDS and/or ITO handles this as well as 3rd party apps like big brother.
ids: http://www.hp.com/products1/unix/operating/security/
big brother:
http://www.bb4.com
Cheryl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2002 07:32 AM
07-02-2002 07:32 AM
SolutionI wrote the attached script to check for the words "Performed a switch|POWERFAILED" in the syslog and then email me if it occurs but ensuring that I am only informed once.
Please feel free to borrow it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2002 09:43 AM
07-02-2002 09:43 AM
Re: Script to Monitor log for ERROR and mail me
-------------------------
#save the old linecount for syslog...
mv newcount oldcount
#save the new linecount for syslog in our file...
wc /var/adm/syslog/syslog.log | awk {'print $1'} > newcount
#get the new linecount for syslog into a variable...
NEWCOUNT=`wc /var/adm/syslog/syslog.log | awk {'print $1'}`
#echo $NEWCOUNT
#get the old linecount for syslog from our file...
OLDCOUNT=`cat oldcount`
#echo $OLDCOUNT
#subtract the linecounts to get a number for tail...
MM=`expr $NEWCOUNT - $OLDCOUNT`
#echo $MM
#tail the log and get the count of error lines...
ECOUNT=`tail -$MM /var/adm/syslog/syslog.log | grep peer | wc | awk {'print $1'}`
#echo $ECOUNT " errors detected"
#if the number of errors is > 1 then send you email...
if expr $ECOUNT \> 1
then
#get the first message with the error...
EMSG=`tail -$MM /var/adm/syslog/syslog.log | grep peer | head -1`
#echo "first error was " $EMSG
echo $EMSG | mailx -s "error detected" you@your_email_address
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2002 11:29 AM
07-02-2002 11:29 AM
Re: Script to Monitor log for ERROR and mail me
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2002 11:37 AM
07-02-2002 11:37 AM
Re: Script to Monitor log for ERROR and mail me
Marty