Spectate API

Alert rules for host metrics, such as "disk usage above 90% for 10 minutes". A condition applies to the hosts it names and to every host of the projects it names; when it holds for its duration, it raises an alert with its severity on the host.


List metric conditions

GET
https://api.spectate.net/v1
/metric-conditions

Returns the team's metric conditions, oldest first.

List metric conditions › query Parameters

filter[host_id]
​string · uuid

Only conditions attached to this host directly (not through its project).

filter[project_id]
​string · uuid

Only conditions attached to this project.

page
​integer

Page number, from 1.

Default: 1
per_page
​integer

Conditions per page, 1 to 100.

Default: 25

List metric conditions › Responses

Paginated set of MetricCondition

current_page
​integer · min: 1 · required
​MetricCondition[] · required
first_page_url
​string | null · required
from
​integer | null · min: 1 · required
last_page_url
​string | null · required
last_page
​integer · min: 1 · required
​object[] · required

Generated paginator links.

next_page_url
​string | null · required
path
​string | null · required

Base path for paginator generated URLs.

per_page
​integer · min: 0 · required

Number of items shown per page.

prev_page_url
​string | null · required
to
​integer | null · min: 1 · required

Number of the last item in the slice.

total
​integer · min: 0 · required

Total number of items being paginated.


Create a metric condition

POST
https://api.spectate.net/v1
/metric-conditions

Hosts and projects must belong to the team (422 otherwise). The condition is checked on the next report of each host it applies to.

Create a metric condition › Request Body

A new metric condition. Attach it to hosts, to projects (all their hosts), or both.
metric
​MetricPoint · enum · required

The metric to watch

Enum values:
cpu_usage
system.cpu.user
system.cpu.system
system.cpu.iowait
system.cpu.stolen
system.cpu.idle
system.cpu.guest
system.cpu.interrupt
​MetricCondition · required

How the metric's value is compared with threshold

threshold
​number · required

Compared with the metric's value as the agent reports it, in the unit the host's charts show

Example: 90
severity
​Severity · enum · required

Severity of the alert it raises

critical
Customers are affected right now.
high
Serious, needs attention soon.
medium
Should be looked at.
low
Informational.
Enum values:
critical
high
medium
low
duration_minutes
​integer · min: 0 · max: 60

Minutes, 0 to 60, the condition must hold before the alert fires. Default 0: on the first breach

Example: 5
host_ids
​string[] · unique

Hosts of the team it applies to

project_ids
​string[] · unique

Projects of the team whose hosts it applies to

Create a metric condition › Responses

The new metric condition.

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
​MetricPoint · enum · required

The metric to watch

Enum values:
cpu_usage
system.cpu.user
system.cpu.system
system.cpu.iowait
system.cpu.stolen
system.cpu.idle
system.cpu.guest
system.cpu.interrupt
condition
​required · circular
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)

Example: 90
duration_minutes
​integer · required

Minutes the condition must hold before the alert fires; 0 fires on the first breach

Example: 5
severity
​Severity · enum · required

Severity of the alert it raises

critical
Customers are affected right now.
high
Serious, needs attention soon.
medium
Should be looked at.
low
Informational.
Enum values:
critical
high
medium
low
​HostReference[] · required

Hosts it applies to

​ProjectReference[] · required

Projects whose hosts it applies to


Get a metric condition

GET
https://api.spectate.net/v1
/metric-conditions/{condition}

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

Get a metric condition › path Parameters

condition
​string · uuid · required

Metric condition ID.

Get a metric condition › Responses

The metric condition.

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
​MetricPoint · enum · required

The metric to watch

Enum values:
cpu_usage
system.cpu.user
system.cpu.system
system.cpu.iowait
system.cpu.stolen
system.cpu.idle
system.cpu.guest
system.cpu.interrupt
condition
​required · circular
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)

Example: 90
duration_minutes
​integer · required

Minutes the condition must hold before the alert fires; 0 fires on the first breach

Example: 5
severity
​Severity · enum · required

Severity of the alert it raises

critical
Customers are affected right now.
high
Serious, needs attention soon.
medium
Should be looked at.
low
Informational.
Enum values:
critical
high
medium
low
​HostReference[] · required

Hosts it applies to

​ProjectReference[] · required

Projects whose hosts it applies to


Delete a metric condition

DELETE
https://api.spectate.net/v1
/metric-conditions/{condition}

It's no longer checked from the hosts' next report.

Delete a metric condition › path Parameters

condition
​string · uuid · required

Metric condition ID.

Delete a metric condition › Responses

No content

No data returned