For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Brian_10532's avatar
Brian_10532
Icon for Altocumulus rankAltocumulus
Jul 03, 2014

Formatting email alerts

I have been reading through several other posts about people trying to add a subject line to an email alert, but nobody seems to be able to figure out a way to do it on newer 11.x code using ssmtp. In addition to manipulating the subject line I would really like to figure out a way to format the email body. Right now I have the following configuration applied and it "works", but there has to be a way to dig in and format it.

 

alert BIGIP_GTMD_POOLMBR_SNMP_STATUS_CHANGE_X "Pool .*? member .*? state change .*? --> green"{
        snmptrap OID=".1.3.6.1.4.1.3375.2.4.0.52";
        email toaddress="name@domain.com"
        fromaddress="gtm@domain.com"
        body="Alert cleared => Pool member state change to up"
}
alert BIGIP_GTMD_POOLMBR_SNMP_STATUS_CHANGE_WHY_X "Pool .*? member .*? state change .*? --> red .*?" {
        snmptrap OID=".1.3.6.1.4.1.3375.2.4.0.53";
        email toaddress="name@domain.com"
        fromaddress="gtm@domain.com"
        body="New alert => Pool member state change to down"
}

For example it would be great to be able to pull pieces and assign variables to them like $poolmember so later in the body I could say New alert => Pool member {$poolmember} state change to down. Don't get excited if you are looking for the same solution, because this doesn't work, but I sure wish it did.

 

alert BIGIP_GTMD_POOLMBR_SNMP_STATUS_CHANGE_X "Pool .*? member .*? state change .*? --> green"{
        snmptrap OID=".1.3.6.1.4.1.3375.2.4.0.52"
preg_match('/Pool.*?\s/',$this->trap,$poolmember);
        email toaddress="name@domain.com"
        fromaddress="gtm@domain.com"
subject="Alert cleared => {$poolmember[0]} is back up"
        body="Pool member {$poolmember[0]} has returned to an up status"
}
alert BIGIP_GTMD_POOLMBR_SNMP_STATUS_CHANGE_WHY_X "Pool .*? member .*? state change .*? --> red .*?" {
        snmptrap OID=".1.3.6.1.4.1.3375.2.4.0.53"
preg_match('/Pool.*?\s/',$this->trap,$poolmember);
        email toaddress="name@domain.com"
        fromaddress="gtm@domain.com"
subject="New alert => {$poolmember[0]} is down"
        body="Pool member {$poolmember[0]} has gone down"
}

1 Reply

  • For example it would be great to be able to pull pieces and assign variables to them like $poolmember so later in the body I could say New alert => Pool member {$poolmember} state change to down.

     

    i do not think user_alert.conf is capable (as of now).