Forum Discussion

AlgebraicMirror's avatar
AlgebraicMirror
Icon for Altostratus rankAltostratus
Oct 12, 2016

Is there any way in an iRule to tell if APM is enabled or disabled on a connection?

Hi guys. Does anyone know if there is a way to tell if APM is enabled or disabled on a given connection? For example, I can turn APM on or off in an iRule using these commands:

 

ACCESS::disable
ACCESS::enable

 

But, if a request comes through later (say I'm using "when HTTP_REQUEST"), and I want to tell if I currently have APM turned off or on, is there any existing command that will give me the answer?

3 Replies

  • Do you want the connection to be logged, that gives you the output of Enabled or Disabled for troubleshooting purposes?

     

  • If you are using ACCESS::disable then the easiest way would be to set a user defined tcl variable to indicate the state. I have found no combination of built-in commands that is completely error proof or that require complicated parameter passing.

     

    ACCESS::disable
    set access_disabled 1
    
    if {$access_disabled} {
         Do Stuff outside of APM
    }
    

     

    You might be able to get ACCESS::session sid working but this also requires that you code an if check to do a sting comparison which I guess would be more CPU expensive than doing an integer check with your own variable.

  • Hi,

    if you want to do some stuff when APM is enabled, you can do it on ACCESS_ACL_ALLOWED event.

    this event raise every time the request is associated with APM session and not dropped by ACL (if no ACL is defined or explicit ACL allow the request)

    you can also use this irule :

     

    when HTTP_REQUEST {
        set apm_enabled 0
    }
    
    when ACCESS_ACL_ALLOWED {
        set apm_enabled 1
    }
    
    when HTTP_REQUEST_SEND {
        log "APM Status is $apm_enabled"
    }