• Cloud Eye

ces
  1. Help Center
  2. Cloud Eye
  3. API Reference
  4. API Description
  5. Alarm Rule Management
  6. Querying an Alarm Rule

Querying an Alarm Rule

Function

This API is used to query an alarm rule based on the alarm ID.

URI

GET /V1.0/{project_id}/alarms/{alarm_id}

  • Parameter description
    Table 1 Parameter description

    Parameter

    Description

    project_id

    Indicates the project ID.

    alarm_id

    Indicates the alarm rule ID.

  • Example
    /V1.0/{project_id}/alarms/al1441967036681YkazZ0deN

Request

None

Response

  • Response parameters
    Table 2 Response parameters

    Parameter

    Type

    Description

    metric_alarms

    JSON array

    Indicates the list of alarm objects.

    alarm_name

    String

    Indicates the name of the alarm.

    alarm_description

    String

    Provides supplementary information about the alarm.

    metric

    JSON object

    Indicates the alarm metrics.

    namespace

    String

    Indicates the metric namespace.

    metric_name

    String

    Indicates the metric name, such as cpu_util in ECS Metrics.

    dimensions

    JSON array

    Indicates the list of the metric dimensions.

    dimension.name: indicates the object type, for example, ECS (instance_id).

    dimension.value: indicates the object ID, for example, ECS ID.

    condition

    JSON object

    Indicates the alarm triggering condition.

    period

    Integer

    Indicates the interval (seconds) for checking whether the configured alarm rules are met.

    filter

    String

    Indicates the data rollup method.

    The value can be Max., Min., Avg., Sum, or Variance.

    comparison_operator

    String

    Indicates the operator.

    The value can be >, =, <, , or .

    value

    Number

    Indicates the alarm threshold.

    unit

    String

    Indicates the data unit.

    count

    Integer

    Indicates how many consecutive times an alarm has been generated.

    alarm_actions

    JSON array

    Indicates the action triggered by an alarm.

    Its structure is:

    {

    "type": "notification", "notificationList": ["urn:smn:region:68438a86d98e427e907e0097b7e35d47:sd"]

    }

    type value:
    • notification: indicates that a notification will be sent to the user.
    • autoscaling: indicates that a scaling action will be triggered.

    notificationList: indicates the list of objects to be notified if the alarm status changes.

    type

    String

    Indicates the type of action triggered by an alarm.

    The value can be notification or autoscaling.

    notificationList

    String array

    Indicates the notification list ID.

    ok_actions

    JSON array

    Indicates the action triggered by the clearing of an alarm.

    Its structure is:

    {

    "type": "notification", "notificationList": ["urn:smn:region:68438a86d98e427e907e0097b7e35d47:sd"]

    }

    type value:

    notification: indicates that a notification will be sent to the user.

    notificationList: indicates the list of objects to be notified if the alarm status changes.

    alarm_enabled

    Boolean

    Indicates whether to enable the alarm rule.

    alarm_level

    Integer

    Indicates the alarm severity. The value can be 1, 2, 3 or 4, which indicates critical, major, minor, and informational, respectively.

    alarm_action_enabled

    Boolean

    Indicates whether to enable the action to be triggered by an alarm.

    alarm_id

    String

    Indicates the alarm rule ID.

    update_time

    Timestamp

    Indicates the time when the alarm status changed.

    The value is a UNIX timestamp and the unit is ms.

    alarm_state

    Enumerated

    Indicates the alarm status. The value can be:

    • ok: The alarm status is normal.
    • alarm: An alarm is generated.
    • insufficient_data: The required data is insufficient.
  • Example response
    {
    "metric_alarms":
      [
       {
        "alarm_name":"alarm-ipwx",
        "alarm_description":"",
        "metric":
         {
          "namespace":"SYS.ELB",
          "dimensions":
          [
           {
            "name":"lb_instance_id",
            "value":"44d06d10-bce0-4237-86b9-7b4d1e7d5621"
           }
          ],
          "metric_name":"m8_out_Bps"
          },
        "condition":
         {
          "period":300,
          "filter":"sum",
          "comparison_operator":">=",
          "value":0,
          "unit":"",
          "count":1
          },
        "alarm_enabled":true,
        "alarm_level": 2,
        "alarm_action_enabled":true,
        "alarm_actions":
         [
          {
           "type":"notification",
           "notificationList":["urn:smn:region:68438a86d98e427e907e0097b7e35d48:sd"]
          }
         ],
        "ok_actions":
         [
          {
           "type":"notification",
           "notificationList":["urn:smn:region:68438a86d98e427e907e0097b7e35d48:sd"]
          }
         ],
        "alarm_id":"al1498096535573r8DNy7Gyk",
        "update_time":1498100100000,
        "alarm_state":"alarm"
       }
      ]
    }

Returned Values

  • Normal

    200

  • Abnormal

    Returned Value

    Description

    400 Bad Request

    Request error

    401 Unauthorized

    The authentication information is not provided or is incorrect.

    403 Forbidden

    You are forbidden to access the page requested.

    408 Request Timeout

    The request timed out.

    429 Too Many Requests

    Concurrent requests are excessive.

    500 Internal Server Error

    Failed to complete the request because of an internal service error.

    503 Service Unavailable

    The service is currently unavailable.

Error Code

For details, see Error Codes.