nodes_up

Description

The nodes_up command returns the number of up nodes behind a virtual server. LTM virtual servers can have a pool with multiple nodes. If there is not a monitor on the LTM side, the server is blue. However, the GTM interprets this blue virtual server as green, and the nodes_up value is 1.

Syntax

nodes_up [<virtual server name> | <ip_address port>]

nodes_up <virtual server name>

  • Returns the number of up nodes behind the specified (LTM) virtual server name.

nodes_up <ip_address port>

  • Returns the number of up nodes behind the specified (LTM) virtual server IP+port (note that there is a space between the address and port, not the usual colon)

Examples

Assume that you have a WideIP configured with one pool, and a separate fallback pool. The primary pool is called

pool-www-example-com-primary

and the fallback pool is called

pool-www-example-com-backup

. Each pool has a single LTM virtual server as a member. For

pool-www-example-com-primary

, the member is the LTM virtual server vs-www-example-com-01 and it is configured (on the LTM) as 10.10.10.10:80. For

pool-www-example-com-secondary
, the member is the LTM virtual server vs-www-example-com-02 and it is configured (on the LTM) as 192.168.1.1:80. The LTM VS vs-www-example-com-01 has a pool with 8 members. In this setup, normally, a query for the WideIP should always return 10.10.10.10 unless the LTM VS vs-www-example-com-01 goes down. However, let us say that, if the number of members in that pool drops below 4, then then you wish to have the GTM switch to using the backup VS, thus giving out 192.168.1.1 for the WideIP. The following iRule, applied to the WideIP, accomplishes this:
when DNS_REQUEST {
  if { [nodes_up 10.10.10.10 80] < 4 } {
    pool pool-example-com-backup
  }
}