OMSA alert script - Alert, Raid and Sensor data question

Björn Augustsson august at chalmers.se
Fri Jul 15 06:26:58 CDT 2005


On Thu, Jul 14, 2005 at 12:02:27PM -0700, Lutz Birkhahn wrote:
> Robert Oschwald wrote:
> > currently I'm implementing an alert script which informs me about OMSA
> > alerts. As there are no parameters given by OMSA when calling the script, I
> > try to get needful things (alert message etc.) via racadm etc.
> >
> > Has someone successfully implemented such queries?
> 
> I solved this with multiple names for the alert script (using soft links),
> but that only gives the alert type, not any details.
> 
> E.g. alert_tempfail is a soft link to the "generic" script omsa_alert,
> which starts with
> 
>    ProgName=$(basename $0)
>    # remove the leading "alert_" (bash syntax):
>    EventName=${ProgName#alert_}
> 
>    case $EventName in
>       tempfail)
>          # alert-specific actions go here
>          ;;
>    esac
> 
> each script is installed with it's specific name, like
> 
>    /usr/bin/omconfig system alertaction event=tempfail \
>          execappath=/usr/local/bin/alert_tempfail

Here's what I did (This is from the kickstart %post, but can just be 
pasted into a terminal for retrofits.)

--------------------------8<----------------------

        # Make us get mail for all alerts:
                                                                                
        OMSA_MAIL=/usr/local/bin/omsa_mail.sh
                                                                                
        echo '#!/bin/sh
(
        echo "Trouble on `uname -n`"
        echo
        echo "\"omreport system alertlog\":"
                                                                                
        omreport system alertlog
) | mail -s "OMSA alert on `uname -n`!" suitable_address at example.com
' > $OMSA_MAIL
                                                                                
        chmod 755 $OMSA_MAIL
                                                                                
        for i in `omconfig system alertaction -? | grep ^event= | cut -d= -f2 |
cut -d" " -f1`
        do
                omconfig system alertaction event=$i broadcast=true \
                        execappath=$OMSA_MAIL
        done
--------------------------8<----------------------

That way you get the whole alert log mailed to you whatever happened, which 
is useful, since it might contain clues in the history.

Possibly I should include "omreport system esmlog" as well in there.

/August.
-- 
Björn Augustsson      Sysadmin     IT Systems & Services
Chalmers tekniska högskola     Chalmers University of Technology
         "Damn spooky analog crap." -- John Carmack.



More information about the Linux-PowerEdge mailing list