Forum Discussion

wtl1_136682's avatar
wtl1_136682
Icon for Nimbostratus rankNimbostratus
Mar 14, 2018

custom clock format variable in message box

I would like to display the av db time variable in a message box in human readable format. I was trying to create a custom variable that would format it to human readable but it doesn't seem to work. I have found other examples but it looks like those used irules to set custom variables using the clock format command. Can irule custom variables be displayed in message box output? Or is there a way to format it using variable assign?

 

variable assign example: epoch.db.time = [clock format [mcget {session.check_software.last.av.item_1.db_time}]]

 

irule event example:

 

when ACCESS_POLICY_AGENT_EVENT { if { [ACCESS::policy agent_id] eq "Epoch_to_Standard" } {

 

log local0. "Entered Epoch_translation"

 

set epoch.time [ACCESS::session data get session.check_software.last.av.item_1.db_time]

 

log local0. "epoch time $epoch.time"

 

set clockFormat "[clock format $epoch.time]"

 

log local0. "formatted $clockFormat"

 

} }

 

^^ can I put the $clockFormat variable in a message box after the irule event?

 

  • You can use following variable assign :

     

    session.av_time_human_readable = clock format [mcget {session.check_software.last.av.item_1.db_time}]
    

     

    or

     

    session.av_time_human_readable = return [clock format [mcget {session.check_software.last.av.item_1.db_time}]]
    

     

    but not with brackets starting line.

    then in the message box, use following text:

    Last AV DB time is %{session.av_time_human_readable}

    to answer to the other question, APM can't read irule variables, only session variables. so after executing the irule code, use ACCESS::session data set command to store irule variable to session variable.