Forum Discussion

soymanue's avatar
soymanue
Icon for Nimbostratus rankNimbostratus
Feb 19, 2016

APM Access stats per OS

Hello I'm trying to create report to show the connections made to an APM Access Profile with different Client OS. First of all, I tried to do it with an APM Report but I haven't found the way to do it. Now, I'm trying with iStats.

This iRule fails:

when ACCESS_POLICY_AGENT_EVENT {
  log local0. "Guardando logs iRule APM [ACCESS::policy agent_id]"
  switch [ACCESS::policy agent_id] {
    "LOG_OS" {
      set OS "[ACCESS::session data get session.client.platform]
      ISTATS::incr "RemoteAccess c $OS" 1
    }      
  }
}

This is the error:

Feb 19 14:42:48 rochelle-intx err tmm[11266]: 01220001:3: TCL error: /Common/LOG_APM_VERSION_OS - Error: Fact0: requested Id0 (type=HEADER) as type FACT (line 1) invoked from within "ISTATS::incr "Teleacceso c $OS" 1" ("LOG_OS" arm line 6) invoked from within "switch [ACCESS::policy agent_id] { "LOG_OS" { set OS "Prueba" log local0.notice "Guardando logs "

What am I doing wrong?

  • I haven't hadn't much interaction with iStats, but I can share what I have done. First I found that wrapping the call in a catch block helps keep errors from causing client-side issues. I was also looking at per-virtual server stats, so it would add them for the VS the iRule is assigned to.

    Here's what my code looks like (it's used to track hostnames used to access the VIP)

     

     Track the hosts that are used by this VIP
    if { [catch { ISTATS::incr "ltm.virtual [virtual name] c [HTTP::host]" 1 } emsg] } {
        log local0. "ISTATS error | Error adding stats to '[HTTP::host]' | '$emsg'"
    }
    
     To view the stats in TMSH: "tmsh show ltm virtual XYZ " (where XYZ is the virtual server name)
    

     

    You could probably modify it to use the OS name instead of host.

    Hope this helps.

  • If you go to your F5 and go Access Policy > Reports > Built In Reports, there should be an "Application and OS Distribution" report that will have stats from all of your APM logs.