Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral


Questions and Answers

Loading... Loading...

Here is one of tmsh script to provide APM automation 

Start ==================

 

proc script::init {} {
}
 
proc script::run {} {
    set userid [lindex $tmsh::argv 1]
    set hostname [lindex $tmsh::argv 2]
    set hostip [lindex $tmsh::argv 3]
 
    set rules [tmsh::list apm policy agent resource-assign cloud_ap_act_full_resource_assign_ag rules ]
    regsub -all "remote-desktop-resources \{" $rules "remote-desktop-resources add \{" rules
 
    set rules_index6 [lindex [lindex $rules 5] 1]
    
    set added "\{ expression 'expr \{ \[mcget \{session.logon.last.logonname\}\] == \"$userid\" \}' remote-desktop-resources add \{ /Common/$hostname \} \}"
 
    set final "rules { [append added $rules_index6] }"
 
    tmsh::create apm resource remote-desktop rdp $hostname ip $hostip port 3389 java-client enabled 
    tmsh::modify apm policy agent resource-assign cloud_ap_act_full_resource_assign_ag $final 
    tmsh::modify apm profile access cloud_ap generation-action increment
    tmsh::save sys config 
}
 
proc script::help {} {
}
 
End ====================
 
The script will receive three parameter, user name, host name and host ip, and it will then create a remote desktop (windows) resource for the specific user. The virtual server and access profile need to be configured first, since the script only modify the VPE. My recommendation is do not use tmsh to config access profile, I faced quite a lot challenge on that and end up decided to use tmsh scrpt to config VPE part only. This is quite simplified script and there is a lot of room to further enhance it to provide more APM automation functions.
 
TMSH script is powerful and have a fun with TMSH script. 
 
Best regards,
CJ
 
 

Be the first one to answer this question!

You must be logged in to reply. You can login here.