Skip to main content
POST
Update alert rule (V2)

Restrictions

Usage

  • id is required and the rule must already exist; otherwise the call returns InvalidParameter.
  • This is a full-field replacement: except for the cases below, fields you omit are stored as zero values. Fetch the full configuration via /monit/rule/v2/info before modifying it.
  • enabled must be passed explicitly (including false); omitting it returns InvalidParameter. Setting it to false clears the rule’s active alerts.
  • investigation_targets is the exception: omit it to keep the current value, pass [] to clear, or pass a value to replace it entirely.
  • folder_id cannot be changed through this operation; use /monit/rule/move to move the rule to another folder.
  • account_id, creator_*, updater_*, created_at, and updated_at are maintained by the server; client-supplied values are ignored.
  • name must be unique within folder_id; a duplicate returns InvalidParameter.
  • The request body tolerates additional unknown fields (forward compatibility); they are ignored.
  • Every call is recorded in the account audit log. Don’t put secrets in request fields.

Authorizations

app_key
string
query
required

App key issued from the Flashduty console under Account → APP Keys. Required on every public API call. Keep it secret — it grants the same access as the owning account.

Body

application/json

Complete V2 alert rule configuration. The core difference from V1 lives in rule_configs: the three checkers describe recovery and ending semantics with the lifecycle v2 recovery_mode/end_mode enums.

folder_id
integer<uint64>
required

ID of the folder the rule belongs to; list folders via POST /monit/folder/list. Cannot be changed through the update API — use /monit/rule/move instead.

name
string
required

Rule name. Must be unique within the folder and at most 128 characters.

ds_type
string
required

Datasource type identifier (e.g. prometheus, elasticsearch).

enabled
boolean
required

Whether the rule is enabled. Required — the server enforces an explicit value (including false) while decoding. Setting it to false on update clears the rule's active alerts.

rule_configs
object
required

Detection configuration: query list plus trigger/recovery conditions. See AlertRuleConfigsV2.

cron_pattern
string
required

Schedule expression: a 6-field cron (with seconds) or an @every 30s interval. Must not start with CRON_TZ= or TZ=; set the timezone in the timezone field instead.

id
integer<uint64>

Rule ID. Required on update; omit on create (assigned by the server).

account_id
integer<uint64>

Account ID, filled by the server from the authentication context; any client-supplied value is ignored.

labels
object

Custom labels.

ds_list
string[]

Datasource name match patterns (wildcards supported). At least one of ds_list / ds_ids must be non-empty; both are merged to decide which datasources the rule monitors.

ds_ids
integer<uint64>[]

Datasource ID list, merged with ds_list to decide the monitored datasources; IDs survive datasource renames. At least one of ds_list / ds_ids must be provided.

debug_log_enabled
boolean

Enable debug logging; the edge then emits detailed evaluation logs for this rule, useful when the rule does not trigger as expected.

timezone
string
default:Asia/Shanghai

Timezone the rule runs in; it decides how the cron schedule and enabled time windows are interpreted. Only IANA names are accepted (e.g. Asia/Shanghai, UTC, Europe/London); abbreviations or offsets like Local, UTC+8, CST are rejected. Empty falls back to Asia/Shanghai.

delay_seconds
integer

Seconds the evaluation query window is shifted back, compensating for data ingestion latency.

enabled_times
object[]

Time windows during which the rule is in effect. When omitted or empty, the rule is active 00:00–23:59 every day.

annotations
object

Extra annotation key-value pairs delivered with alert events; keys must not start with $ (reserved for query fields).

description_type
enum<string>
default:text

Format of the description content. Empty or omitted defaults to text. text = plain text; markdown = Markdown, rendered as such in alert details.

Available options:
text,
markdown
description
string

Rule description, Markdown format.

channel_ids
integer<uint64>[]

Collaboration space IDs alerts are sent to. May be empty; alerts then route through the global integration.

repeat_interval
integer<int64>

Notification repeat interval in seconds. Values below 1 fall back to the default 3600.

repeat_total
integer<int64>

Maximum number of repeat notifications. Values below 1 fall back to the default 3.

investigation_targets
object[]

Drill-down entries linked from the alert event detail page; at most 20 items, duplicates rejected. On update the field is presence-based: omit it to keep the current value, pass [] to clear.

creator_id
integer<uint64>

Creator member ID, filled by the server from the current user; any client-supplied value is ignored.

creator_name
string

Creator name, filled by the server; any client-supplied value is ignored.

updater_id
integer<uint64>

ID of the member who last updated the rule, filled by the server; any client-supplied value is ignored.

updater_name
string

Name of the member who last updated the rule, filled by the server; any client-supplied value is ignored.

created_at
integer<int64>

Creation time as a Unix timestamp in seconds, generated by the server; any client-supplied value is ignored.

updated_at
integer<int64>

Last update time as a Unix timestamp in seconds, generated by the server; any client-supplied value is ignored.

Response

Success

Success response envelope. On every 2xx response, request_id identifies the call (also mirrored in the Flashcat-Request-Id header) and data holds the endpoint-specific payload. Failure responses use a different shape — see ErrorResponse.

request_id
string
required

Unique ID for this request. Mirrored in the Flashcat-Request-Id response header. Include it when reporting issues.

Example:

"01HK8XQE3Z7JM2NTFQ5YJ8P9R4"

data
object
required

Complete V2 alert rule configuration. The core difference from V1 lives in rule_configs: the three checkers describe recovery and ending semantics with the lifecycle v2 recovery_mode/end_mode enums.