For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

ADA506's avatar
ADA506
Icon for Nimbostratus rankNimbostratus
Jan 27, 2021

Schedule Maintence Page

Hello,

Hopefully someone is able to help me.. We have a Big-IP hosted in AWS and running 15.1.0.4. We have a maintence page that needs to display when the pool members are down (which i have working) but also on Tuesdays 0200-1400. I have tried several different pages but am still struggling to get this working. Any help would be greatly appreciated.

3 Replies

  • Hi,

    You could use this:

    when RULE_INIT {
        array set static::timerange {
            Sunday {}
            Monday {}
            Tuesday {"02:00" "14:00"}
            Wednesday {}
            Thursday {}
            Friday {}
            Saturday {}
        }
    }
     
    when HTTP_REQUEST {
        if { ([string tolower [HTTP::uri]] contains "/contractor/") } {    
            set now [clock seconds]
            set current_day [clock format $now -format {%A}]
            set start [lindex $static::timerange($current_day) 0]
            set end [lindex $static::timerange($current_day) 1]
            if {($start ne "") && ($end ne "") && ($now >= [clock scan $start]) && ($now < [clock scan $end])} {
                set denied 0
            } else {set denied 1}
            unset start end
        } else {set denied 0}
     
        if { $denied } {
            HTTP::respond 200 content "Not Authorised! Contact AdministratorNot Authorised! Contact Administrator..."
        } else {pool POOL_443}
        unset denied
    }

    Cheers,

    Kees

    • ADA506's avatar
      ADA506
      Icon for Nimbostratus rankNimbostratus

      Would i have to have this as a seperate irule than the one i have for when pool members are down? Sorry i am not the best with iRules.

      • No, it can be the same irule.

        when RULE_INIT {
            array set static::timerange {
                Sunday {}
                Monday {}
                Tuesday {"02:00" "14:00"}
                Wednesday {}
                Thursday {}
                Friday {}
                Saturday {}
            }
        }
         
        when HTTP_REQUEST {
            if { ([string tolower [HTTP::uri]] contains "/contractor/") } {    
                set now [clock seconds]
                set current_day [clock format $now -format {%A}]
                set start [lindex $static::timerange($current_day) 0]
                set end [lindex $static::timerange($current_day) 1]
                if {($start ne "") && ($end ne "") && ($now >= [clock scan $start]) && ($now < [clock scan $end])} {
                    set denied 0
                } else {set denied 1}
                unset start end
            } else {set denied 0}
         
            if { $denied } {
                HTTP::respond 200 content "Not Authorised! Contact AdministratorNot Authorised! Contact Administrator..."
            } elseif { [active_members [LB::server pool]] == 0 } {
                HTTP::respond 200 content "<content>"
                unset denied
              } else {pool POOL_443}
               unset denied
        }

        Cheers,

        Kees