---
title: "Create a resource alert (CPU / memory / disk) on a node."
method: POST
path: "/nodes/{id}/metrics/alert-rules"
tags: ["Metrics"]
---

# Create a resource alert (CPU / memory / disk) on a node.

`POST /nodes/{id}/metrics/alert-rules`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/nodes/{id}/metrics/alert-rules`
- Auth: HTTP bearer

Works for workers as well as the control plane (`0`). A worker's series is
fed by its heartbeats, so a rule only starts evaluating once the node has
reported at least once.

## Path parameters

- `id` integer, required

## Request body

- NodeCreateAlertRuleRequest: Request body for creating a resource alert on a node. A rule watches a usage percentage (`node.cpu_percent`, `node.memory_percent`, `node.disk_percent`; `threshold` 0-100) or a disk-health metric (`node.raid_degraded`, `node.disk_wear_percent`, `node.disk_media_errors`; `threshold` 0 or more). A node has at most one rule per metric.
  - `comparator` string, required: One of `>`, `<`, `>=`, `<=`.
  - `enabled` boolean
  - `for_duration_secs` integer: Seconds the breach must persist before the alarm fires (0 = immediate).
  - `metric_name` string, required: One of the usage percentages or disk-health metrics listed above.
  - `name` string, required
  - `severity` string, required: `"warning"` or `"critical"`.
  - `threshold` number, double, required: 0-100 for a usage percentage; 0 or more for a disk-health metric.

## Response `201`

Alert rule created

- ServiceAlertRuleResponse: Wire representation of a monitoring alert rule. Registered under a domain-prefixed OpenAPI schema name to avoid colliding with `temps-error-tracking`'s unrelated `AlertRuleResponse` (utoipa keys schemas by their bare struct name, so without `as = ...` the last crate to register would silently shadow this one in the merged spec / generated SDK).
  - `comparator` string, required
  - `deployment_id` integer, nullable
  - `enabled` boolean, required
  - `for_duration_secs` integer, required
  - `id` integer, required
  - `metric_name` string, required
  - `name` string, required
  - `node_id` integer, nullable: Node the rule is scoped to. `0` is the synthetic control-plane node (see `CONTROL_PLANE_NODE_ID`), which owns the `proxy.*` and `node.*` rules. Exactly one of `service_id`/`deployment_id`/`node_id` is set.
  - `service_id` integer, nullable
  - `severity` string, required
  - `silenced_until` string, nullable
  - `threshold` number, double, required

## Other responses

- `400`: Invalid request
- `401`: Unauthorized
- `403`: Insufficient permissions
- `404`: Node not found
- `409`: The node already has a rule for this metric
- `500`: Internal server error

## Changes

- **2026-10-25** `718cc1844de1`: 1 info
  - endpoint added
- **2026-10-25** `852053a38074`: 1 breaking
  - api removed without deprecation
- **2026-10-24** `ec38673c317d`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/nodes/:id/metrics/alert-rules/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
