0%

Ambari 告警相关接口

本文主要介绍一些常用的 Ambari 告警相关接口。

告警定义

Request URL:

1
https://"managerHostIp":"port"/api/v1/clusters/"clusterName"/alert_definitions?fields=AlertDefinition/component_name,AlertDefinition/description,AlertDefinition/enabled,AlertDefinition/repeat_tolerance,AlertDefinition/repeat_tolerance_enabled,AlertDefinition/id,AlertDefinition/ignore_host,AlertDefinition/interval,AlertDefinition/label,AlertDefinition/name,AlertDefinition/scope,AlertDefinition/service_name,AlertDefinition/source

Request Method: GET

参数解析:

参数 类型 描述
managerHostIp String 管理节点主机 IP
port String 端口号,默认为8080
clusterName String 集群名称

返回格式:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
"items" : [
{
"href" : "https://10.180.249.85:8080/api/v1/clusters/cluster_85/alert_definitions/1",
"AlertDefinition" : {
"cluster_name" : "cluster_85",
"component_name" : null,
"description" : "This alert is triggered if the number of down ZooKeeper servers in the cluster is greater than the configured critical threshold. It aggregates the results of ZooKeeper process checks.",
"enabled" : true,
"id" : 1,
"ignore_host" : false,
"interval" : 1,
"label" : "Percent ZooKeeper Servers Available",
"name" : "zookeeper_server_process_percent",
"repeat_tolerance" : 1,
"repeat_tolerance_enabled" : false,
"scope" : "SERVICE",
"service_name" : "ZOOKEEPER",
"source" : {
"alert_name" : "zookeeper_server_process",
"reporting" : {
"ok" : {
"text" : "affected: [{1}], total: [{0}]"
},
"warning" : {
"text" : "affected: [{1}], total: [{0}]",
"value" : 35.0
},
"critical" : {
"text" : "affected: [{1}], total: [{0}]",
"value" : 70.0
},
"units" : "%",
"type" : "PERCENT"
},
"type" : "AGGREGATE"
}
}
},
{
"href" : "https://10.180.249.85:8080/api/v1/clusters/cluster_85/alert_definitions/2",
"AlertDefinition" : {
"cluster_name" : "cluster_85",
"component_name" : "ZOOKEEPER_SERVER",
"description" : "This host-level alert is triggered if the ZooKeeper server process cannot be determined to be up and listening on the network.",
"enabled" : true,
"id" : 2,
"ignore_host" : false,
"interval" : 1,
"label" : "ZooKeeper Server Process",
"name" : "zookeeper_server_process",
"repeat_tolerance" : 1,
"repeat_tolerance_enabled" : false,
"scope" : "ANY",
"service_name" : "ZOOKEEPER",
"source" : {
"default_port" : 2181.0,
"parameters" : [
{
"name" : "socket.command",
"display_name" : "Socket Command",
"value" : "ruok",
"description" : "A socket command which queries ZooKeeper to respond with its state. The expected response is imok.",
"type" : "STRING",
"visibility" : "HIDDEN"
},
{
"name" : "socket.command.response",
"display_name" : "Expected Response",
"value" : "imok",
"description" : "The expected response to the socket command.",
"type" : "STRING",
"visibility" : "HIDDEN"
}
],
"reporting" : {
"ok" : {
"text" : "TCP OK - {0:.3f}s response on port {1}"
},
"warning" : {
"text" : "TCP OK - {0:.3f}s response on port {1}",
"value" : 1.5
},
"critical" : {
"text" : "Connection failed: {0} to {1}:{2}",
"value" : 5.0
}
},
"type" : "PORT",
"uri" : "{{zoo.cfg/clientPort}}"
}
}
},
……
]
}

返回字段说明:

名称 类型 描述
cluster_name String 集群名称
service_name String 服务名称
component_name String 服务中的组件名称
id int 告警定义 ID
name String 告警名称
description String 告警描述
label String 告警标签

示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
https://10.180.249.85:8080/api/v1/clusters/cluster_85/alert_definitions?fields=AlertDefinition/component_name,AlertDefinition/description,AlertDefinition/enabled,AlertDefinition/repeat_tolerance,AlertDefinition/repeat_tolerance_enabled,AlertDefinition/id,AlertDefinition/ignore_host,AlertDefinition/interval,AlertDefinition/label,AlertDefinition/name,AlertDefinition/scope,AlertDefinition/service_name,AlertDefinition/source

{
"href" : "https://10.180.249.85:8080/api/v1/clusters/cluster_85/alert_definitions?fields=AlertDefinition/component_name,AlertDefinition/description,AlertDefinition/enabled,AlertDefinition/repeat_tolerance,AlertDefinition/repeat_tolerance_enabled,AlertDefinition/id,AlertDefinition/ignore_host,AlertDefinition/interval,AlertDefinition/label,AlertDefinition/name,AlertDefinition/scope,AlertDefinition/service_name,AlertDefinition/source",
"items" : [
{
"href" : "https://10.180.249.85:8080/api/v1/clusters/cluster_85/alert_definitions/1",
"AlertDefinition" : {
"cluster_name" : "cluster_85",
"component_name" : null,
"description" : "This alert is triggered if the number of down ZooKeeper servers in the cluster is greater than the configured critical threshold. It aggregates the results of ZooKeeper process checks.",
"enabled" : true,
"id" : 1,
"ignore_host" : false,
"interval" : 1,
"label" : "Percent ZooKeeper Servers Available",
"name" : "zookeeper_server_process_percent",
"repeat_tolerance" : 1,
"repeat_tolerance_enabled" : false,
"scope" : "SERVICE",
"service_name" : "ZOOKEEPER",
"source" : {
"alert_name" : "zookeeper_server_process",
"reporting" : {
"ok" : {
"text" : "affected: [{1}], total: [{0}]"
},
"warning" : {
"text" : "affected: [{1}], total: [{0}]",
"value" : 35.0
},
"critical" : {
"text" : "affected: [{1}], total: [{0}]",
"value" : 70.0
},
"units" : "%",
"type" : "PERCENT"
},
"type" : "AGGREGATE"
}
}
},
{
"href" : "https://10.180.249.85:8080/api/v1/clusters/cluster_85/alert_definitions/2",
"AlertDefinition" : {
"cluster_name" : "cluster_85",
"component_name" : "ZOOKEEPER_SERVER",
"description" : "This host-level alert is triggered if the ZooKeeper server process cannot be determined to be up and listening on the network.",
"enabled" : true,
"id" : 2,
"ignore_host" : false,
"interval" : 1,
"label" : "ZooKeeper Server Process",
"name" : "zookeeper_server_process",
"repeat_tolerance" : 1,
"repeat_tolerance_enabled" : false,
"scope" : "ANY",
"service_name" : "ZOOKEEPER",
"source" : {
"default_port" : 2181.0,
"parameters" : [
{
"name" : "socket.command",
"display_name" : "Socket Command",
"value" : "ruok",
"description" : "A socket command which queries ZooKeeper to respond with its state. The expected response is imok.",
"type" : "STRING",
"visibility" : "HIDDEN"
},
{
"name" : "socket.command.response",
"display_name" : "Expected Response",
"value" : "imok",
"description" : "The expected response to the socket command.",
"type" : "STRING",
"visibility" : "HIDDEN"
}
],
"reporting" : {
"ok" : {
"text" : "TCP OK - {0:.3f}s response on port {1}"
},
"warning" : {
"text" : "TCP OK - {0:.3f}s response on port {1}",
"value" : 1.5
},
"critical" : {
"text" : "Connection failed: {0} to {1}:{2}",
"value" : 5.0
}
},
"type" : "PORT",
"uri" : "{{zoo.cfg/clientPort}}"
}
}
},
……
{
"href" : "https://10.180.249.85:8080/api/v1/clusters/cluster_85/alert_definitions/159",
"AlertDefinition" : {
"cluster_name" : "cluster_85",
"component_name" : "ELASTICSEARCH_MASTER",
"description" : "This host-level alert is triggered if the 9200 port is unreachable.",
"enabled" : true,
"id" : 159,
"ignore_host" : false,
"interval" : 1,
"label" : "Elasticsearch Port",
"name" : "elasticsearch_port",
"repeat_tolerance" : 1,
"repeat_tolerance_enabled" : false,
"scope" : "HOST",
"service_name" : "ELASTICSEARCH",
"source" : {
"default_port" : 9200.0,
"reporting" : {
"ok" : {
"text" : "TCP OK - {0:.3f}s response on port {1}"
},
"warning" : {
"text" : "TCP OK - {0:.3f}s response on port {1}",
"value" : 15.0
},
"critical" : {
"text" : "Connection failed: {0} to {1}:{2}",
"value" : 30.0
}
},
"type" : "PORT",
"uri" : "{{elasticsearch-config/http.port}}"
}
}
}
]
}

告警统计

Request URL:

1
https://"managerHostIp":"port"/api/v1/clusters/"clusterName"/alerts?format=groupedSummary

Request Method: GET

参数解析:

参数 类型 描述
managerHostIp String 管理节点主机 IP
port String 端口号,默认为8080
clusterName String 集群名称

返回格式:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{
"alerts_summary_grouped" : [
{
"definition_id" : 54,
"definition_name" : "sys db status",
"summary" : {
"OK" : {
"count" : 1,
"original_timestamp" : 1615195966242,
"maintenance_count" : 0,
"latest_text" : "OK - Sys DB and Information Schema created"
},
"WARNING" : {
"count" : 0,
"original_timestamp" : 0,
"maintenance_count" : 0
},
"CRITICAL" : {
"count" : 0,
"original_timestamp" : 0,
"maintenance_count" : 0
},
"UNKNOWN" : {
"count" : 0,
"original_timestamp" : 0,
"maintenance_count" : 0
}
}
},
{
"definition_id" : 104,
"definition_name" : "hbase_regionserver5_process_percent",
"summary" : {
"OK" : {
"count" : 0,
"original_timestamp" : 0,
"maintenance_count" : 0
},
"WARNING" : {
"count" : 0,
"original_timestamp" : 0,
"maintenance_count" : 0
},
"CRITICAL" : {
"count" : 1,
"original_timestamp" : 1634727929001,
"maintenance_count" : 0,
"latest_text" : "affected: [1], total: [1]"
},
"UNKNOWN" : {
"count" : 0,
"original_timestamp" : 0,
"maintenance_count" : 0
}
}
},

……
]
}

返回字段说明:

名称 类型 描述
definition_id int 告警定义 ID,对应“告警定义”接口返回值中的 “id” 值
definition_name String 告警名称,对应“告警定义”接口返回值中的 “name” 值
OK json 告警级别:正常
WARNING json 告警级别:警告
CRITICAL json 告警级别:严重
UNKNOWN json 告警级别:未知
count int 对应该告警级别的告警数量
original_timestamp long 出现该告警时的时间戳
maintenance_count int 服务处于维护模式下的告警数量
latest_text String 告警描述信息

示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
https://10.180.249.85:8080/api/v1/clusters/cluster_85/alerts?format=groupedSummary

{
"href" : "https://10.180.249.85:8080/api/v1/clusters/cluster_85/alerts?format=groupedSummary",
"alerts_summary_grouped" : [
{
"definition_id" : 54,
"definition_name" : "sys db status",
"summary" : {
"OK" : {
"count" : 1,
"original_timestamp" : 1615195966242,
"maintenance_count" : 0,
"latest_text" : "OK - Sys DB and Information Schema created"
},
"WARNING" : {
"count" : 0,
"original_timestamp" : 0,
"maintenance_count" : 0
},
"CRITICAL" : {
"count" : 0,
"original_timestamp" : 0,
"maintenance_count" : 0
},
"UNKNOWN" : {
"count" : 0,
"original_timestamp" : 0,
"maintenance_count" : 0
}
}
},
{
"definition_id" : 104,
"definition_name" : "hbase_regionserver5_process_percent",
"summary" : {
"OK" : {
"count" : 0,
"original_timestamp" : 0,
"maintenance_count" : 0
},
"WARNING" : {
"count" : 0,
"original_timestamp" : 0,
"maintenance_count" : 0
},
"CRITICAL" : {
"count" : 1,
"original_timestamp" : 1634727929001,
"maintenance_count" : 0,
"latest_text" : "affected: [1], total: [1]"
},
"UNKNOWN" : {
"count" : 0,
"original_timestamp" : 0,
"maintenance_count" : 0
}
}
},

……
]
}

告警列表

Request URL:

1
https://"managerHostIp":"port"/api/v1/clusters/"clusterName"/alerts?fields=Alert/component_name,Alert/definition_id,Alert/definition_name,Alert/host_name,Alert/id,Alert/instance,Alert/label,Alert/latest_timestamp,Alert/maintenance_state,Alert/original_timestamp,Alert/scope,Alert/service_name,Alert/state,Alert/text,Alert/repeat_tolerance,Alert/repeat_tolerance_remaining&Alert/state.in(CRITICAL,WARNING)&Alert/maintenance_state.in(OFF)&from="fromIndex"&page_size="PageSize"

Request Method: GET

参数解析:

参数 类型 描述
managerHostIp String 管理节点主机 IP
port String 端口号,默认为8080
clusterName String 集群名称
PageSize int 每页个数
fromIndex int 开始的索引号

返回格式:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{
"itemTotal" : "0",
"items" : [
{
"href" : "https://10.180.249.85:8080/api/v1/clusters/cluster_85/alerts/14",
"Alert" : {
"cluster_name" : "cluster_85",
"component_name" : "AMBARI_SERVER",
"definition_id" : 8,
"definition_name" : "ambari_server_component_version",
"host_name" : null,
"id" : 14,
"instance" : null,
"label" : "组件版本",
"latest_timestamp" : 1635212854190,
"maintenance_state" : "OFF",
"original_timestamp" : 1634633823462,
"repeat_tolerance" : 1,
"repeat_tolerance_remaining" : 0,
"scope" : "SERVICE",
"service_name" : "AMBARI",
"state" : "WARNING",
"text" : "如下组件的版本和所需版本不一致: \n worker.bigdata\n FLUME_HANDLER: UNKNOWN\n"
}
},
{
"href" : "https://10.180.249.85:8080/api/v1/clusters/cluster_85/alerts/163",
"Alert" : {
"cluster_name" : "cluster_85",
"component_name" : null,
"definition_id" : 103,
"definition_name" : "hbase_regionserver_process_percent",
"host_name" : null,
"id" : 163,
"instance" : null,
"label" : "Percent RegionServers Available",
"latest_timestamp" : 1634633605440,
"maintenance_state" : "OFF",
"original_timestamp" : 1634633605440,
"repeat_tolerance" : 1,
"repeat_tolerance_remaining" : 0,
"scope" : "SERVICE",
"service_name" : "HBASE",
"state" : "CRITICAL",
"text" : "affected: [1], total: [1]"
}
},
……

]
}

返回字段说明:

名称 类型 描述
cluster_name String 集群名称
service_name String 服务名称
component_name String 服务中的组件名称
definition_id int 告警定义 ID,对应“告警定义”接口返回值中的 “id” 值
definition_name String 告警名称,对应“告警定义”接口返回值中的 “name” 值
id int 该条告警的 ID 号(数据库告警表自增ID)
state String 告警级别:CRITICAL 或 WARNING
text String 告警描述

示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
https://10.180.249.85:8080/api/v1/clusters/cluster_85/alerts?fields=Alert/component_name,Alert/definition_id,Alert/definition_name,Alert/host_name,Alert/id,Alert/instance,Alert/label,Alert/latest_timestamp,Alert/maintenance_state,Alert/original_timestamp,Alert/scope,Alert/service_name,Alert/state,Alert/text,Alert/repeat_tolerance,Alert/repeat_tolerance_remaining&Alert/state.in(CRITICAL,WARNING)&Alert/maintenance_state.in(OFF)&from=0&page_size=100

{
"href" : "https://10.180.249.85:8080/api/v1/clusters/cluster_85/alerts?fields=Alert/component_name,Alert/definition_id,Alert/definition_name,Alert/host_name,Alert/id,Alert/instance,Alert/label,Alert/latest_timestamp,Alert/maintenance_state,Alert/original_timestamp,Alert/scope,Alert/service_name,Alert/state,Alert/text,Alert/repeat_tolerance,Alert/repeat_tolerance_remaining&Alert/state.in(CRITICAL,WARNING)&Alert/maintenance_state.in(OFF)&from=0&page_size=100",
"itemTotal" : "0",
"items" : [
{
"href" : "https://10.180.249.85:8080/api/v1/clusters/cluster_85/alerts/14",
"Alert" : {
"cluster_name" : "cluster_85",
"component_name" : "AMBARI_SERVER",
"definition_id" : 8,
"definition_name" : "ambari_server_component_version",
"host_name" : null,
"id" : 14,
"instance" : null,
"label" : "组件版本",
"latest_timestamp" : 1635212854190,
"maintenance_state" : "OFF",
"original_timestamp" : 1634633823462,
"repeat_tolerance" : 1,
"repeat_tolerance_remaining" : 0,
"scope" : "SERVICE",
"service_name" : "AMBARI",
"state" : "WARNING",
"text" : "如下组件的版本和所需版本不一致: \n worker.bigdata\n FLUME_HANDLER: UNKNOWN\n"
}
},
{
"href" : "https://10.180.249.85:8080/api/v1/clusters/cluster_85/alerts/163",
"Alert" : {
"cluster_name" : "cluster_85",
"component_name" : null,
"definition_id" : 103,
"definition_name" : "hbase_regionserver_process_percent",
"host_name" : null,
"id" : 163,
"instance" : null,
"label" : "Percent RegionServers Available",
"latest_timestamp" : 1634633605440,
"maintenance_state" : "OFF",
"original_timestamp" : 1634633605440,
"repeat_tolerance" : 1,
"repeat_tolerance_remaining" : 0,
"scope" : "SERVICE",
"service_name" : "HBASE",
"state" : "CRITICAL",
"text" : "affected: [1], total: [1]"
}
},
……

]
}

某个主机上的告警

Request URL:

1
https://"managerHostIp":"port"/api/v1/clusters/"clusterName"/alerts?fields=*&Alert/host_name="hostName"

Request Method: GET

参数解析:

参数 类型 描述
managerHostIp String 管理节点主机 IP
port String 端口号,默认为8080
clusterName String 集群名称
hostName String 主机名

返回格式:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{
"items" : [
{
"Alert" : {
"cluster_name" : "cluster_85",
"component_name" : "AMBARI_AGENT",
"definition_id" : 3,
"definition_name" : "ambari_agent_ulimit",
"firmness" : "HARD",
"host_name" : "worker.bigdata",
"id" : 2,
"instance" : null,
"label" : "Ulimit for open files",
"latest_timestamp" : 1633916903489,
"maintenance_state" : "OFF",
"occurrences" : 5,
"original_timestamp" : 1608699076404,
"repeat_tolerance" : 1,
"repeat_tolerance_remaining" : 0,
"scope" : "HOST",
"service_name" : "AMBARI",
"state" : "OK",
"text" : "Ulimit for open files (-n) is 1024"
}
},
{
"Alert" : {
"cluster_name" : "cluster_85",
"component_name" : "HBASE_REGIONSERVER1",
"definition_id" : 110,
"definition_name" : "hbase_regionserver1_process",
"firmness" : "HARD",
"host_name" : "worker.bigdata",
"id" : 154,
"instance" : null,
"label" : "HBase RegionServer1 Process",
"latest_timestamp" : 1634727803926,
"maintenance_state" : "OFF",
"occurrences" : 1,
"original_timestamp" : 1634727803926,
"repeat_tolerance" : 1,
"repeat_tolerance_remaining" : 0,
"scope" : "HOST",
"service_name" : "HBASE",
"state" : "CRITICAL",
"text" : "Connection failed: [Errno 111] Connection refused to worker.bigdata:16031"
}
},
……
]
}

返回字段说明:

名称 类型 描述
cluster_name String 集群名称
service_name String 服务名称
component_name String 服务中的组件名称
definition_id int 告警定义 ID,对应“告警定义”接口返回值中的 “id” 值
definition_name String 告警名称,对应“告警定义”接口返回值中的 “name” 值
id int 该条告警的 ID 号(数据库告警表自增ID)
state String 告警级别:CRITICAL 或 WARNING
text String 告警描述

示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
https://10.180.249.85:8080/api/v1/clusters/cluster_85/alerts?fields=*&Alert/host_name=worker.bigdata

{
"href" : "https://10.180.249.85:8080/api/v1/clusters/cluster_85/alerts?fields=*&Alert/host_name=worker.bigdata",
"items" : [
{
"href" : "https://10.180.249.85:8080/api/v1/clusters/cluster_85/alerts/2",
"Alert" : {
"cluster_name" : "cluster_85",
"component_name" : "AMBARI_AGENT",
"definition_id" : 3,
"definition_name" : "ambari_agent_ulimit",
"firmness" : "HARD",
"host_name" : "worker.bigdata",
"id" : 2,
"instance" : null,
"label" : "Ulimit for open files",
"latest_timestamp" : 1633916903489,
"maintenance_state" : "OFF",
"occurrences" : 5,
"original_timestamp" : 1608699076404,
"repeat_tolerance" : 1,
"repeat_tolerance_remaining" : 0,
"scope" : "HOST",
"service_name" : "AMBARI",
"state" : "OK",
"text" : "Ulimit for open files (-n) is 1024"
}
},
{
"href" : "https://10.180.249.85:8080/api/v1/clusters/cluster_85/alerts/154",
"Alert" : {
"cluster_name" : "cluster_85",
"component_name" : "HBASE_REGIONSERVER1",
"definition_id" : 110,
"definition_name" : "hbase_regionserver1_process",
"firmness" : "HARD",
"host_name" : "worker.bigdata",
"id" : 154,
"instance" : null,
"label" : "HBase RegionServer1 Process",
"latest_timestamp" : 1634727803926,
"maintenance_state" : "OFF",
"occurrences" : 1,
"original_timestamp" : 1634727803926,
"repeat_tolerance" : 1,
"repeat_tolerance_remaining" : 0,
"scope" : "HOST",
"service_name" : "HBASE",
"state" : "CRITICAL",
"text" : "Connection failed: [Errno 111] Connection refused to worker.bigdata:16031"
}
},
……
]
}

某个告警详情

Request URL:

1
https://"managerHostIp":"port"/api/v1/clusters/"clusterName"/alerts?fields=*&Alert/definition_id="definitionId"

Request Method: GET

参数解析:

参数 类型 描述
managerHostIp String 管理节点主机 IP
port String 端口号,默认为8080
clusterName String 集群名称
definitionId int 告警定义 ID

返回格式:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
"items" : [
{
"Alert" : {
"cluster_name" : "cluster_85",
"component_name" : "HBASE_REGIONSERVER5",
"definition_id" : 106,
"definition_name" : "hbase_regionserver5_process",
"firmness" : "HARD",
"host_name" : "worker.bigdata",
"id" : 157,
"instance" : null,
"label" : "HBase RegionServer5 Process",
"latest_timestamp" : 1634727923955,
"maintenance_state" : "OFF",
"occurrences" : 1,
"original_timestamp" : 1634727923955,
"repeat_tolerance" : 1,
"repeat_tolerance_remaining" : 0,
"scope" : "HOST",
"service_name" : "HBASE",
"state" : "CRITICAL",
"text" : "Connection failed: [Errno 111] Connection refused to worker.bigdata:16035"
}
}
]
}

返回字段说明:

名称 类型 描述
cluster_name String 集群名称
service_name String 服务名称
component_name String 服务中的组件名称
definition_id int 告警定义 ID,对应“告警定义”接口返回值中的 “id” 值
definition_name String 告警名称,对应“告警定义”接口返回值中的 “name” 值
id int 该条告警的 ID 号(数据库告警表自增ID)
state String 告警级别:CRITICAL 或 WARNING
text String 告警描述

示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
https://10.180.249.85:8080/api/v1/clusters/cluster_85/alerts?fields=*&Alert/definition_id=106

{
"href" : "https://10.180.249.85:8080/api/v1/clusters/cluster_85/alerts?fields=*&Alert/definition_id=106",
"items" : [
{
"href" : "https://10.180.249.85:8080/api/v1/clusters/cluster_85/alerts/157",
"Alert" : {
"cluster_name" : "cluster_85",
"component_name" : "HBASE_REGIONSERVER5",
"definition_id" : 106,
"definition_name" : "hbase_regionserver5_process",
"firmness" : "HARD",
"host_name" : "worker.bigdata",
"id" : 157,
"instance" : null,
"label" : "HBase RegionServer5 Process",
"latest_timestamp" : 1634727923955,
"maintenance_state" : "OFF",
"occurrences" : 1,
"original_timestamp" : 1634727923955,
"repeat_tolerance" : 1,
"repeat_tolerance_remaining" : 0,
"scope" : "HOST",
"service_name" : "HBASE",
"state" : "CRITICAL",
"text" : "Connection failed: [Errno 111] Connection refused to worker.bigdata:16035"
}
}
]
}