Unix questions - Syslog Monitoring

This is Interesting: Free IT Magazines  
Home > Archive > Unix questions > November 2005 > Syslog Monitoring





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Syslog Monitoring
Gerry S.

2005-11-21, 5:53 pm

I have a process that will post an entry into syslog periodically when
it is working properly rather than when it isn't. When the process
'breaks' this heartbeat entry will no longer be put into the log.

I need a script to monitor for a negative -- that is to say, I need to
know how many minutes it has been since the even happened last. Of
course, accounting for change of day, month and year.

Does anyone have a script that does this?

Ed Morton

2005-11-21, 5:53 pm

Gerry S. wrote:
> I have a process that will post an entry into syslog periodically when
> it is working properly rather than when it isn't. When the process
> 'breaks' this heartbeat entry will no longer be put into the log.
>
> I need a script to monitor for a negative -- that is to say, I need to
> know how many minutes it has been since the even happened last. Of
> course, accounting for change of day, month and year.
>
> Does anyone have a script that does this?
>


Does this do what you want:

while :
do
mtime=`stat -c "%y" syslog`
[ "$mtime" = "$prevMtime" ] && echo "No update!"
prevMtime="$mtime"
done

Regards,

Ed.
Ed Morton

2005-11-21, 5:53 pm

Ed Morton wrote:

> Gerry S. wrote:
>
>
> Does this do what you want:
>
> while :
> do
> mtime=`stat -c "%y" syslog`
> [ "$mtime" = "$prevMtime" ] && echo "No update!"
> prevMtime="$mtime"


Adding a "sleep" might not be a bad idea ;-), e.g

sleep 60

> done
>
> Regards,
>
> Ed.

Gerry S.

2005-11-21, 5:53 pm

I'm sure the sleep would help quite a bit

Is stat built into the shell? What shell are you using...

I think I can make this work, the shell script would be called by our
monitoring system (Tivoli ) then based on STDOUT or an exit code it
would generate the notification..

-G

Ed Morton

2005-11-21, 5:53 pm

Gerry S. wrote:
> I'm sure the sleep would help quite a bit
>
> Is stat built into the shell?


No, you can get it from FSF, e.g. http://directory.fsf.org/stat.html

What shell are you using...

It depends... normally ksh88 on Solaris, or bash on cygwin (yes, I know,
it's not a real OS, but it does what I want) on Windows XP.

> I think I can make this work, the shell script would be called by our
> monitoring system (Tivoli ) then based on STDOUT or an exit code it
> would generate the notification..


Feel free to post the final version for comments, but please read this
first:

http://cfaj.freeshell.org/google

Regards,

Ed.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com