Forum Discussion
name_65682
Aug 30, 2011Nimbostratus
Maintenance iRule with time period
Hi,
I'm trying to write iRule which will allow some ip's (f.e. 10.10.10.101) to get to my pools, for any other ip's it should redirect to maintenance page. But I wont it to work only during time ...
name_65682
Sep 01, 2011Nimbostratus
Hi again,
This rule works ok
when HTTP_REQUEST {
"clock seconds" will return the time in seconds
"clock format" will format the previous value with it's date/time components
split will chop the returned string into a list of elements.
Change the following to determine pool used and schedule
set PoolID "test_pool";
set StartTime "1030";
set StopTime "1430";
set StartDay "Thursday";
set StopDay "Thursday";
set l [split [clock format [clock seconds] -format {%A %H %M} ] " " ]
Next add the time check logic:
This example will process the log statement on Wednesday between 10:30 PM and 11:30 PM.
if {[lindex $l 0] eq "$StartDay" } {
set comptime [expr [lindex $l 1] * 100]
set comptime [expr $comptime + [lindex $l 2]]
if {($comptime >= $StartTime) && ($comptime <= $StopTime)} {
Put in iRule logic here
if { [IP::addr [IP::client_addr] equals XX.XX.XXXXX] } { pool $PoolID }
elseif { [IP::addr [IP::client_addr] equals XX.XXX.XXX.XXX] } { pool $PoolID }
else {reject}
}
}
}
but i need rule which will works with tcp(ssh virtual server), what should i change to use with CLIENT_ACCEPTED event(or any else event, I need it's functionality)?
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects