Reply To: Alert based on error DB size?

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Alert based on error DB size? Reply To: Alert based on error DB size?

#58012
Mike Grieger
Participant

    What’s your platform?  If UNIX, you can use something like the script I run on cron every so often (20 minutes for me).  If Windows, you could do something similar creating a batch file and calling it through scheduler.  Having a job check you error amount can be very valuable – for those times when something is put into production and isn’t working the way it is supposed to.

    Anyway, my script monitors our 4 prod sites, and each site is given a its own error threshold.  It emails our team if any of those thresholds is reached.

    #!/bin/ksh

    # Written by Mike G

    #     4/2002

    # Purpose: to have cron job run frequently and alert if anomilies within any production error database

    #

    # To get correct line counts, the dump of the db is grepped by pattern 0.0. which each engine message ID starts with

    setroot /hci/qdx5.3/integrator

    setsite prodsms

    prodsms_errors=`hcidbdump -e | grep 0.0. | wc -l`

    setsite prodmck

    prodmck_errors=`hcidbdump -e | grep 0.0. | wc -l`

    setsite prodtrans

    prodtrans_errors=`hcidbdump -e | grep 0.0. | wc -l`

    setsite prodepr

    prodepr_errors=`hcidbdump -e | grep 0.0. | wc -l`

    # Alert threshhold set to alert when prodsms has 10 errors or more, prodmck has 4 or more, prodtrans has 4 or more, prodepr has 4 or more

    if $prodsms_errors -lt 10 && $prodmck_errors -lt 4 && $prodtrans_errors -lt 4 && $prodepr_errors -lt 4

        then exit 1

    fi

    touch /hci/scripts/Database_Error_Alert_File

    echo “The criteria for alerting has been met for one of the following Error Databases:nn” >> /hci/scripts/Database_Error_Alert_File

    echo “$prodsms_errors Errors currently in prodsms error db      (alert at 10)n” >> /hci/scripts/Database_Error_Alert_File

    echo “$prodmck_errors Errors currently in prodmck error db      (alert at 4)n” >> /hci/scripts/Database_Error_Alert_File

    echo “$prodepr_errors Errors currently in prodepr error db       (alert at 4)n” >> /hci/scripts/Database_Error_Alert_File

    echo “$prodtrans_errors Errors currently in prodtrans error db    (alert at 4)nn” >> /hci/scripts/Database_Error_Alert_File

    echo “Check for validity of the errors in the appropriate process log or error log.nRemove the errors from the Db to avoid further alerts.n” >> /hci/scripts/Database_Error_Alert_File

    mail -s “Cloverleaf Error Database Alert” ieteam@meritcare.com < /hci/scripts/Database_Error_Alert_File rm /hci/scripts/Database_Error_Alert_File