Cloudflare Docs
Magic Transit
Edit this page on GitHub
Set theme to dark (⇧+D)

Configure Magic Tunnel health alerts

Magic Transit customers can configure Magic Tunnel health alerts to receive email, webhook, and PagerDuty notifications when the percentage of successful health checks for a Magic Tunnel drops below the selected service-level objective (SLO).

Magic Tunnel health alerts will monitor the health check success rate of each Magic Tunnel included in the alert that has actively transferred customer traffic (excluding health check traffic) over the past six hours. Customers can define an SLO threshold for the percentage of health checks that must be successful for each Magic Tunnel. If the number of successful health checks for the Magic Tunnel(s) included in the alert drops below the SLO threshold, then an alert will fire.

​​ Alert data

If a Magic Tunnel health alert is fired, customers can expect the following data in the email, webhook, and PagerDuty notification:

  • Cloudflare account name
  • Cloudflare account ID
  • Alert type
  • Tunnel name
  • Tunnel ID
  • Tunnel status
  • Alert SLO
  • Timestamp

​​ Set up Magic Tunnel health alerts

  1. Log in to your Cloudflare dashboard, and select your account.
  2. Select Notifications > Add.
  3. Select Magic Transit > Magic Tunnel Health Check Alert > Select to add a notification.
  4. Enter a name and description for the notification.
  5. Add webhooks or an email address for the person who should receive the notification, and select Next.
  6. Choose the tunnels you want to receive alerts for.
  7. Select the Alert Sensitivity Level threshold. It is predefined for Medium, but you can choose between High, Medium, and Low.
  8. Select Create when you are done.

An example of the API configuration for Magic Tunnel health alerts is provided below:

curl https://api.cloudflare.com/client/v4/accounts/{account_id}/alerting/v3/policies \
--header 'Authorization: Bearer <API_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"name": "<NAME_OF_MAGIC_TUNNEL_HEALTH_ALERT>",
"alert_type": "magic_tunnel_health_check_event",
"description": "<DESCRIPTION_OF_MAGIC_TUNNEL_HEALTH_ALERT>",
"enabled": true,
"filters": {
"slo": [ "99.0" ],
"tunnel_name": [ "Name(s) of the tunnels monitored in the alert" ]
},
"mechanisms": {
"email": [ { "id": "[email protected]" } ],
"pagerduty": [ { "id": "<PAGERDUTY_ID>" } ],
"webhooks": [ { "id": "<WEBHOOKS_ID>" } ]
}
}'

Refer to the API documentation for more details.

Currently, there are three SLO threshold values that are supported by the API. The SLO threshold for Magic Tunnel health alerts can be defined as the percentage of health checks that must be successful for each of the Magic Tunnel(s) included in the alert:

Alert Sensitivity LevelRecommended SLO threshold
High99.0
Medium98.0
Low97.0