Forum Discussion
GTM DNS Time based iRule assistance needed
I am looking to create a GTM iRule where we can route away from Data Center 1 from 1AM - 2AM (maintenance) and from Data Center 2 from 2AM - 3AM (maintenance). I have created a wide IP and included some test pools using LTM VIPs in both centers. I have been following a few of the time based iRule discussion threads, but most of them were in reference to LTM "HTTP_REQUEST" which won't work on GTM as far as I know.
I am unsure which time variables I can set within the "when DNS_REQUEST" and which I may need to set outside the DNS_REQUEST logic. I am fairly new to iRules, but just looking for some help. Thanks!!
4 Replies
- cjunior
Nacreous
Hi, maybe you could do something like this:
GTM rule for wide ip:
when DNS_REQUEST { set now [clock format [clock seconds] -format "%H:%M"] Maintenance on DC 1 if { $now >= "01:00" and $now < "02:00" } { VS DC 2 host 10.10.10.10 Maintenance on DC 2 } elseif { $now >= "02:00" and $now < "03:00" } { VS DC 1 host 20.20.20.20 } Otherwise, resolve from pool }
DC 1 VS:
when HTTP_REQUEST { set now [clock format [clock seconds] -format "%H:%M"] if { $now >= "01:00" and $now < "02:00" } { HTTP::respond 200 content {MaintenanceSorry!} noserver } }
DC 2 VS:
when HTTP_REQUEST { set now [clock format [clock seconds] -format "%H:%M"] if { $now >= "02:00" and $now < "03:00" } { HTTP::respond 200 content {MaintenanceSorry!} noserver } }
Regards.
- Andrew_Lagomar1
Nimbostratus
Follow up question.....this seems to be working except for the fact that the two data centers are in different time zones. Is there a way to change the time to GMT so both centers register the same time period?
- Stanislas_Piro2
Cumulonimbus
Hi,
when products are deployed in multiple timezones, I configure the same timezone for both (like GMT)
you can also try with command:
set now [clock format [clock seconds] -format "%H:%M" -timezone GMT]
- cjunior
Nacreous
I think this is the solution:
So, in this way, it will ignore time zone on each location by using GTM 0.set now [clock format [clock seconds] -format "%H:%M" -gtm 1]
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