Manage monitors
A monitor issues health monitor requests at regular intervals to evaluate the health of each endpoint within a pool.
When a pool becomes unhealthy, your load balancer takes that pool out of the endpoint rotation.
For more details about monitors, refer to Monitors.
Set up the monitor
You can create a monitor within the load balancer workflow or in the Monitors section of the dashboard:
-
Go to Traffic > Load Balancing.
-
Select Manage Monitors.
-
Select Create.
-
Add the following information:
- Type: The protocol to use for health monitors
- Non-enterprise customers: Choose HTTP, HTTPS, or TCP.
- Enterprise customers: Choose HTTP, HTTPS, TCP, UDP ICMP, ICMP Ping, or SMTP.
- Path: The endpoint path to run health monitor requests against
- Port: The destination port for health monitors
- Type: The protocol to use for health monitors
-
For additional settings, select Advanced health monitor settings:
- Interval:
- By increasing the default, you can improve failover time, but you may also increase load on your endpoints.
- Minimum time in seconds is 60 (Pro), 15 (Business), and 10 (Enterprise).
- Timeout and Retries:
- The health monitor request will return unhealthy if it exceeds the duration specified in Timeout (and exceeds this duration more times than the specified number of Retries).
- Expected Code(s): The expected HTTP response codes listed individually (
200
,302
) or as a range (for example, entering2xx
would cover all response codes in the200
range). - Response Body:
- Looks for a case-insensitive substring in the response body.
- Make sure that the value is relatively static and within the first 100 MB of the HTML page.
- Simulate Zone:
- Pushes a request from Cloudflare health monitors through the Cloudflare stack as if it were a real visitor request to help analyze behavior or validate a configuration using the zone specified.
- It is recommended to use the same zone in which the Load Balancer exists.
- Ensures health monitor requests are compatible with features like authenticated origin pulls and Argo Smart Routing.
- Follow Redirects:
- Instead of reporting a
301
or302
code as unhealthy, the health monitor request follows redirects to the final endpoint.
- Instead of reporting a
- Configure Request Header(s):
- Useful if your endpoints are expecting specific incoming headers.
- Header:
- The HTTP request headers to send in the health monitor. It is recommended that you set a Host header by default. The User-Agent header cannot be overridden. This parameter is only valid for HTTP and HTTPS monitors.
- Interval:
-
Select Save.
Prepare your servers
Make sure that your firewall or web server does not block or rate limit your configured health monitors or requests associated with Cloudflare IP addresses ↗.
Each health monitor has the HTTP user-agent of "Mozilla/5.0 (compatible; Cloudflare-Traffic-Manager/1.0; +https://www.cloudflare.com/traffic-manager/; pool-id: $poolid)"
, where the $poolid
is the first 16 characters of the associated pool.
Attach the monitor to a pool
Once your monitor is created, you need to attach it to a pool:
-
Go to Traffic > Load Balancing.
-
Select Manage Pools.
-
On a specific pool, select Edit.
-
Update the following information:
- Monitor: Select your monitor.
- Health Monitor Regions: Specifies geographic regions from which Cloudflare should send health monitor requests. Because of how monitors check pool health, selecting multiple regions could increase the load on your servers.
- Notification E-mail: Contains email addresses that receive notifications (individual, mailing list address, PagerDuty address).
-
Select Save. The status of your health monitor will be unknown until the results of the first check are available.
Set up the monitor
For a full list of monitor properties, refer to Create Monitor. If you need help with API authentication, refer to Cloudflare API documentation.
The response contains the complete definition of the new monitor.
Prepare your servers
Make sure that your firewall or web server does not block or rate limit your configured health monitors or requests associated with Cloudflare IP addresses ↗.
Each health monitor has the HTTP user-agent of "Mozilla/5.0 (compatible; Cloudflare-Traffic-Manager/1.0; +https://www.cloudflare.com/traffic-manager/; pool-id: $poolid)"
, where the $poolid
is the first 16 characters of the associated pool.
Attach the monitor to a pool
Once your monitor is created, save its id
property. Include this value in the monitor
parameter when creating your pool.
To edit a monitor in the dashboard:
- Go to Traffic > Load Balancing.
- Select Manage Monitors.
- On a specific monitor, select Edit.
- Update settings as needed.
- Select Save.
When you edit a monitor with the API, your request type depends on how much you want to edit.
To update specific settings without having to resubmit the entire configuration, use a PATCH request. For broader changes, use a PUT request.
To delete a monitor in the dashboard:
- Go to Traffic > Load Balancing.
- Select Manage Monitors.
- On a specific monitor, select Delete.
To delete a monitor using the API, send a DELETE request.