Skip to content

plexctl alert

Synopsis

plexctl alert is the operator surface for a Domain's stored alert rules. Alert rules are stored, managed configuration on a Domain: the platform records and serves them but does not evaluate them in this phase, so a stored rule never fires on its own. The family exposes the standard CRUD surface — list, get, create, update, delete — against the per-Domain alert-rules endpoints.

text
plexctl alert list   --domain <uuid> [flags]
plexctl alert get    --domain <uuid> --id <uuid>
plexctl alert create --domain <uuid> --name <name> --signal <expr> --comparator <gt|gte|lt|lte> --threshold <n> --severity <info|warning|critical> [flags]
plexctl alert update --domain <uuid> --id <uuid> [flags]
plexctl alert delete --domain <uuid> --id <uuid> --yes

Subcommands

plexctl alert list

Drives the ListAlertRules operation (GET /v1/domains/{domainId}/alert-rules) and pages a Domain's stored alert rules, forwarding --cursor and --limit on the query string. In text mode each rule projects onto the columns NAME, SIGNAL, COMPARATOR, THRESHOLD, SEVERITY, ENABLED, ID. In json / yaml mode the typed list shape is emitted verbatim, preserving next_cursor for the caller to page on.

plexctl alert get

Drives the GetAlertRule operation (GET /v1/domains/{domainId}/alert-rules/{alertRuleId}) and fetches a single stored alert rule by id within a Domain. text mode renders the same column projection as list; json / yaml emit the typed AlertRule shape verbatim.

plexctl alert create

Drives the CreateAlertRule operation (POST /v1/domains/{domainId}/alert-rules) and stores a new alert rule on a Domain. --comparator and --severity are validated against their enums at flag-parse time, so a bad value never reaches the wire and exits 2. The created rule is stored, managed configuration only — it is recorded and served, never evaluated. The render projection matches get.

plexctl alert update

Drives the UpdateAlertRule operation (PATCH /v1/domains/{domainId}/alert-rules/{alertRuleId}). Only the flags the operator actually changed are sent on the PATCH body; an absent flag leaves the stored value untouched. The rule remains stored, managed configuration only. The render projection matches get.

plexctl alert delete

Drives the DeleteAlertRule operation (DELETE /v1/domains/{domainId}/alert-rules/{alertRuleId}). The persistent --yes flag must be set; without it the command refuses the destructive delete rather than acting on a single typo of the rule id. On success the server returns 204 No Content and the command prints nothing.

Flags

plexctl alert list

FlagTypeRequiredDescription
--domainstring (UUID)yesTarget Domain UUID.
--cursorstringnoContinuation token returned by a previous call's next_cursor.
--limitintnoMaximum items per page (server default when unset).

plexctl alert get

FlagTypeRequiredDescription
--domainstring (UUID)yesTarget Domain UUID.
--idstring (UUID)yesAlert rule UUID.

plexctl alert create

FlagTypeRequiredDescription
--domainstring (UUID)yesTarget Domain UUID.
--namestringyesDomain-unique logical name.
--signalstringyesMetric or log series expression recorded as the watched signal.
--comparatorstringyesCrossing direction recorded against the threshold: gt, gte, lt, lte.
--thresholdfloatyesFinite value the signal is recorded against.
--severitystringyesRecorded severity classification: info, warning, critical.
--enabledboolnoRecord the rule as enabled (stored configuration only; defaults to enabled server-side when unset).

plexctl alert update

FlagTypeRequiredDescription
--domainstring (UUID)yesTarget Domain UUID.
--idstring (UUID)yesAlert rule UUID.
--namestringnoNew Domain-unique logical name.
--signalstringnoNew watched signal expression.
--comparatorstringnoNew crossing direction recorded against the threshold: gt, gte, lt, lte.
--thresholdfloatnoNew finite threshold value.
--severitystringnoNew recorded severity classification: info, warning, critical.
--enabledboolnoNew enabled flag (stored configuration only).

plexctl alert delete

FlagTypeRequiredDescription
--domainstring (UUID)yesTarget Domain UUID.
--idstring (UUID)yesAlert rule UUID.
--yesboolyesConfirm the destructive delete; inherited from root.

Persistent flags inherited from root

--server, --profile, --token-file, --output, --yes. See ../plexctl.md for the canonical list.

Exit codes

See ../plexctl.md#exit-code-taxonomy for the inherited base table. The cases that apply to this family:

CodeTrigger
0The rule, the page, or the (empty) delete result was rendered to stdout.
1Transport or API failure, a server-side 5xx, or a malformed response body.
2Malformed --domain / --id UUID, an invalid --comparator / --severity, a missing required flag, or an unknown --output value.
3Missing or insecure credentials, or a 401 Unauthorized.
4403 Forbidden, or a 404 Not Found.
77ReBAC denial (403 Forbidden with reason == "rebac_denied").

Examples

Store a new alert rule

shell
export PLEXSPHERE_URL="${PLEXSPHERE_URL:-https://localhost:8080}"

plexctl alert create \
  --server     "${PLEXSPHERE_URL}" \
  --domain     0190a8b8-b1c1-7b1b-8b1b-b1b1b1b1b1b1 \
  --name       high-cpu \
  --signal     'avg(rate(node_cpu_seconds_total[5m]))' \
  --comparator gt \
  --threshold  0.9 \
  --severity   warning

List a Domain's stored alert rules

shell
plexctl alert list \
  --server "${PLEXSPHERE_URL}" \
  --domain 0190a8b8-b1c1-7b1b-8b1b-b1b1b1b1b1b1

Update a stored rule's threshold and delete it

shell
plexctl alert update \
  --server    "${PLEXSPHERE_URL}" \
  --domain    0190a8b8-b1c1-7b1b-8b1b-b1b1b1b1b1b1 \
  --id        0190a8b8-d3e3-7d3d-8d3d-d3d3d3d3d3d3 \
  --threshold 0.95

plexctl alert delete \
  --server "${PLEXSPHERE_URL}" \
  --domain 0190a8b8-b1c1-7b1b-8b1b-b1b1b1b1b1b1 \
  --id     0190a8b8-d3e3-7d3d-8d3d-d3d3d3d3d3d3 \
  --yes

Cross-references