Forum Discussion

SK_121993's avatar
SK_121993
Icon for Nimbostratus rankNimbostratus
Oct 17, 2013

Geolocation iRule email alerts

Hi - I have an iRule in place (see below) and would like to enable alerts that will send emails every time it is triggered. Is this possible and what is the best way to set up (i.e. within the same iRule)? Thanks in advance!

when CLIENT_ACCEPTED {

set default_pool [LB::server pool] switch [whereis [IP::client_addr] country] {

CN { 
   log local0. "Geo Client ([IP::client_addr]) detected as China"
   reject }

DE {
    log local0. "Geo Client ([IP::client_addr]) detected as Germany" 
    reject }    

AU { log local0. "Geo Client ([IP::client_addr]) detected as Australia" 
     pool $default_pool  }

GB { log local0. "Geo Client ([IP::client_addr]) detected as UK" 
     pool $default_pool  }


default { 
      log local0. "Geo Client ([IP::client_addr]) not detected" 

      pool $default_pool   }

}

}

2 Replies

  • There is a way to do this without extending your iRule, namely generating custom events that lead to email being sent.

     

    Here's the solution explaining how to setup custom events: http://support.f5.com/kb/en-us/solutions/public/3000/600/sol3667.html

     

    Here's the solution explaining how to setup local email resources: http://support.f5.com/kb/en-us/solutions/public/13000/100/sol13180.html

     

    If you are determined to use the iRule, then I suggest looking into sideband connections and how to format SMTP messages.

     

  • Thanks for the response. I'll try setting up custom events in the first instance and see how it goes.