Syslog Monitoring - Unix

This is a discussion on Syslog Monitoring - Unix ; 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 ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Syslog Monitoring

  1. Syslog Monitoring

    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?


  2. Re: Syslog Monitoring

    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.

  3. Re: Syslog Monitoring

    Ed Morton wrote:

    > 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"


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

    sleep 60

    > done
    >
    > Regards,
    >
    > Ed.


  4. Re: Syslog Monitoring

    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


  5. Re: Syslog Monitoring

    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.

+ Reply to Thread