---
title: "Get a metric condition"
method: GET
path: "/metric-conditions/{condition}"
tags: ["Metric conditions"]
---

# Get a metric condition

`GET /metric-conditions/{condition}`

## Request

- Base URL: `https://api.spectate.net/v1`
- URL: `https://api.spectate.net/v1/metric-conditions/{condition}`
- Auth: HTTP bearer

Returns the condition with the hosts and projects it applies to.

## Path parameters

- `condition` string, uuid, required

## Response `200`

The metric condition.

- MetricCondition: An alert rule for host metrics, for example "CPU usage above 90% for 5 minutes". It applies to its hosts and to every host of its projects.
  - `id` string, uuid, required: Metric condition ID
  - `metric` 'cpu_usage' | 'system.cpu.user' | 'system.cpu.system' | 'system.cpu.iowait' | 'system.cpu.stolen' | 'system.cpu.idle' | 'system.cpu.guest' | 'system.cpu.interrupt' | 'memory_usage' | 'system.memory.total' | 'system.memory.used' | 'system.memory.free' | 'system.memory.available' | 'system.memory.available_percent' | 'system.swap.total' | 'system.swap.used' | 'system.swap.free' | 'system.swap.free_percent' | 'system.swap.in' | 'system.swap.out' | 'disk_usage' | 'system.disk_usage.total' | 'system.disk_usage.used' | 'system.disk_usage.free' | 'system.disk_usage.inodes_total' | 'system.disk_usage.inodes_used' | 'system.disk_usage.inodes_free' | 'system.disk_usage.inodes_used_percent' | 'load_average' | 'system.load.1' | 'system.load.5' | 'system.load.15' | 'network_in' | 'network_out' | 'system.net.packets_recv' | 'system.net.packets_sent' | 'system.net.err_in' | 'system.net.err_out' | 'system.net.drop_in' | 'system.net.drop_out' | 'system.net.fifo_in' | 'system.net.fifo_out' | 'system.uptime' | 'system.io.busy_percent' | 'system.io.await_ms' | 'system.pressure.cpu.some' | 'system.pressure.memory.some' | 'system.pressure.io.some' | 'system.net.tcp.established' | 'system.net.tcp.time_wait' | 'system.files.used_percent', required: A host metric the agent reports. `cpu_usage`, `memory_usage`, `disk_usage`, `load_average`, `network_in` and `network_out` are the summaries the dashboard charts; the `system.*` metrics are the agent's raw values.
  - `condition` MetricCondition, required (recursive)
  - `threshold` number, required: Compared with the metric's value as the agent reports it, in the unit the host's charts show (percent for `cpu_usage`, `memory_usage` and `disk_usage`)
  - `duration_minutes` integer, required: Minutes the condition must hold before the alert fires; 0 fires on the first breach
  - `severity` 'critical' | 'high' | 'medium' | 'low', required: How urgent an alert or incident is. Escalation paths can branch on it. | | |---| | `critical` <br/> Customers are affected right now. | | `high` <br/> Serious, needs attention soon. | | `medium` <br/> Should be looked at. | | `low` <br/> Informational. |
  - `hosts` HostReference[], required: Hosts it applies to
    - `id` string, uuid, required: Host ID
    - `label` string, nullable, required: Host name shown in the dashboard; `null` until set or reported
  - `projects` ProjectReference[], required: Projects whose hosts it applies to
    - `id` string, uuid, required: Project ID
    - `name` string, required: Project name

## Other responses

- `401`: `UNAUTHENTICATED`: no token was sent. `INVALID_TOKEN`: the token is unknown or revoked. `TOKEN_EXPIRED`: the token has expired.
- `403`: `FORBIDDEN`: the token lacks an ability this endpoint requires (listed in `details.required_abilities`). `TEAM_PENDING_DELETION`: the team is scheduled for deletion. `TEAM_SUSPENDED`: Spectate suspended the team.
- `404`: `RESOURCE_NOT_FOUND`: there is no such resource in this team.
- `429`: `RATE_LIMITED`: too many requests for this token. Wait for the number of seconds in `Retry-After`.

---

[API](https://skmtc.dev/spectate/apis/spectate-api.md) - [All operations](https://skmtc.dev/spectate/apis/spectate-api/llms.txt) - [OpenAPI document](https://skmtc.dev/spectate/apis/spectate-api/revisions/9b1a233997de?raw)
