Forum Discussion

Christopher_Ach's avatar
Christopher_Ach
Icon for Nimbostratus rankNimbostratus
Feb 16, 2012

Send an SNMP Trap within an IRULE

Hi

 

 

I have a simple Irule that looks like this

 

 

 

when CLIENT_ACCEPTED {

 

if { ([class match [IP::client_addr] equals DO_Specific_IPs]) && ([active_members DO-Pool] > 10 && [active_members DNS-Pool] > 0) } {

 

pool DO-Pool

 

persist source_addr 1800

 

}

 

} else {

 

 

pool X_Default_GW_INT

 

 

if { [active_members DNS-Pool] < 1 } { log local0. "DNS Pool Members Down - Bypassing DO Pool"}

 

if { [active_members DO-Pool] < 1 } { log local0. "DO Pool Members Down - Bypassing"}

 

}

 

 

 

 

So in the case that the DO-Pool is up but the DNS-Pool is down the IRULE will send traffic to the Pool pool X_Default_GW_INT.

 

 

 

This is great! and also a Trap will have been sent to the OSS team automatically by F5 to say the DNS Pool is down, which is also Great!

 

 

 

But I need a new Trap to be sent to the OSS platform that provides Support them with further info about what it really means when the IRULE switches sending traffic to the X_Default_GW Pool

 

 

 

So I want to do something like

 

 

 

when CLIENT_ACCEPTED {

 

if { ([class match [IP::client_addr] equals DO_Specific_IPs]) && ([active_members DO-Pool] > 10 && [active_members DNS-Pool] > 0) } {

 

pool DO-Pool

 

persist source_addr $static::persist_timeout

 

}

 

 

} else {

 

pool X_Default_GW_INT

 

 

 

if { [active_members DNS-Pool] < 1 } {

 

log local0. "DNS Pool Members Down - Bypassing DO Pool"

 

TRAP (LIVE TRAFFIC IN BYPASS DUE TO DNS POOL OFFLINE - NOTIFY Little Johnny!)

 

}

 

 

if { [active_members DO-Pool] < 1 } {

 

log local0. "DO Pool Members Down - Bypassing"

 

TRAP (LIVE TRAFFIC IN BYPASS DUE TO DNS POOL OFFLINE - NOTIFY Big Jonny!)}

 

}

 

 

 

 

Any ideas?

 

Is this possible?

 

 

 

Thanks

 

 

 

Chris

 

2 Replies

  • yes, it is possible. what we have to do is to write message to log file (log command in irule), configure alertd to monitor the message and send out trap.

     

     

    Custom SNMP Traps by Deb

     

    http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/256/Custom-SNMP-Traps.aspx

     

     

    hope this helps.