# Irule to change VS status

**URL:** <https://community.f5.com/t/irule-to-change-vs-status/3761>\
**Category:** Technical Forums\
**Tags:** irules, ltm, application-delivery\
**Created:** [November 12, 2016, 12:19am UTC](https://community.f5.com/t/irule-to-change-vs-status/3761 "2016-11-12T00:19:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Naumin\_Dave\_144](https://avatars.discourse-cdn.com/v4/letter/n/7c8e57/32.png) [@Naumin\_Dave\_144](https://community.f5.com/u/Naumin_Dave_144)\
**Post date:** [November 12, 2016, 12:19am UTC](https://community.f5.com/t/irule-to-change-vs-status/3761/1 "2016-11-12T00:19:26Z")

</div>

Hi All,

we need your help to achieve one requirement. Not sure we can achieve this with Irule or not. we have following Irule on our production VS.

```tcl
when HTTP_REQUEST {
    switch -glob [string tolower [HTTP::path]] {
        "/axis/*" {
         SSL::disable serverside
            pool pool1
        }
        default {
            pool default_pool
        }
    }
}

```

application team requirement is **when default\_pool goes down, VS status should be down.(even though pool1 is UP).** can we achieve this with some modification in irule or with different options.

---

<div class="post-metadata">

**Author:** ![Niels\_van\_Sluis](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/niels_van_sluis/32/3759_2.png) [@Niels\_van\_Sluis](https://community.f5.com/u/Niels_van_Sluis)\
**Post date:** [November 12, 2016, 1:16pm UTC](https://community.f5.com/t/irule-to-change-vs-status/3761/2 "2016-11-12T13:16:37Z")

</div>

I don’t think you need to modify the iRule at all. Just add your default\_pool to your virtual server profile as the default pool. That will be the only pool that is monitored from the virtual server perspective. If that pool is unavailable, the virtual server will also be unavailable.

---

<div class="post-metadata">

**Author:** ![Vijay\_E](https://avatars.discourse-cdn.com/v4/letter/v/4bbf92/32.png) [@Vijay\_E](https://community.f5.com/u/Vijay_E)\
**Post date:** [November 14, 2016, 1:09am UTC](https://community.f5.com/t/irule-to-change-vs-status/3761/3 "2016-11-14T01:09:52Z")

</div>

If your goal is to prevent load balancing from happening if the default pool is down, can’t you use a simple iRule that serves a maintenance page or sorry page whenever the default pool is down instead of marking the entire VS as down ?

---

<div class="post-metadata">

**Author:** ![Niels\_van\_Sluis](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/niels_van_sluis/32/3759_2.png) [@Niels\_van\_Sluis](https://community.f5.com/u/Niels_van_Sluis)\
**Post date:** [November 14, 2016, 7:36am UTC](https://community.f5.com/t/irule-to-change-vs-status/3761/4 "2016-11-14T07:36:53Z")

</div>

This irule will reject connections if no pool members in the default pool are down, but like Odaah mentioned maybe you could do a redirect to a maintenance page instead of a reject.

```tcl
when HTTP_REQUEST {

     reject connection if all servers are down in the default pool
    if { [active_members [LB::server pool]] < 1 } {
        reject
    }

    switch -glob [string tolower [HTTP::path]] {
        "/axis/*" {
         SSL::disable serverside
            pool pool1
        }
        default {
            pool default_pool
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![Naumin\_Dave\_144](https://avatars.discourse-cdn.com/v4/letter/n/7c8e57/32.png) [@Naumin\_Dave\_144](https://community.f5.com/u/Naumin_Dave_144)\
**Post date:** [November 15, 2016, 4:52am UTC](https://community.f5.com/t/irule-to-change-vs-status/3761/5 "2016-11-15T04:52:00Z")

</div>

Hi All,

First of all thank you very much for your reply on this conversation. DevCentral always helps us to learn new things faced by all F5 champs across world. I would like to explain bit more on requirement part.

Since we have GTM(DC/DR) setup for this VS, if default\_pool is down then it should mark VS down so that GTM will forward the traffic to the alternate VS. so by applying maintenance page here will not resolve the purpose of the requirement.

---

<div class="post-metadata">

**Author:** ![Hicham](https://avatars.discourse-cdn.com/v4/letter/h/e19b73/32.png) [@Hicham](https://community.f5.com/u/Hicham)\
**Post date:** [April 26, 2020, 1:18am UTC](https://community.f5.com/t/irule-to-change-vs-status/3761/6 "2020-04-26T01:18:32Z")

</div>

Hello Naumin Dave,

we’re facing your exact situation. How did you manage to get around this issue.

Thank for sharing.
