Not sure if this helps but one of the client side scripts I created checks log files for certain expressions and reports back to xymon if the error count is greater than the last report.
The script is a shell script running in cygwin and look
something like:
#!/bin/sh
##############################################################################
## The script was written sh to be used in cygwin in
conjunction with BBWin
## The script checks the Application logs for errors or
exceptions
## Requirements:
## BBWin, Cygwin (Base install)
##############################################################################
CLEAR="clear"
RED="red"
YELLOW="yellow"
GREEN="green"
UNKNOWN="purple"
BB=BBWinCmd.exe
BBDISP=<BBWINSERVER>
MACHINE=`hostname`
COLUMN=<COLUMN_NAME>
COLOR=$GREEN
BBLOG=D:/Logs/AppLogs.txt
echo "Application Error Logs" > $BBLOG
if [ ! -e "D:/Logs/PREERRORS.log" ]; then
`touch
D:/Logs/PREERRORS.log`
fi
PREERRORLOG=D:/Logs/PREERRORS.log
PREERRORS=`cat D:/Logs/PREERRORS.log`
APPLOG=D:/Logs/AppLog-"`eval date +%Y%m%d`".log
if [ -e $APPLOG ]; then
ERRORS=`cat $APPLOG|
grep -i -e error -e exception | wc -l`
else
ERRORS=0
fi
if [ "$ERRORS" -gt "$PREERRORS" ]; then
COLOR=$RED
echo "App Errors
= $ERRORS "\|" Previous Error Count = $PREERRORS" >>
$BBLOG
echo
"LOG:" >> $BBLOG
tail -n +1 $APPLOG|
grep -m 10 -i -e error -e exception >> $BBLOG
echo "LOG
END" >> $BBLOG
echo " "$BBLOG
echo " "
$BBLOG
else
echo "App
Errors = No New Errors "\|" Previous Error Count = $PREERRORS"
$BBLOG
fi
echo $ERRORS > $PREERRORLOG
# Tell Hobbit about it
$BB $BBDISP status $MACHINE $COLUMN $COLOR "`cat
D:/Logs/AppLogs.txt`"
exit 0
Date: Thu, 23 Apr 2009 08:58:22 +1000
From: user-06769a90444e@xymon.invalid
To: user-ae9b8668bcde@xymon.invalid
Subject: RE: [hobbit] monitoring text file
I posted a VB script to the shire that uses this idea to test the
running of DCDiags. If you cut down that script so that it only opens
your log file and looks for the word it will achieve what you want.
Don't know how to get the method below to work.
Hope this helps
Regards
Graeme
-----Original Message-----
From: Johan Booysen [mailto:user-6f017f1ad8a9@xymon.invalid]
Sent: Wednesday, 22 April 2009 2:25 AM
To: user-ae9b8668bcde@xymon.invalid
Subject: [hobbit] monitoring text file
I basically use hobbit 4.2.0 more or less as it comes out of the box and
that's been sufficient for us. The downside is that I don't actually
know a lot about "advanced" features...
I want to monitor a plain text log file on one of our Windows servers
(already running BBWin and reporting just fine). I've RTFM and came to
the conclusion that I need to do something like the following:
Specify the specific log file in client-local.cfg on the hobbit server:
[win32]
log:"d:\Log directory with spaces in name\log.txt":10240
Configure hobbit-clients.cfg so that the occurrence of the word "error"
causes the server's status to go red:
HOST=winservername
LOG "d:\Log directory with spaces in name\log.txt" %error
color=red
Is this the correct way of doing this? I guess not because it doesn't
appear to be evaluating that log file. I've had a look at the logs but
see nothing to help.
Will appreciate advice on this.
Thanks.
Important - This email and any attachments may be confidential. If received in error, please contact us and delete all copies. Before opening or using attachments check them for viruses and defects. Regardless of any loss, damage or consequence, whether caused by the negligence of the sender or not, resulting directly or indirectly from the use of any attached files our liability is limited to resupplying any affected attachments. Any representations or opinions expressed are those of the individual sender, and not necessarily those of the Department of Education and Early Childhood Development.
View your Twitter and Flickr updates from one place – Learn more!
http://clk.atdmt.com/UKM/go/137984870/direct/01/