Help Center > > API Reference> API Description> Alarm Rule Management> Querying the Alarm Rule List

Querying the Alarm Rule List

Updated at: Sep 10, 2019 19:44

Function

This API is used to query the alarm rule list. You can specify the paging parameters to limit the number of query results displayed on a page. You can also set the sorting order of query results.

URI

GET /V1.0/{project_id}/alarms

  • Parameter description
    Table 1 Parameter description

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Specifies the project ID.

    For details about how to obtain the project ID, see Obtaining a Project ID.

    Table 2 Query parameter description

    Parameter

    Mandatory

    Type

    Description

    start

    No

    String

    Specifies the first queried alarm to be displayed on a page.

    The value is alarm_id.

    limit

    No

    Integer

    The value ranges from 1 to 100, and is 100 by default.

    This parameter is used to limit the number of query results.

    order

    No

    String

    Specifies the result sorting method, which is sorted by timestamp.

    The default value is desc.

    • asc: The query results are displayed in the ascending order.
    • desc: The query results are displayed in the descending order.
  • Example
    Request example 1: Query the current alarm rule list.
    GET https://{Cloud Eye endpoint}/V1.0/{project_id}/alarms
    Request example 2: Query the alarm rule list. Start by setting alarm_id to al1441967036681YkazZ0deN and retain 10 records in the descending order of time stamps.
    GET https://{Cloud Eye endpoint}/V1.0/{project_id}/alarms?start=al1441967036681YkazZ0deN&limit=10&order=desc

Request

None

Response

  • Response parameters
    Table 3 Response parameters

    Parameter

    Type

    Description

    metric_alarms

    Array of objects

    Specifies the list of alarm objects.

    For details, see Table 4.

    meta_data

    Object

    Specifies the metadata of query results, including the paging information.

    For details, see Table 10.

    Table 4 metric_alarms field data structure description

    Parameter

    Type

    Description

    alarm_name

    String

    Specifies the name of the alarm.

    alarm_description

    String

    Provides supplementary information about the alarm.

    metric

    Object

    Specifies the alarm metrics.

    For details, see Table 5.

    condition

    Object

    Specifies the alarm triggering condition.

    For details, see Table 9.

    alarm_enabled

    Boolean

    Specifies whether to enable the alarm rule.

    alarm_level

    Integer

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

    alarm_action_enabled

    Boolean

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

    alarm_actions

    Array of objects

    Specifies the action triggered by an alarm.

    For details, see Table 7.

    ok_actions

    Array of objects

    Specifies the action triggered by clearing an alarm.

    For details, see Table 8.

    alarm_id

    String

    Specifies the alarm rule ID.

    update_time

    String

    Specifies the time when the alarm status changed. The value is a UNIX timestamp and the unit is ms.

    alarm_state

    String

    Specifies 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.
    Table 5 metric field data structure description

    Parameter

    Type

    Description

    namespace

    String

    Specifies the namespace, such as ECS Namespace.

    dimensions

    Array of objects

    Specifies the list of the metric dimensions.

    For details, see Table 6.

    metric_name

    String

    Specifies the metric name, for example, cpu_util of an ECS.

    Table 6 dimensions field data structure description

    Parameter

    Type

    Description

    name

    String

    Specifies the object type, for example, ECS (instance_id).

    For details about the supported object types, see the key field in Dimension.

    value

    String

    Specifies the object ID, for example, ECS ID. The value is a string of one to 256 characters.

    For details about the supported object types, see the value field in Dimension.

    Table 7 alarm_actions field data structure description

    Parameter

    Type

    Description

    type

    String

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

    notificationList

    Array of strings

    Specifies the list of objects to be notified if the alarm status changes.

    NOTE:

    The IDs in the list are character strings.

    Table 8 ok_actions field data structure description

    Parameter

    Type

    Description

    type

    String

    Specifies the notification type when an alarm is triggered.
    • notification: indicates that a notification will be sent to the user.
    • autoscaling: indicates that a scaling action will be triggered.

    notificationList

    Array of strings

    Specifies the ID list of objects to be notified if the alarm status changes.

    NOTE:

    The IDs in the list are character strings.

    Table 9 condition field data structure description

    Parameter

    Type

    Description

    period

    Integer

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

    filter

    String

    Specifies the data rollup method. The following methods are supported:

    • If Avg. is selected for Statistic, Cloud Eye calculates the average value of metric data within a rollup period.
    • If Max. is selected for Statistic, Cloud Eye calculates the maximum value of metric data within a rollup period.
    • If Min. is selected for Statistic, Cloud Eye calculates the minimum value of metric data within a rollup period.
    • If Sum is selected for Statistic, Cloud Eye calculates the sum of metric data within a rollup period.
    • If Variance is selected for Statistic, Cloud Eye calculates the variance value of metric data within a rollup period.

    comparison_operator

    String

    Specifies the comparison condition of alarm thresholds. The value can be >, =, <, , or .

    value

    Integer

    Specifies the alarm threshold.

    unit

    String

    Specifies the data unit.

    count

    Integer

    Specifies the number of consecutive times that an alarm is triggered.

    Table 10 meta_data field data structure description

    Parameter

    Type

    Description

    count

    Integer

    Specifies the number of returned results.

    marker

    String

    Specifies the pagination marker.

    For example, you have queried 10 records this time and alarm_id of the tenth record is 1441967036681YkazZ0deN. In your next query, if start is set to al1441967036681YkazZ0deN, you can start your query from the next alarm rule ID of al1441967036681YkazZ0deN.

    total

    Integer

    Specifies the total number of query results.

  • Example response
    {
        "metric_alarms": [
            {
                "alarm_name": "alarm-ttttttt",
                "alarm_description": "",
                "metric": {
                    "namespace": "SYS.ECS",
                    "dimensions": [
                        {
                            "name": "instance_id",
                            "value": "07814c0e-59a1-4fcd-a6fb-56f2f6923046"
                        }
                    ],
                    "metric_name": "cpu_util"
                },
                "condition": {
                    "period": 300,
                    "filter": "average",
                    "comparison_operator": ">=",
                    "value": 0,
                    "unit": "%",
                    "count": 3                
                },
                "alarm_enabled": true,
                "alarm_level": 2,
                "alarm_action_enabled": false,
                "alarm_id": "al15330507498596W7vmlGKL",
                "update_time": 1533050749992,
                "alarm_state": "alarm"
            },
            {
                "alarm_name": "alarm-m5rwxxxxxxx",
                "alarm_description": "",
                "metric": {
                    "namespace": "SYS.ECS",
                    "dimensions": [
                        {
                            "name": "instance_id",
                            "value": "30f3858d-4377-4514-9081-be5bdbf1392e"
                        }
                    ],
                    "metric_name": "network_incoming_bytes_aggregate_rate"
                },
                "condition": {
                    "period": 300,
                    "filter": "average",
                    "comparison_operator": ">=",
                    "value": 12,
                    "unit": "B/s",
                    "count": 3                
                },
                "alarm_enabled": true,
                "alarm_level": 2,
                "alarm_action_enabled": true,
                "alarm_actions": [
                    {
                        "type": "notification",
                        "notificationList": [
                            "urn:smn:region:68438a86d98e427e907e0097b7e35d48:test0315"
                        ]
                    }
                ],
                "ok_actions": [
                    {
                        "type": "notification",
                        "notificationList": [
                            "urn:smn:region:68438a86d98e427e907e0097b7e35d48:test0315"
                        ]
                    }
                ],            
                "alarm_id": "al1533031226533nKJexAlbq",
                "update_time": 1533204036276,
                "alarm_state": "ok"
            }
        ],
        "meta_data": {
            "count": 2,
            "marker": "al1533031226533nKJexAlbq",
            "total": 389
        }
    }

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.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel