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

Filter by:
  • Solution
  • Technology
Answers

automate session delete

i have a task to delete specific sesssions every night. is there anyway i can automate this. i looked in the powershell module but there were no delete modules.

i am looking to run the following command every night..

-> delete sys connection cs-server-addr 1.1.1.1 cs-client-addr 1.1.1.100

any ideas??

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

please refer to SOL https://support.f5.com/kb/en-us/solutions/public/11000/600/sol11635.html?sr=51181919

it contain an example to run tmsh command correctly by crontab

from usage of crontab: refer to https://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-autotasks.html

Hope it help.

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

The powershell module has some built-ins, but it has access to the API via the Get-F5.iControl object. You should be able to use a combination of get_all_active_connections_v2 and delete_active_connection to achieve your result.

Here's a quick sample on getting the connection list:

(Get-F5.iControl).SystemConnections.get_all_active_connections()
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

How to write in Powershell? is it like below

$Clientside_ClientipPortDef = new-object -typename iControl.CommonIPPortDefinition
$Clientside_ClientipPortDef.address = "10.118.219.205";
$Clientside_ClientipPortDef.port = 4500;

$Serverside_ServeripPortDef = new-object -typename iControl.CommonIPPortDefinition
$Serverside_ServeripPortDef.address = "10.118.219.198";
$Serverside_ServeripPortDef.port = 4500;

$Clientside_ServeripPortDef = new-object -typename iControl.CommonIPPortDefinition
$Clientside_ServeripPortDef.address = "10.118.219.220";
$Clientside_ServeripPortDef.port = 4500;


(Get-F5.iControl).SystemConnections.delete_active_connection($Clientside_ClientipPortDef,$Clientside_ServeripPortDef,$Serverside_ServeripPortDef)
0