Forum Discussion
Node Status change to trigger Script
Hope someone can help me with this. I'm currently using GTM Version 10.2.1 and I have a wideIP setup with a pool that has two members. Member 1 is set to Priority 3 and Member 2 is set to Priority 1. Whenever the status of one of these members changes, I would like a script to run. Normally with Tcl I would use either open or exec but they're both on the Disabled list. So how do I run a script that's located at /var/scripts/
So far this is what I have for my iRULE
when LB_SELECTED {
if { [LB::status] eq "up" or "down"}{
}
}
Any and all help on this would be extremely gratefully appreciated.
Thanks
Sam
6 Replies
- Joel_Moses
Nimbostratus
I don't think you want to do this with iRules. First, they are transactional and event-based, so using them as a warning trigger is difficult at best. Second, unless you want to do it via event logging or HTTP::retry, there is no real way to jump outside the iRule sandbox to execute something.
There are three ways you can get this done: iControl, on-box shell scripting, or TMSH scripting. With iControl, you would need to run a script from an external box, monitoring your selected pool on a regular basis, and taking action on any changes. The same is true of the other two methods, only they would both execute on-box.
The one I would use is probably TMSH. Here is an example of a monitor script:
http://devcentral.f5.com/wiki/default.aspx/tmsh/WatchPools.html
Hope this gets you started! - lostnytechie_55
Nimbostratus
Joel,
Thanks for the quick reply! I was kind of afraid you were going to say that. So with the TMSH script, what time interval are you using for the cron?
Thanks
Sam - Joel_Moses
Nimbostratus
Well, in the TMSH script I'm referencing, there's no Cron job -- and it does not do exactly what you're wanting, it's just an example of how to do a "watch loop" in TMSH. There's a delay in the script using a preset interval and "after" which will release the while loop every two seconds.set interval 2 set delay [expr $interval * 1000] ... after $delay
I have to admit, I'm just getting my sea legs on TMSH, so as far as starting the script on boot and creating notifications, I'm not sure where to head from here; maybe someone else with more TMSH experience can weigh in. But I do know that it this type of approach has one big advantage: it becomes part of the config file -- which a regular shell script copied up to the unit will not. - hoolio
Cirrostratus
You could potentially implement this type of logic by calling a custom script from the user_alert.conf file when a member is marked down. See this post for details:
Generic command in user_alert.conf
http://devcentral.f5.com/Default.aspx?tabid=53&view=topic&postid=55956&ptarget=56007
Aaron - lostnytechie_55
Nimbostratus
I used user_alert.conf to trigger an external script. It was the simplest and easiest solution once i figured out how it works. - Ed_Hammond_2611
Nimbostratus
See http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/44/aft/1178752/showtab/groupforums/Default.aspx
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
