Forum Discussion
enabling/disabling maintenance page IRULE remotely from browser or Script without having to login to the LTM
Usage: Create a Matchclass (Address) under iRules -> Data Group List
Apply to whatever VIP you want to test it on. Edit Values in the iRule:
Current Rule Settings - Action START TIME
set time_start [ clock scan {16:58} ]
Current Rule Settings - Action STOP TIME
set time_stop [ clock scan {17:00} ]
Set Target Day (uses short - Mon, Tue, Wed, Thu, Fri, Sat, or Sun)
set target_day Mon
- URL accessing the VIP during the Maintenance Window will get the HTTP Message (you can change this to a pool of servers that serve up the content if you like).
- Override of the Maintenance Page (Allows the developers to test during the window) is performed by adding the testers IP Addresses to the Matchclass (MaintenancePageOverride in this example)
- Verify the testers IP Address by using the VIP URL and appending "/maintenanceaccess" or (http://website.com/maintenanceaccess) ...it will provide the IP Addess you used to hit that page for addition to the Matchclass
- Verify the Maintenance Window by using the VIP URL and appending "/maintenancestatus" or (http://website.com/maintenancestatus)
If anyone can see any ways to improve this, please share...
when CLIENT_ACCEPTED {
Retrieve Values from the System
set current_time [ clock seconds ]
set current_day [ clock format [clock seconds] -format {%a} ]
Current Rule Settings - Action START TIME
set time_start [ clock scan {16:58} ]
Current Rule Settings - Action STOP TIME
set time_stop [ clock scan {17:00} ]
Set Target Day (uses short - Mon, Tue, Wed, Thu, Fri, Sat, or Sun)
set target_day Mon
Conversions for Human Readable Time for Maintenance Status Page
set readable_start [clock format $time_start -format "%H:%M"]
set readable_stop [clock format $time_stop -format "%H:%M"]
if { ($current_day == $target_day) and ($current_time > $time_start) and ($current_time < $time_stop) and !([matchclass [IP::remote_addr] equals $::MaintenancePageOverride ]) } {
If it's not on the exclusion list. Tag it here.
set rewrite_response 1
} else {
If it is to be excluded, set value here.
set rewrite_response 0
}
}
when HTTP_REQUEST {
if { [HTTP::uri] contains "maintenanceaccess" } {
set rewrite_response 3
}
elseif { [HTTP::uri] contains "maintenancestatus" } {
set rewrite_response 4
}
}
when HTTP_RESPONSE {
if { $rewrite_response equals "1" } {
HTTP::respond 200 content "Site Unavailable
System Maintenance NOTICE: This website down for system maintenance.
"
}
elseif { $rewrite_response equals "3" } {
HTTP::respond 200 content "Maintenance Access
Maintenance Access Assistance Your IP Address is: [IP::client_addr] Please provide the IP Address listed above to the Support Team Representative assisting you with your maintenance window. This will allow the Representative to grant you override access to the maintenance page. Thank you.
"
}
elseif { $rewrite_response equals "4" } {
HTTP::respond 200 content "Maintenance Status
Maintenance Access Status Website Maintenance is currently configured for your website. Day of the Week Maintenance is Schedule for: $target_day Scheduled Maintenance Start Time: $readable_start CST Scheduled Maintenance End Time: $readable_stop CST Current Time: [clock format [clock seconds] -format {%H:%M:%S}] CST If you have any questions please contact the Support Team Representative assisting you with your maintenance window. Thank you.
"
}
}
Recent Discussions
* 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