Skip to content

Copy a server check's rules

POST
/api/v1/checks/{checkId}/copy-rules
curl --request POST \
--url https://app.monitorly.cloud/api/v1/checks/CHECK_ID/copy-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "targets": [ "ID" ] }'

Gives other server checks the rules of this one: every rule, threshold and duration, the rules of each disk and the ignore lists. Each target keeps its server, name, project and alerts. Every target changes, or none does. Needs the viewer role on this check and the editor role on every target.

checkId
required
string format: uuid

The check’s id.

Example

CHECK_ID
Media typeapplication/json
object
targets
required

Server checks to take the rules, 1–100, each once and not the source.

Array<string>

The target checks as they are stored now.

Media typeapplication/json
object
checks
required

The targets as stored now.

Array<object>

A stored check as answered by the API.

object
createdAt
required
string
downAfter
required
integer format: int32
epoch
required

Bumped whenever a change alters the check’s meaning; results of other epochs never vote.

integer format: int64
escalationPolicyId

The check’s own escalation policy; null: the project’s (ProjectView.escalationPolicyId).

string | null format: uuid
id
required
string format: uuid
intervalSecs
required
integer format: int32
kind
required
One of:
object
assertions
Array
One of:
object
op
required
string
Allowed values: eq ne lt le gt ge
target
required
string
Allowed values: status
value
required
integer format: int32
body
string | null
degradedAfterMs

Response time above this marks the run DEGRADED.

integer | null format: int32
headers
Array<object>
object
name
required
string
value
required
One of:
object
kind
required
string
Allowed values: plain
value
required
string
maxRedirects
required
integer format: int32
method
required
string
Allowed values: GET HEAD POST PUT PATCH DELETE OPTIONS
url
required
string
type
required
string
Allowed values: http
managedBy

config when a config apply manages the check (only those are pruned), ui otherwise. Always sent; optional in the schema because it was added after the first clients.

string
Allowed values: ui config
muted
required
boolean
name
required
string
nodes
required
Array<string>
paused
required
boolean
projectId
required
string format: uuid
quorum
required
One of:

F ≥ ⌈M/2⌉ and F ≥ min(2, S).

object
mode
required
string
Allowed values: half
ref

The check’s key in a config file (monitorly.yaml); null until a config apply creates or adopts it. Always sent; optional in the schema because it was added after the first clients.

string | null
timeoutMs
required
integer format: int32
upAfter
required
integer format: int32
updatedAt
required
string

Example

{
"checks": [
{
"escalationPolicyId": "ESCALATION_POLICY_ID",
"id": "ID",
"kind": {
"assertions": [
{
"op": "eq",
"target": "status"
}
],
"headers": [
{
"value": {
"kind": "plain"
}
}
],
"method": "GET",
"type": "http"
},
"managedBy": "ui",
"nodes": [
"ID"
],
"projectId": "PROJECT_ID",
"quorum": {
"mode": "half"
}
}
]
}

Bad Request.

  • request.malformed: the body or a parameter is not of the expected shape
  • auth.credentials_conflict: the request carries both a session cookie and a token
Media typeapplication/problem+json
object
detail
string | null
errors
required

Field errors, empty for errors of the whole request.

Array<object>
object
code
required
string
params
required
object
key
additional properties
pointer
required

JSON pointer into the request body.

string
status
required
integer format: int32
title
required
string
type
required

Stable code, for example check.timeout_exceeds_interval.

string

Example generated

{
"detail": "example",
"errors": [
{
"code": "example",
"params": {
"additionalProperty": "example"
},
"pointer": "example"
}
],
"status": 1,
"title": "example",
"type": "example"
}

Unauthorized.

  • auth.unauthenticated, auth.session_expired: no session, or it ended
  • token.invalid: the token is malformed, unknown, revoked or expired, or its creator left the workspace
Media typeapplication/problem+json
object
detail
string | null
errors
required

Field errors, empty for errors of the whole request.

Array<object>
object
code
required
string
params
required
object
key
additional properties
pointer
required

JSON pointer into the request body.

string
status
required
integer format: int32
title
required
string
type
required

Stable code, for example check.timeout_exceeds_interval.

string

Example generated

{
"detail": "example",
"errors": [
{
"code": "example",
"params": {
"additionalProperty": "example"
},
"pointer": "example"
}
],
"status": 1,
"title": "example",
"type": "example"
}

Forbidden.

  • auth.forbidden: your role is too low for this
  • token.scope_missing: the token lacks the scope this needs; detail names it
  • request.origin_mismatch, request.header_required: a changing request with a session comes from another site or lacks X-Monitorly-Request: 1
Media typeapplication/problem+json
object
detail
string | null
errors
required

Field errors, empty for errors of the whole request.

Array<object>
object
code
required
string
params
required
object
key
additional properties
pointer
required

JSON pointer into the request body.

string
status
required
integer format: int32
title
required
string
type
required

Stable code, for example check.timeout_exceeds_interval.

string

Example generated

{
"detail": "example",
"errors": [
{
"code": "example",
"params": {
"additionalProperty": "example"
},
"pointer": "example"
}
],
"status": 1,
"title": "example",
"type": "example"
}

Not Found.

  • request.not_found: it does not exist, or you cannot see it
Media typeapplication/problem+json
object
detail
string | null
errors
required

Field errors, empty for errors of the whole request.

Array<object>
object
code
required
string
params
required
object
key
additional properties
pointer
required

JSON pointer into the request body.

string
status
required
integer format: int32
title
required
string
type
required

Stable code, for example check.timeout_exceeds_interval.

string

Example generated

{
"detail": "example",
"errors": [
{
"code": "example",
"params": {
"additionalProperty": "example"
},
"pointer": "example"
}
],
"status": 1,
"title": "example",
"type": "example"
}

Conflict.

  • check.not_server: rules are copied only from a server check to server checks
Media typeapplication/problem+json
object
detail
string | null
errors
required

Field errors, empty for errors of the whole request.

Array<object>
object
code
required
string
params
required
object
key
additional properties
pointer
required

JSON pointer into the request body.

string
status
required
integer format: int32
title
required
string
type
required

Stable code, for example check.timeout_exceeds_interval.

string

Example generated

{
"detail": "example",
"errors": [
{
"code": "example",
"params": {
"additionalProperty": "example"
},
"pointer": "example"
}
],
"status": 1,
"title": "example",
"type": "example"
}

Payload Too Large.

  • request.too_large: the body is larger than 256 KiB
Media typeapplication/problem+json
object
detail
string | null
errors
required

Field errors, empty for errors of the whole request.

Array<object>
object
code
required
string
params
required
object
key
additional properties
pointer
required

JSON pointer into the request body.

string
status
required
integer format: int32
title
required
string
type
required

Stable code, for example check.timeout_exceeds_interval.

string

Example generated

{
"detail": "example",
"errors": [
{
"code": "example",
"params": {
"additionalProperty": "example"
},
"pointer": "example"
}
],
"status": 1,
"title": "example",
"type": "example"
}

Unprocessable Entity.

  • field.required, field.too_long, field.invalid: a field breaks a rule; errors points at it
Media typeapplication/problem+json
object
detail
string | null
errors
required

Field errors, empty for errors of the whole request.

Array<object>
object
code
required
string
params
required
object
key
additional properties
pointer
required

JSON pointer into the request body.

string
status
required
integer format: int32
title
required
string
type
required

Stable code, for example check.timeout_exceeds_interval.

string

Example generated

{
"detail": "example",
"errors": [
{
"code": "example",
"params": {
"additionalProperty": "example"
},
"pointer": "example"
}
],
"status": 1,
"title": "example",
"type": "example"
}

Too Many Requests.

  • token.rate_limited: more than 10 requests a second with this token
  • session.rate_limited: more than 5 changes a second from your sessions
Media typeapplication/problem+json
object
detail
string | null
errors
required

Field errors, empty for errors of the whole request.

Array<object>
object
code
required
string
params
required
object
key
additional properties
pointer
required

JSON pointer into the request body.

string
status
required
integer format: int32
title
required
string
type
required

Stable code, for example check.timeout_exceeds_interval.

string

Example generated

{
"detail": "example",
"errors": [
{
"code": "example",
"params": {
"additionalProperty": "example"
},
"pointer": "example"
}
],
"status": 1,
"title": "example",
"type": "example"
}
Retry-After
integer
>= 1

Seconds to wait before trying again.