Forum Discussion

Fallout1984's avatar
Fallout1984
Icon for Cirrocumulus rankCirrocumulus
Nov 18, 2021

Getting started with a script to delete user APM session(s)

I have a request to create a script to delete the APM session(s) of a user ID. I can easily do this via the GUI and have found the commands to do it manually, however scripting is totally new to me (though I've programmed in the past). So, I have a few questions to help get an idea of how to approach this:

 

Questions:

 

  1. Is there anything that needs to be imported/enabled on the F5 in order to allow scripting?
  2. Would Pythion be the best choice for the script?
  3. From where would such a script typically be run (specific server, desktop, etc)? 

 

My initial plan would be to base the script off of the sequence below:

 

1.) List the sessions IDs associated with a user ID:

sessiondump -allkeys | grep -i <username>

 

2.) (pull the session IDs, if any)

 

3.) Delete the session ID(s):

sessiondump --delete <SessionID>

 

Any advice to get started tackling this would be appreciated. We have a vender who I can probably reach out to for assistance, but I want to do some initial research first.

 

Thanks!

 

 

 

 

 

  • going to take a stab at this although im not a very active scripter myself.

     

    1 - no in general everything works without additions on newer versions

     

    2 - that is really not possible to just answer with a yes or no in my opinion. there are many languages with different benefits and downsides. python is popular currently and you will probably find lots of help on that. so if you start form scratch, sure use it. if you have experience with another script language use that. if you can get help in another language use that. what you are looking to do isn't extremely complex, i believe in most script languages you can do it, it depends on what works best for you. don't worry to much about the best at this stage.

     

    3 - again, no answer which will be the truth for everyone. it depends what suits you best. if you are the only one having to run it, local desktop is fine. if multiple people will have to then on a server. but you can also just run it on the bigip itself if that suits the situation.

  • Got it. Thanks for taking the time to reply - that does help clear things up some. 😀

  • going to take a stab at this although im not a very active scripter myself.

     

    1 - no in general everything works without additions on newer versions

     

    2 - that is really not possible to just answer with a yes or no in my opinion. there are many languages with different benefits and downsides. python is popular currently and you will probably find lots of help on that. so if you start form scratch, sure use it. if you have experience with another script language use that. if you can get help in another language use that. what you are looking to do isn't extremely complex, i believe in most script languages you can do it, it depends on what works best for you. don't worry to much about the best at this stage.

     

    3 - again, no answer which will be the truth for everyone. it depends what suits you best. if you are the only one having to run it, local desktop is fine. if multiple people will have to then on a server. but you can also just run it on the bigip itself if that suits the situation.