Forum Discussion

Thales_92506's avatar
Thales_92506
Icon for Nimbostratus rankNimbostratus
Sep 21, 2011

How do i send emails when a monitor marks a pool down?

How is this possible?

 

 

Can I do this with EAV? Is it possible with logs?

 

 

 

Thanks

 

5 Replies

  • Hi Thales,

     

     

    You can start here:

     

     

    sol3667: Configuring alerts to send email notifications

     

    http://support.f5.com/kb/en-us/solutions/public/3000/600/sol3667.html

     

     

    Aaron
  • Aaron, i´ve read this article.

     

     

    My question is: how to link an EAV monitor to send emails when the pool member is marked down?

     

     

    Thanks
  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus
    If you're using an external monitor (i.e. a script), then you can just use the mail command to send an email. Or you can make it more generic and use the alert system to send emails based on the messages logged in the logfiles (As Aaron said above).

     

     

    H
  • Hamish, in the following code, if i put an else statement containing

     

    email toaddress=""

     

    fromaddress=""

     

    body=""

     

    would it work?

     

     

    code:

     

    remove IPv6/IPv4 compatibility prefix (LTM passes addresses in IPv6 format)

     

    IP=`echo ${1} | sed 's/:

     

    PORT=${2}

     

     

    PIDFILE="/var/run/`basename ${0}`.${IP}_${PORT}.pid"

     

    kill of the last instance of this monitor if hung and log current pid

     

    if [ -f $PIDFILE ]

     

    then

     

    echo "EAV exceeded runtime needed to kill ${IP}:${PORT}" | logger -p local0.error

     

    kill -9 `cat $PIDFILE` > /dev/null 2>&1

     

    fi

     

    echo "$$" > $PIDFILE

     

     

    send request & check for expected response

     

    curl -fNs http://${IP}:${PORT}${URI} | grep -i "${RECV}" 2>&1 > /dev/null

     

     

    mark node UP if expected response was received

     

    if [ $? -eq 0 ]

     

    then

     

    echo "UP"

     

    fi

     

    else [

     

    email toaddress=""

     

    fromaddress=""

     

    body=""

     

    ]

     

    fi

     

     

    rm -f $PIDFILE

     

    exit