Knowledge sharing: Ways to trigger and schedule scripts on the F5 BIG-IP devices.

Problem this snippet solves:

Available script and rest-api options for f5 automatic configurations.

How to use this snippet:

Code :

I think that it is interesting to share how on F5 different scripts can be run at different times and states.



1.You can use the cron job like on any linux device to run a script. As I have used this to restart the tomcat and httpd each night with "bigstart restart " or "tmsh restart /sys service " (, because of a bug till I upgade the devices ( ).






2.Newer versions of F5 also have anacron tool that can add some randomness to the timframe when a script is run and many F5 default scripts use this and not the crontab:




3.You can even trigger scripts on the F5 device if the state changes from active to standby or from standby to active by adding the scripts under /config/failover/. For example if you have a bug for a critical process that causes a failover ( you can use the command show /sys ha-status all-properties to check for this ) but the device does not reboot or fix the process you can run a script to when the device becomes standby to restart the process.






4.You afcource can run scripts at the F5 start time (startup/bootup):






5.The final thing thing I can think of is to run a script at the backround that monitors the log and for example when there is a specific message in /var/log/ltm to trigger a tcpdump (in some cases better than creating a rotating tcpdum to catch an issue as per ). The script can be a bash script with "tail -f" command that is run on the backround or better use the F5 intergrated "icall" feature.












5.You can use utility "logger -p" to generate manually log messages in the F5 device's log for testing of your scripts as this is used also for SNMP custom alarm traps tests (for more about SNMP )




6.You can also trigger scripts from an BIG-IQ device bt you still can't schedule them when to run:





7.Of course the final option is to use ansible or python SDK that uses the F5 rest-api to execute commands on the F5 devices.







8. You can even use TCP expect and bash for automations using SSH connection but this is really old way to do things:







9.F5 is well integrated with Ansible and it is better than REST-API Python SDK or TCL for me as even the declarative AS3 interface is supported:











10.For some automations without rest-api better use the F5 native cli scripts than bash with tmsh commands:

Tested this on version:

No Version Found
Published Jun 30, 2021
Version 1.0

Was this article helpful?

No CommentsBe the first to comment