Skip to main content
Platform O&M/Cloud Monitoring/Monitoring and Alarm/SNS/ZWatch Operations/Alarm Operations
POSTAlarm OperationsSince 2.3SynchronousAuth Required

CreateAlarm

CreateAlarm

Execution Availability

Try It Out

Submit a mock request using the current auth context and example-driven inputs.

Request Inputs

Body Fields

  • paramsObjectRequired

    Request body parameter object.

    • nameStringRequired

      The resource name.

    • descriptionString

      Optional. The detailed description of the resource.

    • comparisonOperatorStringRequired

      The threshold comparison operator.

    • periodInteger

      The threshold duration.

    • namespaceStringRequired

      The namespace.

    • metricNameStringRequired

      The metric name.

    • thresholdDoubleRequired

      The threshold.

    • repeatIntervalInteger

      Optional. The alarm repeat interval.

    • labelsList

      Optional. The label list.

    • actionsList

      Optional. The alarm action list.

    • resourceUuidString

      Optional.

    • repeatCountInteger

      Optional. The alarm repeat count.

    • typeString

      Optional. The alarm type.

    • enableRecoveryBooleanRequired

      Whether to enable the recovery notification.

    • emergencyLevelString

      Optional. The alarm emergency level.

  • systemTagsList

    Optional. The system tags.

  • userTagsList

    Optional. The user tags.

Responses

200 OK

On success, this API returns the following response structure.

  • errorErrorCodeRequired

    The error code. If not null, the operation fails, or vice versa. For more information, see error.

    • codeStringRequired

      The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001.

    • descriptionStringRequired

      The brief description of the error.

    • detailsStringRequired

      The details about the error.

    • elaborationStringRequired

      The reserved field. Default value: null.

    • opaqueLinkedHashMapRequired

      The reserved field. Default value: null.

    • causeErrorCodeRequired

      The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null.

  • inventoryAlarmInventoryRequired

    See inventory.

    • uuidStringRequired

      The resource UUID.

    • nameStringRequired

      Th resource name.

    • descriptionStringRequired

      The detailed description of the resource.

    • periodIntegerRequired

      The threshold duration.

    • namespaceStringRequired

      The namespace.

    • metricNameStringRequired

      The metric name.

    • thresholdDoubleRequired

      The threshold.

    • repeatIntervalIntegerRequired

      The alarm repeat interval.

    • enableRecoveryBooleanRequired

      Whether to enable the recovery notification.

    • createDateTimestampRequired

      The creation date.

    • lastOpDateTimestampRequired

      The last operation date.

    • comparisonOperatorComparisonOperatorRequired

      See comparisonOperator.

      • nameStringRequired

        The resource name.

      • ordinalintRequired

        No description provided.

    • statusAlarmStatusRequired

      See status.

      • OKAlarmStatusRequired

        The alarm is in normal status.

      • AlarmAlarmStatusRequired

        The alarm is triggered.

      • InsufficientDataAlarmStatusRequired

        The data is insufficient.

    • labelsListRequired

      See labels.

      • uuidStringRequired

        The resource UUID.

      • keyStringRequired

        The label key.

      • operatorStringRequired

        The comparison operator.

      • valueStringRequired

        The label value.

    • actionsListRequired

      See actions.

      • alarmUuidStringRequired

        The alarm UUID.

      • actionTypeStringRequired

        The action type.

      • actionUuidStringRequired

        The action UUID.

Endpoint

POST/zstack/v1/zwatch/alarms

/zstack/v1/zwatch/alarms

Operation ID

CreateAlarm

Permalink

Request Example

curl -X POST 'http://{host}/zstack/v1/zwatch/alarms' -H 'Authorization: OAuth {sessionUuid}' -H 'Content-Type: application/json;charset=UTF-8' -d '{"params":{"name":"<name>","description":"<description>","comparisonOperator":"<comparisonOperator>","period":1,"namespace":"<namespace>","metricName":"<metricName>","threshold":1,"repeatInterval":1,"labels":["<labels>"],"actions":["<actions>"],"resourceUuid":"<resourceUuid>","repeatCount":1,"type":"<type>","enableRecovery":true,"emergencyLevel":"<emergencyLevel>"},"systemTags":["<systemTags>"],"userTags":["<userTags>"]}'

Response Example

200
{ "inventory": { "uuid": "6ff094db7e8b4640880751c5a17e7b63", "name": "VM CPU Alarm", "comparisonOperator": "LessThanOrEqualTo", "period": 60.0, "namespace": "ZStack/VM", "metricName": "org.zstack.zwatch.datatype.Metric@c2e79f0", "threshold": 30.0, "repeatInterval": 1800.0, "repeatCount": -1.0, "status": "Alarm", "state": "Enabled", "enableRecovery": true, "createDate": "Jul 6, 2018 1:51:02 PM", "lastOpDate": "Jul 6, 2018 1:51:02 PM", "labels": [ { "uuid": "cccd980c3bb84f4486d96a960eb08edb", "key": "VMUuid", "operator": "\u003d", "value": "f486fd81583747459d8a6cd47f9228e5" } ], "actions": [ { "alarmUuid": "8a6a98e3cc484388a746d725265886b3", "actionType": "sns", "actionUuid": "86a2b51fbc7f406c906711081852fa49" } ] } }

Change History

This API has no change history records yet.

View all change history