Forum Discussion

Zdenek's avatar
Zdenek
Icon for Cirrostratus rankCirrostratus
Dec 03, 2022

APM sesions count per partition

Hello,

is it possible to get list or just count of APM sessions per policy or per partition?

I found some snmp or tmsh commands, but they never return result for specific partition or specific APM policy.

If there is some way, prefferably using API rest, it would be great.

 

Thx

Zdenek

  • Hi Zdnek,

    iControl REST-API does unfortunately not have an end-point to show statistical data for a given APM policy.

    But TMSH CLI has a command to display active sessions for a given APM policy. See the syntax below:

     

    itacs@(kw-f5-dev)(cfg-sync Standalone)(Active)(/Common)(tmos)# show apm profile access
    
    --------------------------------------------------------------
    ACCESS Profile: Radius_Policy                                 
    --------------------------------------------------------------
        User Session Statistics:                                  
    --------------------------------------------------------------
        total sessions: 7                                         
        total established sessions: 0                             
        current active sessions: 1                                
        current pending sessions: 1                               
        current established sessions: 0                           
        sessions terminated due to user logged out: 3             
        sessions terminated due to admin termination: 0           
        sessions terminated due to timeout in evaluation state: 3 
        sessions terminated due to timeout in established state: 0
        sessions terminated due to errors: 0                      
        sessions that resulted in an allow ending: 0              
        sessions resulted into deny ending: 0                     
        sessions resulted into redirect ending: 0                 
        sessions resulted into redirect ending with session: 0    
        requests allowed by ACL: 0                                
        requests denied by ACL: 0                                 
    --------------------------------------------------------------
        Apply Access Policy: Not-Required                         
    --------------------------------------------------------------
    
    --------------------------------------------------------------
    ACCESS Profile: access                                        
    --------------------------------------------------------------
        User Session Statistics:                                  
    --------------------------------------------------------------
        total sessions: 0                                         
        total established sessions: 0                             
        current active sessions: 0                                
        current pending sessions: 0                               
        current established sessions: 0                           
        sessions terminated due to user logged out: 0             
        sessions terminated due to admin termination: 0           
        sessions terminated due to timeout in evaluation state: 0 
        sessions terminated due to timeout in established state: 0
        sessions terminated due to errors: 0                      
        sessions that resulted in an allow ending: 0              
        sessions resulted into deny ending: 0                     
        sessions resulted into redirect ending: 0                 
        sessions resulted into redirect ending with session: 0    
        requests allowed by ACL: 0                                
        requests denied by ACL: 0                                 
    --------------------------------------------------------------
        Apply Access Policy: Not-Required                         
    --------------------------------------------------------------

     

     

    If REST is your prefered method to query such data, then you could access those information via:

     

    curl -sku 'admin:admin' -X POST -H "Content-type: application/json" -d "{\"command\":\"run\", \"utilCmdArgs\": \"-c 'tmsh show apm profile access'\"}" https://YOURBIGIP/mgmt/tm/util/bash

     

    You may also write a custom TMSH script to enumerate your partitions, enumerate the included APM Policies, query statistical information and finally output the enumerated infomation in a more compact format (e.g. CSV, JSON, XML, whatever...). The TMSH script may then be called via TMSH CLI or via REST API...

    Cheers, Kai

  • Hi Zdnek,

    iControl REST-API does unfortunately not have an end-point to show statistical data for a given APM policy.

    But TMSH CLI has a command to display active sessions for a given APM policy. See the syntax below:

     

    itacs@(kw-f5-dev)(cfg-sync Standalone)(Active)(/Common)(tmos)# show apm profile access
    
    --------------------------------------------------------------
    ACCESS Profile: Radius_Policy                                 
    --------------------------------------------------------------
        User Session Statistics:                                  
    --------------------------------------------------------------
        total sessions: 7                                         
        total established sessions: 0                             
        current active sessions: 1                                
        current pending sessions: 1                               
        current established sessions: 0                           
        sessions terminated due to user logged out: 3             
        sessions terminated due to admin termination: 0           
        sessions terminated due to timeout in evaluation state: 3 
        sessions terminated due to timeout in established state: 0
        sessions terminated due to errors: 0                      
        sessions that resulted in an allow ending: 0              
        sessions resulted into deny ending: 0                     
        sessions resulted into redirect ending: 0                 
        sessions resulted into redirect ending with session: 0    
        requests allowed by ACL: 0                                
        requests denied by ACL: 0                                 
    --------------------------------------------------------------
        Apply Access Policy: Not-Required                         
    --------------------------------------------------------------
    
    --------------------------------------------------------------
    ACCESS Profile: access                                        
    --------------------------------------------------------------
        User Session Statistics:                                  
    --------------------------------------------------------------
        total sessions: 0                                         
        total established sessions: 0                             
        current active sessions: 0                                
        current pending sessions: 0                               
        current established sessions: 0                           
        sessions terminated due to user logged out: 0             
        sessions terminated due to admin termination: 0           
        sessions terminated due to timeout in evaluation state: 0 
        sessions terminated due to timeout in established state: 0
        sessions terminated due to errors: 0                      
        sessions that resulted in an allow ending: 0              
        sessions resulted into deny ending: 0                     
        sessions resulted into redirect ending: 0                 
        sessions resulted into redirect ending with session: 0    
        requests allowed by ACL: 0                                
        requests denied by ACL: 0                                 
    --------------------------------------------------------------
        Apply Access Policy: Not-Required                         
    --------------------------------------------------------------

     

     

    If REST is your prefered method to query such data, then you could access those information via:

     

    curl -sku 'admin:admin' -X POST -H "Content-type: application/json" -d "{\"command\":\"run\", \"utilCmdArgs\": \"-c 'tmsh show apm profile access'\"}" https://YOURBIGIP/mgmt/tm/util/bash

     

    You may also write a custom TMSH script to enumerate your partitions, enumerate the included APM Policies, query statistical information and finally output the enumerated infomation in a more compact format (e.g. CSV, JSON, XML, whatever...). The TMSH script may then be called via TMSH CLI or via REST API...

    Cheers, Kai

    • Leslie_Hubertus's avatar
      Leslie_Hubertus
      Ret. Employee

      Looks like this was the help needed, so I've marked it as an Accepted Solution for future users to more easily find. Thanks, Kai_Wilke!