Health Monitors

This section contains different types of health monitors you can use in your declarations. Some include multiple monitors, so you can include the monitor(s) that best suit your needs.

Use the index on the right to locate specific examples.

Important

Most of the example declarations have been updated in the documentation for BIG-IP AS3 3.20 to remove any template that was specified, and rename any virtual services that used the name serviceMain to service. In BIG-IP AS3 3.20, the generic template is the default, which allows services to use any name.

This also means that many of these declarations on a version prior to 3.20 they will fail unless you add a template. See this FAQ entry and this Troubleshooting entry for more information.

Using an LDAP monitor in a declaration

This example shows how you use an LDAP monitor in a declaration. This example shows 4 different LDAP monitors that you can use in your declarations. See the Schema Reference for usage options and additional features.

  • Partition (tenant) named Sample_monitor_01.
  • A pool named monitorLDAP_pool with one member.
  • Four LDAP monitors, named monitorLDAPdefault, monitorLDAPsimple, monitorLDAPnonDefault1, and monitorLDAPnonDefault2.
{
    "class": "ADC",
    "schemaVersion": "3.6.0",
    "id": "TEST_MONITOR_LDAP",
    "remark": "Test LDAP Monitor",
    "Sample_monitor_01": {
      "class": "Tenant",
      "TEST_Monitor_LDAP": {
        "class": "Application",
        "monitorLDAP_simple": {
          "class": "Monitor",
          "monitorType": "ldap"
        },
        "monitorLDAP_default": {
          "class": "Monitor",
          "monitorType": "ldap",
          "targetAddress": "",
          "targetPort": 0,
          "interval": 5,
          "upInterval": 0,
          "timeUntilUp": 0,
          "timeout": 16,
          "security": "none",
          "mandatoryAttributes": false,
          "chaseReferrals": true
        },
        "monitorLDAP_nonDefault1": {
          "class": "Monitor",
          "monitorType": "ldap",
          "targetAddress": "192.0.2.17",
          "targetPort": 389,
          "interval": 10,
          "upInterval": 15,
          "timeUntilUp": 20,
          "timeout": 46,
          "security": "ssl",
          "mandatoryAttributes": true,
          "chaseReferrals": false,
          "username": "Adm-nM+nkey",
          "passphrase": {
            "ciphertext": "ZjVmNQ==",
            "protected": "eyJhbGciOiJkaXIiLCJlbmMiOiJub25lIn0",
            "ignoreChanges": true
          },
          "base": "dc=bigip-test,dc=org",
          "filter": "objectClass=employee"
        },
        "monitorLDAP_nonDefault2": {
          "class": "Monitor",
          "monitorType": "ldap",
          "targetAddress": "192.0.2.18",
          "targetPort": 389,
          "username": "B*zzL!ghtyear",
          "passphrase": {
            "ciphertext": "ZjVmNQ==",
            "protected": "eyJhbGciOiJkaXIiLCJlbmMiOiJub25lIn0",
            "ignoreChanges": true
          },
          "base": "dc=bigip-test,dc=net",
          "filter": "objectClass=person",
          "security": "tls"
        },
        "monitorLDAP_pool": {
          "class": "Pool",
          "members": [
            {
              "servicePort": 443,
              "serverAddresses": [
                "192.0.2.19"
              ],
              "minimumMonitors": 1,
              "monitors": [
                { "use": "monitorLDAP_nonDefault1" },
                { "use": "monitorLDAP_nonDefault2" }
              ]
            }
          ]
        }
      }
    }
  }

Back to top


Using a DNS monitor in a declaration

This example shows how you use a DNS monitor in a declaration. This example shows two monitors, a simple DNS monitor and a DNS monitor with all available properties that you can use in your declarations. See the Schema Reference for usage options and information.

  • Partition (tenant) named Sample_monitor_02.
  • A pool named monitorDNS_pool with one member.
  • Two monitors attached to the pool: monitorDNS_simple and monitorDNS_AllProperties.
{
    "class": "ADC",
    "schemaVersion": "3.6.0",
    "id": "TEST_MONITOR_DNS",
    "remark": "Test DNS Monitor",
    "Sample_monitor_02": {
      "class": "Tenant",
      "TEST_Monitor_DNS": {
        "class": "Application",
        "monitorDNS_simple": {
          "class": "Monitor",
          "monitorType": "dns",
          "queryName": "apple.test"
        },
        "monitorDNS_AllProperties": {
          "class": "Monitor",
          "monitorType": "dns",
          "queryName": "radish.test",
          "acceptRCODE": "no-error",
          "adaptive": true,
          "adaptiveDivergenceType": "absolute",
          "adaptiveDivergenceMilliseconds": 200,
          "adaptiveLimitMilliseconds": 5000,
          "adaptiveWindow": 1500,
          "answerContains": "query-type",
          "queryType": "aaaa",
          "receive": "fdf5:4153:3300::a",
          "reverse": false,
          "interval": 60,
          "timeUntilUp": 1200,
          "timeout": 600,
          "upInterval": 2400,
          "transparent": false,
          "targetAddress": "fdf5:4153:3300::b",
          "targetPort": 53
        },
        "monitorDNS_pool": {
          "class": "Pool",
          "members": [
            {
              "servicePort": 443,
              "serverAddresses": [
                "fdf5:4153:3300::c"
            ],
              "minimumMonitors": 1,
              "monitors": [
                { "use": "monitorDNS_AllProperties" },
                { "use": "monitorDNS_simple" }
              ]
            }
          ]
        }
      }
    }
  }

Back to top


Using an external monitor in a declaration

This example shows how you can create an external monitor in a declaration. An external monitor allows you to use a custom script for monitoring. In this example, we reference a script located in an external location. You could also reference a script file already present on the BIG-IP.

NEW in BIG-IP AS3 3.24
BIG-IP AS3 3.24 adds the ability to specify environment variables for external monitors using the new environmentVariables property. This allows you to define command line parameters required by the external program you reference.
See Monitor_External in the Schema Reference for BIG-IP AS3 usage.

This declaration creates the following objects on the BIG-IP:

  • Partition (tenant) named Sample_monitor_03.
  • A pool named externalMonitorPool.
  • An external monitor named mNewExternalMonitorFile, that uses a script hosted in an external location.

Warning

The following declaration has been updated to include the environmentVariables property introduced in BIG-IP AS3 3.24. If you attempt to use this declaration on a prior version, it will fail unless you remove the environmentVariables property.

{
  "class": "ADC",
  "schemaVersion": "3.6.0",
  "id": "MONITOR_EXTERNAL",
  "remark": "external monitor",
  "Sample_monitor_03": {
    "class": "Tenant",
    "Monitors": {
      "class": "Application",
      "label": "simple external monitor",
      "mNewExternalMonitorFile": {
        "class": "Monitor",
        "monitorType": "external",
        "interval": 5,
        "upInterval": 0,
        "timeUntilUp": 0,
        "timeout": 16,
        "expand": false,
        "script": {
          "url": "https://example.com/monitor.sh"
        },
        "environmentVariables": {
            "USER": "example"
        }
      },
      "monitorExternal_pool": {
        "class": "Pool",
        "members": [
          {
            "servicePort": 443,
            "serverAddresses": [
              "192.0.2.19"
            ],
            "minimumMonitors": 1,
            "monitors": [
              { "use": "mNewExternalMonitorFile" }
            ]
          }
        ]
      }
    }
  }
}

Back to top


Using a RADIUS monitor in a declaration

This example shows how you use a RADIUS monitor in a declaration. This example shows 3 different RADIUS monitors that you can use in your declarations. See Monitor_FTP in the Schema Reference for usage options and additional features.

This declaration creates the following objects on the BIG-IP:

  • Partition (tenant) named Sample_monitor_04.
  • A pool named monitorRADIUS_pool with one member.
  • Three example RADIUS monitors, named monitorRADIUSdefault, monitorRADIUS_nondefault1, monitorRADIUS_nondefault2.
{
    "class": "ADC",
    "schemaVersion": "3.7.0",
    "id": "TEST_MONITOR_RADIUS",
    "remark": "Test RADIUS Monitor",
    "Sample_monitor_04": {
      "class": "Tenant",
      "TEST_Monitor_RADIUS": {
        "class": "Application",
        "monitorRADIUS_simple": {
          "class": "Monitor",
          "monitorType": "radius"
        },
        "monitorRADIUS_default": {
          "class": "Monitor",
          "monitorType": "radius",
          "targetAddress": "",
          "targetPort": 0,
          "interval": 5,
          "upInterval": 0,
          "timeUntilUp": 0,
          "timeout": 16
        },
        "monitorRADIUS_nonDefault1": {
          "class": "Monitor",
          "monitorType": "radius",
          "targetAddress": "192.0.2.17",
          "targetPort": 1812,
          "interval": 10,
          "upInterval": 15,
          "timeUntilUp": 20,
          "timeout": 46,
          "username": "Adm-nM+nkey",
          "passphrase": {
            "ciphertext": "ZjVmNQ==",
            "protected": "eyJhbGciOiJkaXIiLCJlbmMiOiJub25lIn0",
            "ignoreChanges": true
          },
          "secret": {
            "ciphertext": "ZjVmNQ==",
            "protected": "eyJhbGciOiJkaXIiLCJlbmMiOiJub25lIn0",
            "ignoreChanges": true
          },
          "nasIpAddress": "198.0.2.20"
        },
        "monitorRADIUS_nonDefault2": {
          "class": "Monitor",
          "monitorType": "radius",
          "targetAddress": "192.0.2.18",
          "targetPort": 1645,
          "username": "B*zzL!ghtyear",
          "passphrase": {
            "ciphertext": "ZjVmNQ==",
            "protected": "eyJhbGciOiJkaXIiLCJlbmMiOiJub25lIn0",
            "ignoreChanges": true
          },
          "secret": {
            "ciphertext": "ZjVmNQ==",
            "protected": "eyJhbGciOiJkaXIiLCJlbmMiOiJub25lIn0",
            "ignoreChanges": true
          },
          "nasIpAddress": "192.0.2.20"
        },
        "monitorRADIUS_pool": {
          "class": "Pool",
          "members": [
            {
              "servicePort": 443,
              "serverAddresses": [
                "192.0.2.19"
              ],
              "minimumMonitors": 1,
              "monitors": [
                { "use": "monitorRADIUS_nonDefault1" },
                { "use": "monitorRADIUS_nonDefault2" }
              ]
            }
          ]
        }
      }
    }
  }

Back to top


Using an FTP monitor in a declaration

This example shows how you use an FTP monitor in a declaration. This declaration only includes the monitor, and no pool or virtual service, but simply shows how to create an FTP monitor with AS3. See the Schema Reference for usage options and additional features.

This declaration creates the following objects on the BIG-IP:

  • Partition (tenant) named TEST_FTPMonitor.
  • An FTP monitor named sampleFTPmonitor.
{
    "class": "ADC",
    "schemaVersion": "3.10.0",
    "id": "Monitor",
    "TEST_FTPMonitor": {
        "class": "Tenant",
        "Application": {
            "class": "Application",
            "sampleFTPmonitor": {
                "class": "Monitor",
                "monitorType": "ftp",
                "mode": "port",
                "username": "testUser",
                "passphrase": {
                    "ciphertext": "ZjVmNQ==",
                    "protected": "eyJhbGciOiJkaXIiLCJlbmMiOiJub25lIn0",
                    "ignoreChanges": true
                },
                "filename": "testpath/test/"
            }
        }
    }
}

Back to top


Using certificates in an HTTPS monitor

This example shows how you can create an HTTPS monitor that uses a certificate and key. This declaration only includes the monitor and certificates, and no pool or virtual service, but simply shows how to create an HTTPS monitor that uses a certificate with AS3. See the Schema Reference for usage options and additional features.

Important

The way you compose the declaration depends on whether you are using BIG-IP/TMOS version 13.1 or later (uses the clientTLS property), or a version prior to 13.1 (uses the clientCertificate property). Use the appropriate example.

This declaration creates the following objects on the BIG-IP:

  • Partition (tenant) named TEST_HTTPSMonitor.
  • An HTTPS monitor named sampleHTTPSmonitor.

For versions 13.1 and later

Note in this example, you are also creating a TLS_Client profile (ServerSSL profile in the BIG-IP UI) for the certificate, which is attached to the monitor.

{
    "class": "ADC",
    "schemaVersion": "3.13.0",
    "id": "Monitor",
    "TEST_HTTPSMonitor": {
        "class": "Tenant",
        "Application": {
            "class": "Application",
            "sampleHTTPSmonitor": {
                "class": "Monitor",
                "monitorType": "https",
                "clientTLS": {
                    "use": "webtls"
                }
            },
            "webtls": {
                "class": "TLS_Client",
                "trustCA": {
                     "bigip": "/Common/default.crt"
                }
            }
        }
    }
}

For versions prior to 13.1

In this example, you specify the certificate and key you want to use in the monitor.

{
    "class": "ADC",
    "schemaVersion": "3.10.0",
    "id": "Monitor",
    "TEST_HTTPSMonitor": {
        "class": "Tenant",
        "Application": {
            "class": "Application",
            "sampleHTTPSmonitor": {
                "class": "Monitor",
                "monitorType": "https",
                "clientCertificate": "webcert"
            },
            "webcert": {
                "class": "Certificate",
                "certificate": {"bigip":"/Common/default.crt"},
                "privateKey":{"bigip":"/Common/default.key"}
            }
        }
    }
}

Back to top


Creating a mySQL monitor in a declaration

This example shows how you can create a mySQL monitor in a declaration. The mySQL monitor verifies MySQL-based services. For more information, see the mySQL monitor reference. You can also refer to this older article on DevCentral about monitoring open-source databases with BIG-IP.

See Monitor_MySQL and Monitor_MySQL_Passphrase for BIG-IP AS3 options and usage information.

This declaration creates the following objects on the BIG-IP:

  • Partition (tenant) named mySQLTenant.
  • A virtual server named service that references the pool.
  • A pool named monitorMySQL_pool that references the monitorMySQL_AllProperties monitor.
  • Two monitors, the monitorMySQL_AllProperties monitor which contains all available mySQL monitor properties, and a simple monitor (monitorMySQL_Simple) that is created by the declaration but not used by the pool.
{
  "class": "ADC",
  "schemaVersion": "3.23.0",
  "id": "Example_Monitor_MySQL",
  "remark": "Example MySQL Monitor",
  "mySQLTenant": {
    "class": "Tenant",
    "Application": {
      "class": "Application",
      "service": {
        "class": "Service_HTTP",
        "virtualAddresses": [
          "10.0.14.10"
        ],
        "pool": "monitorMySQL_pool"
      },
      "monitorMySQL_Simple": {
        "class": "Monitor",
        "monitorType": "mysql"
      },
      "monitorMySQL_AllProperties": {
        "class": "Monitor",
        "monitorType": "mysql",
        "remark": "This is a remark",
        "targetAddress": "10.11.12.13",
        "targetPort": 3456,
        "timeUntilUp": 30,
        "timeout": 81,
        "upInterval": 5,
        "count": 10,
        "database": "test_db",
        "interval": 10,
        "send": "SELECT id,first_name,last_name",
        "receive": "something received",
        "receiveColumn": 3,
        "receiveRow": 2,
        "username": "sql-user",
        "passphrase": {
          "ciphertext": "ZjVmNQ==",
          "protected": "eyJhbGciOiJkaXIiLCJlbmMiOiJub25lIn0",
          "ignoreChanges": true
        }
      },
      "monitorMySQL_pool": {
        "class": "Pool",
        "monitors": [
          {
            "use": "monitorMySQL_AllProperties"
          }
        ],
        "members": [
          {
            "servicePort": 443,
            "serverAddresses": [
              "11.12.13.14",
              "11.12.13.15"
            ]
          }
        ]
      }
    }
  }
}

Back to top


Creating an HTTP/2 monitor in a declaration

This example shows how you can create an HTTP/2 monitor in a declaration using the new monitor type http2 and BIG-IP 15.1 or later. This monitor allows you to monitor the health of the HTTP/2 service of your server pools.

See Overview of the BIG-IP HTTP/2 monitor on AskF5 for more information about HTTP/2 monitors.

See Monitor_HTTP2 for BIG-IP AS3 options and usage information.

This declaration creates the following objects on the BIG-IP:

  • Partition (tenant) named TEST_HTTP2Monitor.
  • Application named Application.
  • An HTTP/2 monitor named sampleHTTP2monitor with a number of properties and a reference to a certificate.
{
    "class": "ADC",
    "schemaVersion": "3.25.0",
    "id": "Monitor",
    "TEST_HTTP2Monitor": {
        "class": "Tenant",
        "Application": {
            "class": "Application",
            "sampleHTTP2monitor": {
                "class": "Monitor",
                "monitorType": "http2",
                "clientTLS": {
                    "use": "webtls"
                },
                "interval": 10,
                "receiveDown": "down",
                "receive": "HTTP/2.",
                "send": "GET /\\r\\n\\r\\n",
                "timeUntilUp": 15,
                "timeout": 123
            },
            "webtls": {
                "class": "TLS_Client",
                "trustCA": {
                    "bigip": "/Common/default.crt"
                }
            }
        }
    }
}

Back to top


Creating a PostgreSQL monitor in a declaration

This example shows how you can create a PostgreSQL monitor in a declaration using the new monitor type postgresql. This allows you to monitor the health of your PostgreSQL (Postgres) database servers.

See PostgreSQL monitor on AskF5 for more information on PostgreSQL monitors.

See Monitor_PostgreSQL for BIG-IP AS3 options and usage information.

This declaration creates the following objects on the BIG-IP:

  • Partition (tenant) named PostgreSQLTenant.
  • Application named Application.
  • A virtual server named service that references the pool.
  • A pool named monitorPostgreSQL_pool with two members and a reference to the PostgreSQL monitor.
  • A PostgreSQL monitor named monitorPostgreSQL with a number of properties and a reference to a certificate.
{
  "class": "ADC",
  "schemaVersion": "3.27.0",
  "id": "Example_Monitor_PostgresSQL",
  "remark": "Example PostgreSQL Monitor",
  "PostgreSQLTenant": {
    "class": "Tenant",
    "Application": {
      "class": "Application",
      "service": {
        "class": "Service_HTTP",
        "virtualAddresses": [
          "10.0.14.10"
        ],
        "pool": "monitorPostgreSQL_pool"
      },
      "monitorPostgreSQL": {
        "class": "Monitor",
        "monitorType": "postgresql",
        "remark": "This is a remark",
        "targetAddress": "10.11.12.13",
        "targetPort": 5432,
        "timeUntilUp": 30,
        "timeout": 81,
        "upInterval": 5,
        "count": 10,
        "database": "test_db",
        "interval": 10,
        "send": "SELECT id,first_name,last_name",
        "receive": "something received",
        "receiveColumn": 3,
        "receiveRow": 2,
        "username": "sql-user",
        "passphrase": {
          "ciphertext": "ZjVmNQ==",
          "protected": "eyJhbGciOiJkaXIiLCJlbmMiOiJub25lIn0",
          "ignoreChanges": true
        }
      },
      "monitorPostgreSQL_pool": {
        "class": "Pool",
        "monitors": [
          {
            "use": "monitorPostgreSQL"
          }
        ],
        "members": [
          {
            "servicePort": 443,
            "serverAddresses": [
              "11.12.13.14",
              "11.12.13.15"
            ]
          }
        ]
      }
    }
  }
}

Back to top


Using an external GSLB monitor in a declaration

This example shows how you can create a GLSB external monitor in a declaration. An external monitor allows you to use a custom script for monitoring.

In this example, we show two GSLB external monitors, the first references a file that already exists on the BIG-IP as a TMSH sys file external-monitor object, and the second which references a script located in an external location.

See GSLB_Monitor_External in the Schema Reference for BIG-IP AS3 usage. You can also see External monitor settings in the BIG-IP documentation.

The example declaration only contains the GSLB monitors, which can be used as a part of a larger declaration.

This declaration creates the following objects on the BIG-IP:

  • Partition (tenant) named Sample_External_GSLB_Monitor.
  • A GSLB external monitor named pathname_example which references an existing file on the BIG-IP and uses environmentVariables that contains credentials required by the arg_example file.
  • A second GSLB external monitor named script_example which references an external script via URL.
{
    "class": "ADC",
    "schemaVersion": "3.30.0",
    "id": "GSLB_External_Monitor_Sample",
    "Sample_External_GSLB_Monitor": {
        "class": "Tenant",
        "Application": {
            "class": "Application",
            "pathname_example": {
                "class": "GSLB_Monitor",
                "monitorType": "external",
                "target": "1.1.1.1:80",
                "interval": 31,
                "timeout": 121,
                "probeTimeout": 6,
                "ignoreDownResponseEnabled": true,
                "pathname": "/Common/arg_example",
                "environmentVariables": {
                    "USER": "nobody",
                    "PASSWORD": "secret"
                }
            },
            "script_example": {
                "class": "GSLB_Monitor",
                "monitorType": "external",
                "target": "2.2.2.2:80",
                "interval": 32,
                "timeout": 122,
                "probeTimeout": 7,
                "ignoreDownResponseEnabled": false,
                "script": {
                    "url": "https://example.com/monitor.sh"
                },
                "arguments": "TEST=1"
            }
        }
    }
}

Creating TCP and UDP monitors in a declaration

This example shows how you can create TCP and UDP health monitors in a declaration.

In this declaration, we do not use Send or Receive strings in the monitors. In BIG-IP AS3 version 3.29 and earlier, Send and Receive strings were required.

See Monitor_TCP and Monitor_UDP for BIG-IP AS3 options and usage information.

This declaration creates the following objects on the BIG-IP (this declaration will fail on AS3 versions 3.29 and earlier):

  • Partition (tenant) named TCPTest.
  • Application named TCP_Monitor_Test.
  • A virtual server named service that references the pool.
  • A pool named TCP_Pool that references TCP and UDP monitors.
  • A TCP monitor named TCP_Monitor.
  • A UDP monitor named UDP_Monitor.
{
    "class": "ADC",
    "schemaVersion": "3.30.0",
    "id": "dda23da4-3f9b-49c3-91e8-aa6a3f88baa5",
    "updateMode": "selective",
    "TCPTest": {
        "class": "Tenant",
        "TCP_Monitor_Test": {
            "class": "Application",
            "template": "generic",
            "service": {
                "class": "Service_TCP",
                "virtualAddresses": [
                    "10.0.9.10"
                ],
                "virtualPort": 1234,
                "pool": "TCP_Pool"
                },
                "TCP_Pool": {
                    "class": "Pool",
                    "monitors": [
                        {
                            "use": "TCP_Monitor"
                        },
                        {
                            "use": "UDP_Monitor"
                        }
                    ],
                    "members": [
                        {
                            "enable": true,
                            "adminState": "enable",
                            "shareNodes": true,
                            "serverAddresses": [
                                "1.1.1.1"
                            ],
                            "servicePort": 1234
                        }
                    ],
                    "loadBalancingMode": "least-connections-member"
                },
            "TCP_Monitor": {
                "class": "Monitor",
                "monitorType": "tcp"
            },
            "UDP_Monitor": {
                "class": "Monitor",
                "monitorType": "udp"
            }
        }
    }
}

Back to top


Creating an inband monitor in a declaration

This example shows how you can create an inband health monitor in a declaration. An inband monitor checks the health of a pool member based on a specified number of connection attempts or data request attempts that occur within a specified time period. If, after the specified number of attempts within the defined interval, the system cannot connect to the server or receive a response, or if the system receives a bad response, the system marks the pool member as down.

See Monitor_Inband for BIG-IP AS3 options and usage information.

This declaration creates the following objects on the BIG-IP:

  • Partition (tenant) named Inband_Monitor_Example.
  • Application named Test_Monitor_Inband.
  • An inband monitor named monitorInband_AllProperties, which configures all available properties for the monitor.
  • A pool named monitorInband_pool that references the inband monitor.
{
    "class": "ADC",
    "schemaVersion": "3.40.0",
    "id": "TEST_INBAND_MONITOR",
    "remark": "test inband monitor",
    "Inband_Monitor_Example": {
        "class": "Tenant",
        "TEST_Monitor_Inband": {
            "class": "Application",
            "monitorInband_AllProperties": {
                "class": "Monitor",
                "label": "this is my label",
                "remark": "this is my remark",
                "monitorType": "inband",
                "failures": 4,
                "failureInterval": 40,
                "responseTime": 12,
                "retryTime": 360
            },
            "monitorInband_pool": {
                "class": "Pool",
                "members": [
                    {
                        "servicePort": 443,
                        "serverAddresses": [
                            "192.0.2.20"
                        ],
                        "monitors": [
                            {
                                "use": "monitorInband_AllProperties"
                            }
                        ]
                    }
                ]
            }
        }
    }
}

Back to top