Question

  Asked: Apr 3 2008   1:38 PM GMT
  Asked by: NewSAPUser


Perl script to monitor application start and stop events in logfile


Perl, Unix

Hello,

I am looking for a perl script for Unix that would monitor for a start and stop line in an applciaiton logfile that contains the date/time of stat and stop.

It needs to be able to calculate the date/time from start of applciation for 30 minutes and if no stop is logged to logfile within 30 minutes to send an alert or email notification.

Not a perl scriptor, but Perl is needed for my environment.

Any help appreciated.

Thanks.

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



I would recommend SEC. You can use SEC to monitor the logfile in real time and have it keep track of what you want it to. You would want a PairWithWindow type rule. Something like this:

type=PairWithWindow
ptype=RegExp
pattern=MyApplication started
desc=MyApplication started
action=logonly; pipe '$0' /bin/mailx -s 'MyApplication hasn't stopped in 30 minutes' somebody@mydom.com
ptype2=RegExp
pattern2=MyApplication stopped
desc2=MyApplication stopped
action2=none
window=18001


That rule will send you an email if the app stop isn't noticed 30 mins after the app start. You would launch sec.pl with the
-input=/path/to/logfile 
option for it to follow a certain log.
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Development and Linux.

Looking for relevant Development Whitepapers? Visit the SearchSQLServer.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register