Skip to content
v1
Docs

REST API

Quiet a noisy alarm

An alarm that fires all day is an alarm nobody reads. This guide finds the noisy ones, switches one off or changes its thresholds, and then does the same for every server of a profile at once, or holds the notifications for a while instead. It is what a script or an assistant acting for your organisation needs to keep the alarms useful, without the console.

alarms.view to find alarms and read the catalogue, alarms.edit to create, change and switch off an alarm and to snooze a server, a server profile or a service (never services.edit: one permission quiets every resource type), and alarms.delete to delete one. The profile templates use the server profile scopes: server_profiles.view to read them and to preview a propagation, server_profiles.edit to create and change a template and to run a propagation, server_profiles.delete to delete a template. Add policies.view to read the names of the policies an alarm notifies; without it each policy is its uuid alone. A key made before these scopes existed holds none of them: add them to the key in the console, under Organisation → API keys. See authentication and keys.

Start from the incidents. Filter the list by the rule and by the severity, and count what comes back:

Terminal window
curl -sS "https://rest.watchtower15.com/v1/incidents?rule_slug=server.cpu_high&severity=warning&period=1d" \
-H "Authorization: Bearer $WT15_API_KEY"

Every incident names its alarm in alarm_uuid. To list the alarms themselves, ask for the whole organisation in one call, filtered by rule_slug, state, active, policy_uuid, entity_type or server_uuid, and paged with limit and cursor:

Terminal window
curl -sS "https://rest.watchtower15.com/v1/organisation/alarms?rule_slug=server.cpu_high&state=warning&state=critical" \
-H "Authorization: Bearer $WT15_API_KEY"

Alarms of deleted resources are not listed. entity_type=server is the servers’ own alarms only; every port’s alarms are entity_type=server_port, and one server with its volumes, ports and units is server_uuid. A server’s whole set is also one call of its own: its own alarms and those of its volumes, ports and systemd units. Filter by rule_slug, entity_type, active and state:

Terminal window
curl -sS "https://rest.watchtower15.com/v1/servers/$SERVER_UUID/alarms?rule_slug=server.cpu_high&active=true" \
-H "Authorization: Bearer $WT15_API_KEY"

Each alarm gives its thresholds, its live state, the resource it is on (entity, and parent_entity for a volume, port or unit) and the policies it notifies.

PUT /v1/alarms/{alarm_uuid} changes only the fields you send:

Terminal window
curl -sS -X PUT https://rest.watchtower15.com/v1/alarms/$ALARM_UUID \
-H "Authorization: Bearer $WT15_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"active": false}'

The answer is the alarm after the change. Switching an alarm off resolves its open incidents at once, since nothing will evaluate it again, and {"active": true} turns it back on. To keep the alarm and make it quieter, change its thresholds, its window or its consecutive count instead: {"warning_threshold": 85, "critical_threshold": 95, "warning_consecutive_failures_count": 5}.

A null sends a field back to its catalogue rule’s default: a threshold, a window, a consecutive count, aggregation, comparison_operator, name and the two notify_on_ flags. active and alarm_policy_uuids cannot be null, because a null there would silently switch the alarm off or detach every policy: send [] to clear the policies. Thresholds out of order for the comparison are refused with a 422.

Editing an alarm that came from a profile template makes it overridden. A later propagation of that template leaves it alone, so an alarm switched off here stays off when the profile changes.

Switch an alarm off to keep it and turn it back on later. Delete it, with DELETE /v1/alarms/{alarm_uuid}, when it should never come back: its open incidents resolve, its incident history stays, and neither a profile propagation nor the next deploy adds it again. A deleted alarm answers 404 everywhere, including PUT: it cannot be revived. A resource holds at most 40 alarms, and an alarm that a profile left deleted still counts towards the 40.

Read the catalogue for the type of resource, narrowed by its sub-type, to find the rule’s slug (a page holds 25 rules unless you ask for up to 100 with per_page; page reads the next one):

Terminal window
curl -sS "https://rest.watchtower15.com/v1/alarm-rules?entity_type=server&per_page=100" \
-H "Authorization: Bearer $WT15_API_KEY"

Then create the alarm with POST /v1/alarms, naming the resource and the rule, and any threshold you want to set:

Terminal window
curl -sS https://rest.watchtower15.com/v1/alarms \
-H "Authorization: Bearer $WT15_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d "{\"entity_type\": \"server\", \"entity_uuid\": \"$SERVER_UUID\", \"rule_slug\": \"server.cpu_high\", \"name\": \"CPU early warning\", \"warning_threshold\": 60}"

A second alarm on the same rule and resource is allowed: that is how one metric gets an early warning and a page.

Servers on a profile get the profile’s alarm templates. Read them, change the template, and then preview and run the propagation:

Terminal window
curl -sS https://rest.watchtower15.com/v1/server-profiles/$PROFILE_UUID/alarm-templates \
-H "Authorization: Bearer $WT15_API_KEY"

Each template shows how many servers’ alarms still follow it (inherited_count) and how many were edited by hand (overridden_count). Change one with PUT /v1/server-profiles/{server_profile_uuid}/alarm-templates/{template_uuid}, or add one with POST. Neither changes a server’s alarm by itself. A new template’s alarm is later added to each server of the profile that lacks it (add only, never changing an existing alarm), with no time you can rely on. To change or remove alarms on the servers now, preview, then propagate:

Terminal window
curl -sS -X POST https://rest.watchtower15.com/v1/server-profiles/$PROFILE_UUID/alarm-templates/preview-propagation \
-H "Authorization: Bearer $WT15_API_KEY" -H "Idempotency-Key: $(uuidgen)"
curl -sS -X POST https://rest.watchtower15.com/v1/server-profiles/$PROFILE_UUID/alarm-templates/propagate \
-H "Authorization: Bearer $WT15_API_KEY" -H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"apply_to_all": true}'

The preview writes nothing: it says, for each template, how many servers would get a new alarm, how many alarms would change and how many are kept because they were edited by hand or deleted on that server, and, for alarms whose template is gone, how many would be removed and how many open incidents that would resolve. propagate with apply_to_all left out, or false, only adds the alarms servers are missing. With "apply_to_all": true it also applies the templates’ values to the alarms that follow them and removes, on every server of the profile, the alarms whose template is gone. Removing an alarm stops monitoring what it watched, with no other symptom, so read the preview first. Deleting a template does not remove the alarms it made; they stay as each server’s own, until a propagation with apply_to_all removes them.

Every write is audited with the key’s owner as the actor.

6. Snooze a server, or a whole profile, for a while

Section titled “6. Snooze a server, or a whole profile, for a while”

To keep the alarms and quiet only their notifications, for a patch window or a reboot, snooze the server. The alarms keep evaluating: incidents still open, escalate, step down and resolve, and health and the alarm states keep their real values. Only the automatic notifications are held. PUT takes a duration (a whole number, at least 1) and a unit (minutes, hours or days), counted from now, and an optional reason of up to 500 characters:

Terminal window
curl -sS -X PUT https://rest.watchtower15.com/v1/servers/$SERVER_UUID/alarm-snooze \
-H "Authorization: Bearer $WT15_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"duration": 2, "unit": "hours", "reason": "Kernel patching"}'

The answer is the server’s snooze: until (epoch milliseconds), source (server or profile, the snooze that ends later), the server’s own snooze in server and its profile’s in profile. A snooze lasts 1 minute to 30 days; more is refused with 422. A server has one snooze of its own, so a second PUT replaces its end: that is how you extend or shorten it. DELETE /v1/servers/{server_uuid}/alarm-snooze ends it early and answers 204, also when there was none.

To snooze every server of a profile, use PUT and DELETE on /v1/server-profiles/{server_profile_uuid}/alarm-snooze, with the same body. The profile’s snooze covers the servers that use the profile at the moment a notification would be sent: a server that joins the profile while it is snoozed is snoozed, and one that leaves it is not. The answer is the profile’s own snooze: until, reason and set_at. A server is quiet while either its own snooze or its profile’s is live, until the later of the two ends; ending one leaves the other in force. Read the server’s alarm_snooze to see both.

What is held. A server’s snooze covers its own alarms and those of its volumes, ports and systemd units. Its database instances, services, domains, log sources and custom metrics are not covered. A new or escalated incident whose alarm has a notification policy is held, not sent, and reads notification_held_at (epoch milliseconds) on GET /v1/incidents/{incident_uuid}; an alarm with no policy is never marked held.

What a resolve does. While the server is snoozed, an incident that resolves is resolved without a notification, including one that was notified before the snooze started: the team is not told that an earlier page cleared. An incident whose trigger was held also resolves silently. A person’s act is the exception: an acknowledge or a resolve through POST /v1/incidents/{incident_uuid}/acknowledge or .../resolve still notifies, snoozed or not, and clears the hold.

When it ends. By its time or by DELETE, each incident that is still open and was held is notified once, at its current severity, with the normal Triggered notification; its text is the one written when it was held, so after a step down it can read lowered from critical. An incident acknowledged or resolved meanwhile is cleared without a notification, and notification_held_at goes back to null.

Timing. A snooze takes effect from the next evaluation pass, up to a minute, so a notification can still go out in the pass running when you call; an end likewise. The release at the end is made by a sweep that runs every minute, so it can follow the end by up to a minute.

To find the snoozed profiles in one call, read GET /v1/server-profiles: each profile carries its own alarm_snooze, or null. GET /v1/servers gives each server an alarm_snoozed_until, and GET /v1/servers/{server_uuid} its full alarm_snooze. A snooze needs alarms.edit, and is audited with the key’s owner as the actor.

A service’s alarms are snoozed the same way, and by the same rules: the alarms keep evaluating, incidents still open, escalate, step down and resolve, and only the automatic notifications are held. PUT /v1/services/{service_uuid}/alarm-snooze takes the same duration, unit and optional reason:

Terminal window
curl -sS -X PUT https://rest.watchtower15.com/v1/services/$SERVICE_UUID/alarm-snooze \
-H "Authorization: Bearer $WT15_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"duration": 3, "unit": "hours", "reason": "Payment provider migration"}'

The answer is the service’s own snooze: until (epoch milliseconds), reason and set_at. A service has one snooze, so a second PUT replaces its end: that is how you extend or shorten it. DELETE /v1/services/{service_uuid}/alarm-snooze ends it early and answers 204, also when there was none. To find the snoozed services, read GET /v1/services: each service carries its alarm_snooze, or null, and GET /v1/services/{service_uuid} the same.

What is held. Every alarm on the service: its reachability, response, collector and workflow run and step alarms, and any custom alarm on it. The servers that collect for the service are their own resources and are not covered, and snoozing a server does not snooze the services it checks. A new or escalated incident whose alarm has a notification policy is held, not sent, and reads notification_held_at on GET /v1/incidents/{incident_uuid}; a resolve while the service is snoozed is silent, a person’s acknowledge or resolve still notifies, and at the end each incident still open whose notification was held is notified once, as in section 6. A paused service may be snoozed too: the two are independent, and a snooze still live when the service is resumed holds whatever opens after it.

The key needs the alarms.edit scope, not services.edit: a person or a key that edits a service’s check cannot silence its pages without it. The snooze is audited with the key’s owner as the actor.