Forum Discussion

LirazM's avatar
LirazM
Icon for Nimbostratus rankNimbostratus
Aug 02, 2018

Cronjob that checks every 15 min if there is no APM active session, than disable the virt.

Hello there,

 

My goal is to check every 15 minutes if there is no active APM session , if not, disable the virt.

 

i thought i will have a bash script that i can call from crontab with the timing: 0,15,30,45 * * * * /var/tmp/disablevirt

 

and check if there is an active connections with snmpwalk: snmpwalk -Os -c public -v 2c localhost apmPaStatCurrentActiveSessions | grep PROFILENAME

 

if VALUE is equal to 0, run this: tmsh modify ltm virtual virt_NAME disabled else echo "Users are still connected."

 

Thanks for the help.

 

2 Replies

  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus

    Great... But what's going to re-enable it? Because this'll be a one-shot and once it's disabled, no user will be able to connect again until something else re-enables it...

     

  • Dan_73594's avatar
    Dan_73594
    Historic F5 Account

    Looks like you got it working, just wanted to add that a periodic iCall may be a better fit if this is a long term solution because it would: 1) Be replicated to non-master blades (if using clustering with VIPRION) and 2) Sync between devices in a DSC group, persist upgrades, etc.

     

    Dan