Skip to content

Feature: Add command to modify existing alert definitions #108

Description

@GuitaristForEver

Summary

Currently cx alerts only supports create, get, list, enable, disable, and events. There is no way to update an existing alert definition in-place.

Problem

Without an update command, modifying any property of an alert (thresholds, notification channels, re-notify intervals, labels, filters) requires:

  1. Fetch the existing alert with cx alerts get <id>
  2. Manually edit the JSON
  3. Disable the old alert with cx alerts disable <id>
  4. Create a new alert with cx alerts create
  5. Manually clean up the disabled alert from the UI (no cx alerts delete either)

This is error-prone and leaves stale disabled alerts accumulating in the account.

Proposed Solution

Add cx alerts update <id> that accepts the same JSON file format as cx alerts create:

cx alerts update <id> --from-file alert.json --yes

Behaviour:

  • Accepts the same alertDefProperties JSON schema as create
  • Performs an in-place update (preserves the alert ID)
  • Returns the updated alert definition on success
  • Requires --yes to match create behaviour for destructive safety

Bonus: also add cx alerts delete <id> so the full CRUD lifecycle is covered from the CLI.

Workaround

Currently using disable + create, leaving orphaned disabled alerts behind.

Environment

  • cx version: 0.1.4
  • Platform: Linux (Azure VM)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions