warning or critical, and recovers automatically when the check returns to passing.
This integration works with both Consul Community Edition and Consul Enterprise. It needs only a watch definition on one Consul agent, with no extra scripts or plugins.
In Flashduty On-call
You can get the integration push URL in either of the following ways.Use a dedicated integration
Choose this option if all alerts go to one channel. It’s the simpler setup.View dedicated integration setup steps
View dedicated integration setup steps
- In the Flashduty console, select Channel and open a channel
- Select Configuration → Integrations → Private integration, then click Add integration
- Select HashiCorp Consul, then click Save
- Open the generated integration card and copy the Push URL
Use a shared integration
Choose this option if you need to route alerts to different channels based on the alert payload.How it works
Whenever any watched health check changes (its status or its output), a Consul watch of typechecks POSTs the current state of all watched checks to the push URL as one JSON array. Flashduty turns each check in the array into one event:
- A
warningorcriticalcheck raises an alert, or merges into the alert it already has - A
passingcheck recovers its alert; if there is no such alert, nothing happens - The
_node_maintenanceand_service_maintenance:<service ID>checks created by maintenance mode (consul maint) are planned changes and never create alerts
warning or critical raise alerts right away.
Prerequisites
- Network: the Consul agent that runs the watch must be able to reach the Flashduty push URL (for example
https://api.flashcat.cloud). - Permissions: you need to be able to edit that agent’s configuration directory (for example
/etc/consul.d) and runconsul reload. - ACL: when ACLs are enabled, the token the watch uses needs read access to all nodes and services, as described below.
In Consul
Choose the agent that runs the watch
Add the watch definition
/etc/consul.d) › flashduty-watch.jsonCreate a file named flashduty-watch.json with the content below:-
Do not set the
stateparameter. With"state": "critical", a check drops out of the array when it recovers, Flashduty never receivespassing, and the alert cannot recover automatically. -
To watch only some checks, narrow the watch with the
filterparameter, for example"filter": "ServiceName == \"web\" or CheckID == \"serfHealth\"", or watch the checks of one service with"service": "web"(this leaves out node-level checks such asserfHealth). -
When ACLs are enabled, add
"token": "<ACL token>"to the watch. The token’s policy needs at least:
Reload the configuration
/consul/config in the container, then run:http watch handler failed with output, Flashduty rejected the request; the log line carries the HTTP status and the reason.Register a TTL check to verify an alert and its recovery
critical, so it raises an alert right away:passing, and the alert recovers:-H "X-Consul-Token: <ACL token>" to each command.After a few seconds, go back to Flashduty. If the integration shows a Latest event time, the setup works.Alert key
Flashduty builds the Alert Key fromPartition, Node, and CheckID.
Nodeis the name of the node the check runs on.CheckIDis the ID of the check. Consul requiresCheckIDto be unique on a node; a service check’s default ID looks likeservice:<service ID>, and the node liveness check isserfHealth.Partitionis the admin partition in Consul Enterprise and is empty in Community Edition.
Status and severity
warning and critical, Flashduty keeps one alert per severity: warning turning critical creates a new Critical alert, and passing recovers both.
Labels
<check name> on <node name>, and the alert description is the check’s Output and Notes.
FAQ
A check or node was removed and its alert did not recover. What should I do?
A check or node was removed and its alert did not recover. What should I do?
warning or critical check is deregistered, or its node leaves the cluster, it no longer appears in the array the watch sends, so Flashduty never receives a recovery. Close the alert by hand. In environments where nodes are removed often, turn on the auto-resolve timeout in the channel.Does Consul retry a failed delivery?
Does Consul retry a failed delivery?
Why does the event count of an alert keep growing?
Why does the event count of an alert keep growing?
filter or service parameter to watch only the checks your on-call team acts on.The agent log shows request body exceeds 1 MiB limit. What should I do?
The agent log shows request body exceeds 1 MiB limit. What should I do?
filter or service parameter; all watches can use the same push URL.Do I need consul-alerts, as in the PagerDuty integration?
Do I need consul-alerts, as in the PagerDuty integration?