Query alert notifications

2024-03-22 09:34:35  Updated

Description

You can call this operation to query alert notifications based on conditions, recipient, and sending time.

Call description

Prerequisite

You have the alert read permissions.

Request path

GET /api/v2/alarm/notifications

Request parameters

Parameter Type Required Example Description
page Integer No 1 The number of the page to return. Pages start from page 1. Default value: 1.
size Integer No 10 The number of entries to return on each page. Maximum value: 200.
category String No OB The alert category. Valid values: * OB * APP
appType String No OB The application type or the source of the alert. Valid values: * OB * OCP * OMS * OBProxy * Backup
recipientUid String No 216 The user ID of the recipient.
alarmType String No obagent_dead The alert type.
scope String No ObCluster The alert scope. Valid values: * ObCluster * ObTenant * AppCluster * Service * Host
level Integer No 1 The alert level. Valid values: 1, 2, 3, 4, 5, corresponding to Stopped, Critical, Warning, Caution, and Reminder.
status String No Success The notification sending status. Valid values: Pending, Sending, Success, Failed, and Limited.
sentAtStart Datetime No 2020-11-11T11:12:13.127+08:00 The time when the notification sending starts.
sentAtEnd Datetime No 2020-11-11T17:11:13.127+08:00 The time when the notification sending stops.
keyword String No foo The keyword used to match the alert.
alarmId Integer No 123 The alert ID. If this parameter is set, other parameters will be ignored.

Response parameters

  • Basic data structure

    Parameter Type Description
    data Object The request data.
    ├─ contents Array The list of alert notifications. For more information about its data structure, see the following table.
    ├─ page Object The page information.
    ├─ totalElements Integer The total number of entries.
    ├─ totalPage Integer The total number of pages.
    ├─ number Integer The page number of the returned page.
    ├─ size Integer The number of entries returned per page.
    successful Boolean Indicates whether the request was successful.
    timestamp Datetime The timestamp when the server completed the request.
    duration Integer The time taken by the server to process the request, in milliseconds.
    status Integer An HTTP status code.
    traceId String The trace ID of the request. This trace ID is used for troubleshooting.
    server String The address of the server that responded to the request.
  • Data structure of alert notification

    Parameter Type Description
    id Integer The notification ID.
    recipientUid String The user ID of the recipient.
    recipientAddr String The address of the recipient, which is determined based on the recipient field of the channel. The address may be mail address, phone number, or employee ID.
    channelId Integer The channel ID.
    appType String The application type or the source of the alert. Valid values: OB, OCP, OMS, OBProxy, and Backup.
    scope String The alert scope. Valid values: ObCluster, ObTenant, AppCluster, Service, and Host.
    alarmType String The alert type.
    level Integer The alert level. Value range: 1-5.
    message String The content of the alert message.
    status String The notification sending status. Valid values: Pending, Sending, Success, Failed, and Limited.
    channelResponse String The response returned through the channel corresponding to the last request.
    generatedAt String The time when the notification is generated.
    sentAt String The time when the notification is sent.
    ob_cluster_group String The OceanBase cluster group.
    ob_cluster String The OceanBase cluster.
    ob_tenant String The OB tenant.
    obregion_group String The alias of the OceanBase cluster group, which is compatible with the name in OCP.
    obregion String The alias of the OceanBase cluster, which is compatible with the name in OCP.
    tenant_name String The alias of the OB tenant, which is compatible with the name in OCP.
    host_name String The name of the host.
    host_ip String The IP address of the host.
    svr_ip String The alias of the host IP address, which is compatible with the address in OCP.
    app_cluster String The application cluster.
    service String The service name.
    alarmIds Array The IDs of the associated alerts.
    isAggregated Boolean Whether the notification is aggregated.

Examples

Sample request

Query alert notifications.

GET /api/v2/alarm/notifications?page=1&size=2

Sample response

{
    "data": {
        "contents": [
            {
                "alarmIds": [
                    1000160
                ],
                "alarmType": "no_enough_exporter",
                "appType": "OCP",
                "channelId": 100001,
                "channelResponse": "stdout=,stderr=",
                "generatedAt": "2020-12-03T01:50:12Z",
                "id": 1001134,
                "isAggregated": false,
                "labels": {
                    "alarm_name": "Insufficient exporter processes",
                    "app_type": "OCP",
                    "alarm_level_color": "#722ED1",
                    "alarm_last_interval": "PT6M8.301194S",
                    "svr_ip": "xxx.xxx.xxx.xxx",
                    "alarm_description_3": "service=OCP:svr_ip=xxx.xxx.xxx.xxx. The number of exporter processes is insufficient.",
                    "host_services": "OB_CLUSTER,OB_PROXY",
                    "alarm_level": "Stopped",
                    "alarm_description_1": "service=OCP:svr_ip=xxx.xxx.xxx.xxx. The number of exporter processes is insufficient. The deployed services OB_CLUSTER and OB_PROXY require 6 exporter processes, but the actual number of exporter processes is only 5.",
                    "alarm_name_3": "Insufficient exporter processes",
                    "alarm_description_2": "service=OCP:svr_ip=xxx.xxx.xxx.xxx exporter number not enough, deployed services OB_CLUSTER,OB_PROXY,  expected exporter count 6, actual exporter count 5",
                    "alarm_name_2": "exporter number not enough",
                    "expected_exporter_count": "6",
                    "alarm_name_1": "Insufficient exporter processes",
                    "alarm_type": "no_enough_exporter",
                    "alarm_summary": "service=OCP:svr_ip=xxx.xxx.xxx.xxx. The number of exporter processes is insufficient.",
                    "alarm_status": "Cleared",
                    "alarm_scope": "Host",
                    "alarm_active_at": "2020-12-03T09:44:04+08:00",
                    "alarm_target": "service=OCP:svr_ip=xxx.xxx.xxx.xxx",
                    "alarm_resolved_at": "2020-12-03T09:50:12+08:00",
                    "alarm_url": "http://xxx.xxx.xxx.xxx:8080/alarm/event/1000160",
                    "app": "OCP",
                    "actual_exporter_count": "5",
                    "alarm_is_build_in_rule": "true",
                    "host_ip": "xxx.xxx.xxx.xxx",
                    "alarm_duration": "0",
                    "recipients_uids": "",
                    "service": "OCP",
                    "alarm_description": "service=OCP:svr_ip=xxx.xxx.xxx.xxx. The number of exporter processes is insufficient. The deployed services OB_CLUSTER and OB_PROXY require 6 exporter processes, but the actual number of exporter processes is only 5.",
                    "alarm_updated_at": "2020-12-03T09:45:04+08:00",
                    "alarm_summary_2": "service=OCP:svr_ip=xxx.xxx.xxx.xxx exporter number not enough",
                    "alarm_summary_1": "service=OCP:svr_ip=xxx.xxx.xxx.xxx. The number of exporter processes is insufficient.",
                    "alarm_id": "1000160",
                    "alarm_summary_3": "service=OCP:svr_ip=xxx.xxx.xxx.xxx. The number of exporter processes is insufficient.",
                    "alarm_evaluation_interval": "60"
                },
                "level": 1,
                "message": "[Alert clearance notification]\n- Alert target service=OCP:svr_ip=xxx.xxx.xxx.xxx\n- Alert details service=OCP:svr_ip=xxx.xxx.xxx.xxx. The number of exporter processes is insufficient. When you deploy the OB_CLUSTER,OB_PROXY service, six exporter processes are required. However, only five exporters are available. 5\n- Clearance time 2020-12-03T09:50:12+08:00",
                "scope": "Host",
                "sentAt": "2020-12-03T01:50:13Z",
                "status": "Failed"
            },
            {
                "alarmIds": [
                    1000160
                ],
                "alarmType": "no_enough_exporter",
                "appType": "OCP",
                "channelId": 100000,
                "channelResponse": "\r\n{\"status\":1111,\"wait\":5,\"source\":\"x5\",\"punish\":\"deny\",\"uuid\":\"d6937ed81b2e15d7fbf103aae000631e\",\"errcode\": 130101,\"errmsg\": \"send too fast, exceed 20 times per minute\"}",
                "generatedAt": "2020-12-03T01:50:12Z",
                "id": 1001133,
                "isAggregated": false,
                "labels": {
                    "alarm_name": "Insufficient exporter processes",
                    "app_type": "OCP",
                    "alarm_level_color": "#722ED1",
                    "alarm_last_interval": "PT6M8.301194S",
                    "svr_ip": "xxx.xxx.xxx.xxx",
                    "alarm_description_3": "service=OCP:svr_ip=xxx.xxx.xxx.xxx. The number of exporter processes is insufficient.",
                    "host_services": "OB_CLUSTER,OB_PROXY",
                    "alarm_level": "Stopped",
                    "alarm_description_1": "service=OCP:svr_ip=xxx.xxx.xxx.xxx. The number of exporter processes is insufficient. The deployed services OB_CLUSTER and OB_PROXY require 6 exporter processes, but the actual number of exporter processes is only 5.",
                    "alarm_name_3": "Insufficient exporter processes",
                    "alarm_description_2": "service=OCP:svr_ip=xxx.xxx.xxx.xxx exporter number not enough, deployed services OB_CLUSTER,OB_PROXY,  expected exporter count 6, actual exporter count 5",
                    "alarm_name_2": "exporter number not enough",
                    "expected_exporter_count": "6",
                    "alarm_name_1": "Insufficient exporter processes",
                    "alarm_type": "no_enough_exporter",
                    "alarm_summary": "service=OCP:svr_ip=xxx.xxx.xxx.xxx. The number of exporter processes is insufficient.",
                    "alarm_status": "Cleared",
                    "alarm_scope": "Host",
                    "alarm_active_at": "2020-12-03T09:44:04+08:00",
                    "alarm_target": "service=OCP:svr_ip=xxx.xxx.xxx.xxx",
                    "alarm_resolved_at": "2020-12-03T09:50:12+08:00",
                    "alarm_url": "http://xxx.xxx.xxx.xxx:8080/alarm/event/1000160",
                    "app": "OCP",
                    "actual_exporter_count": "5",
                    "alarm_is_build_in_rule": "true",
                    "host_ip": "xxx.xxx.xxx.xxx",
                    "alarm_duration": "0",
                    "recipients_uids": "",
                    "service": "OCP",
                    "alarm_description": "service=OCP:svr_ip=xxx.xxx.xxx.xxx. The number of exporter processes is insufficient. The deployed services OB_CLUSTER and OB_PROXY require 6 exporter processes, but the actual number of exporter processes is only 5.",
                    "alarm_updated_at": "2020-12-03T09:45:04+08:00",
                    "alarm_summary_2": "service=OCP:svr_ip=xxx.xxx.xxx.xxx exporter number not enough",
                    "alarm_summary_1": "service=OCP:svr_ip=xxx.xxx.xxx.xxx. The number of exporter processes is insufficient.",
                    "alarm_id": "1000160",
                    "alarm_summary_3": "service=OCP:svr_ip=xxx.xxx.xxx.xxx. The number of exporter processes is insufficient.",
                    "alarm_evaluation_interval": "60"
                },
                "level": 1,
                "message": "[Alert clearance notification]\n- Alert target service=OCP:svr_ip=xxx.xxx.xxx.xxx\n- Alert details service=OCP:svr_ip=xxx.xxx.xxx.xxx. The number of exporter processes is insufficient. When you deploy the OB_CLUSTER,OB_PROXY service, six exporter processes are required. However, only five exporters are available. 5\n- Clearance time 2020-12-03T09:50:12+08:00",
                "scope": "Host",
                "sentAt": "2020-12-03T01:50:13Z",
                "status": "Success"
            }
        ],
        "page": {
            "number": 1,
            "size": 2,
            "totalElements": 1817,
            "totalPages": 909
        }
    },
    "duration": 4,
    "server": "a83ad33525",
    "status": 200,
    "successful": true,
    "timestamp": "2020-12-03T09:50:34.281+08:00",
    "traceId": "e61c62a983ae4a05"
}

Contact Us