Send notification based on log entry - Forum - OpenEdge RDBMS - Progress Community

Send notification based on log entry

 Forum

Send notification based on log entry

This question is answered

Hi,

Recently encountered log entries 9240. I want to run a script and get notication as soon as the first entry of this message gets written in the log file.

I would run a cron job that will run every x minutes (seconds?) to read last x lines of the log. Or grep a tail -f, and send the result to a file, but still need cron to process the file if it exists.

Was thinking perhaps, somebody has done something like event/subscribe mechanism so the script and notification process runs as the entry gets written?

TIA.

Verified Answer
  • ProTop has this capability in the commercial version.

    To do it properly you need to read and parse the .lg file continuously (more or less equivalent to "tail -f").  If you only periodically check the last X lines you will miss messages.

    ProTop also has *much* better methods of tracking and alerting on excessive bi growth than alerting on message 9240.  ProTop will alert you about long transactions, large numbers of active bi clusters and multiple levels of bi usage allowing you to respond long before you get to the 90% -bithold mark.  ProTop will even tell you which users are driving the bi growth.

    For instance, this alert (which you would get as an email or SMS) tells you that about 2.4GB of bi space is being used because usr# 609 has a transaction that is 23 minutes old:

    biUsed 2432 > 2000

    [2019/05/20 01:10:54.443-05:00]

    [server: erp1.xyzzy.com]

    [dbname: /db/erp]

    [cfgname: prod]

     Usr Name            PID      Device             Flags     Duration    

    ===== =============== ======== ================== ===== ============

     609 ScanTmp075      4872     IS_pScan.xyzzy.com R4 *      00:23:31

     639 ext-proces      6992     WebIS              R4 *      00:00:00

     625 batchjobs       84599    pWeb.xyzzy.com ba  R4B*      00:00:00

     589 webuser         79202    pWeb.xyzzy.com ba  RW *      00:00:00

    --
    Tom Bascom
    tom@wss.com

  • You could use something like this:

    tail -fn0 sports.lg | \

    while read line ; do

           echo "$line" | egrep -e "pattern1|pattern2|etc"

           if [ $? = 0 ]

           then

                   ... format and send the message ...

           fi

    done

    I have written my own monitoring script which runs every minute and checks most vital signs of the database. This includes the size of the BI extent(s), BI filesystem space, active transactions (> 10 minutes), transaction backouts that occurred due to long active transactions being aborted and much more.

    It really helps in getting in control on the way the database is behaving and helps us solving problems before the users are affected by it. ProTop is probably *much* better, but if you have some experience with shell scripting and read ProMon statistics you should be able to get your own monitoring.

    I have gathered much helpful information from the PUG sessions in the past and used this to enhance our monitoring. Thanks to all the speakers! ;-)

All Replies
  • ProTop has this capability in the commercial version.

    To do it properly you need to read and parse the .lg file continuously (more or less equivalent to "tail -f").  If you only periodically check the last X lines you will miss messages.

    ProTop also has *much* better methods of tracking and alerting on excessive bi growth than alerting on message 9240.  ProTop will alert you about long transactions, large numbers of active bi clusters and multiple levels of bi usage allowing you to respond long before you get to the 90% -bithold mark.  ProTop will even tell you which users are driving the bi growth.

    For instance, this alert (which you would get as an email or SMS) tells you that about 2.4GB of bi space is being used because usr# 609 has a transaction that is 23 minutes old:

    biUsed 2432 > 2000

    [2019/05/20 01:10:54.443-05:00]

    [server: erp1.xyzzy.com]

    [dbname: /db/erp]

    [cfgname: prod]

     Usr Name            PID      Device             Flags     Duration    

    ===== =============== ======== ================== ===== ============

     609 ScanTmp075      4872     IS_pScan.xyzzy.com R4 *      00:23:31

     639 ext-proces      6992     WebIS              R4 *      00:00:00

     625 batchjobs       84599    pWeb.xyzzy.com ba  R4B*      00:00:00

     589 webuser         79202    pWeb.xyzzy.com ba  RW *      00:00:00

    --
    Tom Bascom
    tom@wss.com

  • You could use something like this:

    tail -fn0 sports.lg | \

    while read line ; do

           echo "$line" | egrep -e "pattern1|pattern2|etc"

           if [ $? = 0 ]

           then

                   ... format and send the message ...

           fi

    done

    I have written my own monitoring script which runs every minute and checks most vital signs of the database. This includes the size of the BI extent(s), BI filesystem space, active transactions (> 10 minutes), transaction backouts that occurred due to long active transactions being aborted and much more.

    It really helps in getting in control on the way the database is behaving and helps us solving problems before the users are affected by it. ProTop is probably *much* better, but if you have some experience with shell scripting and read ProMon statistics you should be able to get your own monitoring.

    I have gathered much helpful information from the PUG sessions in the past and used this to enhance our monitoring. Thanks to all the speakers! ;-)