CloudWatchOmni / Client / update_alert

update_alert

CloudWatchOmni.Client.update_alert(**kwargs)

Updates an existing alert.

Only non-null fields overwrite existing values.

See also: AWS API Documentation

Request Syntax

response = client.update_alert(
    spaceId='string',
    alertId='string',
    profileId='string',
    name='string',
    description='string',
    rule={
        'telemetryRule': {
            'query': {
                'language': 'SQL'|'PROMQL',
                'expression': 'string'
            },
            'condition': {
                'thresholdMode': 'COUNT_OF_RESULTS'|'FIELD_VALUE',
                'thresholdField': 'string',
                'comparator': 'GT'|'LT'|'GTE'|'LTE',
                'warningThreshold': 123.0,
                'criticalThreshold': 123.0
            },
            'evaluation': {
                'intervalSeconds': 123,
                'pendingDurationSeconds': 123,
                'recoveryDurationSeconds': 123
            },
            'noData': {
                'treatAs': 'OK'|'WARNING'|'CRITICAL'|'NODATA'
            }
        }
    },
    notificationsEnabled=True|False,
    notificationRules=[
        {
            'trigger': {
                'stateValues': [
                    'OK'|'WARNING'|'CRITICAL'|'NODATA',
                ]
            },
            'target': {
                'type': 'sns'|'slack'|'pagerduty',
                'arn': 'string',
                'metadata': {
                    'string': 'string'
                }
            }
        },
    ]
)
Parameters:
  • spaceId (string) –

    [REQUIRED]

    The unique ID of the space.

  • alertId (string) –

    [REQUIRED]

    The alert to update.

  • profileId (string) – The ID of the access profile associated with the alert.

  • name (string) – A new display name for the alert. Omit to leave the name unchanged (apply-if-present / PATCH). Same constraints as CreateAlert.name; the name is not the alert’s identity, so a rename never changes the alertId.

  • description (string) – A new description of the alert. Omit to leave unchanged.

  • rule (dict) –

    The rule that defines how the alert is evaluated. Omit to leave unchanged. Each sub-block is replaced whole when present: {@code query}, {@code condition}, {@code evaluation} and {@code noData} are applied only when supplied, and within a supplied block an omitted optional member is cleared to unset (null/absent) rather than preserved from the stored alert or defaulted. See {@link AlertCondition} and {@link AlertEvaluation}.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: telemetryRule.

    • telemetryRule (dict) –

      The telemetry-based rule definition.

      • query (dict) –

        The query expression to evaluate.

        • language (string) – [REQUIRED]

          The query language of the expression.

        • expression (string) – [REQUIRED]

          The query expression to evaluate.

      • condition (dict) –

        The condition that determines when the alert fires.

        • thresholdMode (string) –

          How the threshold is applied to query results.

        • thresholdField (string) –

          The field the threshold is evaluated against.

        • comparator (string) –

          The comparison operator applied to the threshold.

        • warningThreshold (float) –

          The value at which the alert enters the WARNING state.

        • criticalThreshold (float) –

          The value at which the alert enters the CRITICAL state.

      • evaluation (dict) –

        The evaluation cadence and durations.

        • intervalSeconds (integer) – [REQUIRED]

          The interval between evaluations, in seconds.

        • pendingDurationSeconds (integer) –

          The duration a breach must persist before the alert fires, in seconds.

        • recoveryDurationSeconds (integer) –

          The duration a recovery must persist before the alert clears, in seconds.

      • noData (dict) –

        How the alert behaves when a query produces no data.

        • treatAs (string) – [REQUIRED]

          The state to report when an evaluation produces no data.

  • notificationsEnabled (boolean) – Whether actions (notifications) are enabled for this alert. Omitted = leave existing value unchanged.

  • notificationRules (list) –

    Replaces the entire notification rule list when present; full-replace, not merge. Omitted = leave existing rules unchanged. An empty list clears all rules (the alert keeps evaluating; only notifications stop).

    • (dict) –

      Single notification rule: which transitions trigger this rule and where the resulting notification should be sent.

      • trigger (dict) – [REQUIRED]

        The conditions that trigger this notification rule.

        • stateValues (list) –

          Alert state(s) that trigger this rule. Empty / omitted = any state.

          • (string) –

            Flat alert state. Severity is folded in: a WARNING/CRITICAL alert reports that state directly. {@code NODATA} indicates the evaluation produced no data (subject to the rule’s noData.treatAs handling).

      • target (dict) – [REQUIRED]

        The destination for notifications from this rule.

        • type (string) – [REQUIRED]

          The type of notification target.

        • arn (string) – [REQUIRED]

          The Amazon Resource Name (ARN) of the notification target. For {@code slack} and {@code pagerduty}, an integration ARN as returned by {@code ListIntegrations}.

        • metadata (dict) –

          Additional target-specific metadata.

          • (string) –

            • (string) –

Return type:

dict

Returns:

Response Syntax

{}

Response Structure

  • (dict) –

Exceptions

  • CloudWatchOmni.Client.exceptions.ThrottlingException

  • CloudWatchOmni.Client.exceptions.ValidationException

  • CloudWatchOmni.Client.exceptions.ResourceNotFoundException

  • CloudWatchOmni.Client.exceptions.AccessDeniedException

  • CloudWatchOmni.Client.exceptions.InternalServerException

  • CloudWatchOmni.Client.exceptions.ConflictException