Forum Discussion
Irule to Run a tmsh command
can i have an IRUle that run a tmsh command based on certain condition ?
4 Replies
- Kevin_Stewart
Employee
Absolutely, but be warned that
-
The management shell where TMSH runs doesn't have the same memory/CPU capacity as TMM, so performing a TMSH command per client request would very quickly overwhelm the box.
-
You have to be very careful that any "bridge" that you create between the data and management plains cannot be used against you, where a user can execute arbitrary commands on the system.
-
And most important, it's just generally not a best practice thing to do.
With these warning out of the way, you have a few options:
-
You can configure a Syslog-ng facility to launch a shell command (via /etc/syslog-ng/syslog-ng.conf)
-
You can create a user_alert.conf element that looks for a specific syslog message and executes a shell command or script
-
If running 11.4 you can use an iCall that's a more robust form of the user_alert.conf technique.
These are all "one-way" bridges to the management plain in that you don't expect to recieve a response. There are others ways to create a bidirectional bridge, but the above stated warnings would be much more critical.
-
- SSHSSH_97332
Nimbostratus
Thx can u give me example of irule running TMSH command , i will need to run the below for ex @ certian condition :
tmsh delete sys conn
- SSHSSH_97332
Nimbostratus
when CLIENT_ACCEPTED {
if { [active_members http_pool] >= 2 } {
i want to run the TMSH command
} }
- Kevin_Stewart
Employee
Take a look at this post for information on setting up user_alert.conf to launch a shell process;
https://devcentral.f5.com/questions/clearing-machine-cache
I would add though, that launching the process on every CLIENT_ACCEPTED event (where there are at least two pool members) will very quickly eat all of your a system resources. If you're going to do this at all, you should limit it to something that happens rarely.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com