查看告警模板列表
请求信息
请求行
GET /apis/aiops.alauda.io/v1beta1/alerttemplates
查看所有类型为 AlertTemplate 的资源的列表。
请求参数
名称 | 类型 | 是否必填项 | 描述 |
---|---|---|---|
allowWatchBookmarks | boolean | 否 | allowWatchBookmarks 请求使用 BOOKMARK 类型监视事件。没有实现书签的服务器可能会忽略此标志,而书签是由服务器自行发送的。客户端不应该假定书签在任何特定的间隔被返回,也不应该假定服务器将在会话期间发送任何 BOOKMARK 事件。如果这不是 watch 请求,这个字段将被忽略。如果在 apiserver 中未启用特性门 WatchBookmarks,则忽略该字段。 |
continue | string | 否 | 服务器定义的值,⽤于从服务器中查询更多的返回结果。客户端只能从上⼀个查询结果中获取该值。当查询列表时设置了limit 参数,返回结果未包含服务器上可以查询到的所有数据,此时,会返回 continue 参数,并为 continue 参数赋值⼀个 Token。需要查询更多返回结果时,可将 continue 参数及其值作为查询参数查询更多结果。说明:如果列表配置发⽣变化或查询过期,输⼊此查询参数后,会返回 410 错误码,如果继续输⼊该查询参数进⾏查询,返回的查询结果可能不是最新的数据。 |
fieldSelector | string | 否 | 字段选择器,可通过资源对象的字段过滤、筛选资源对象,默认返回所有资源对象。 |
labelSelector | string | 否 | 标签选择器,可通过标签过滤、筛选资源对象,默认返回所有资源对象。 |
limit | integer | 否 | limit 是查询列表请求返回的最大响应数。 如果存在更多项,则服务器会将列表元数据上的 “continue” 字段设置为一个值,该值可与相同的初始查询一起使用用来检索下一组结果。如果所有请求的对象都被过滤掉了,则设置的限制返回的项目数可能少于请求的项目数(最多为零),并且客户端应仅使用 continue 字段的存在来确定是否有更多结果可用。服务器可能选择不支持 limit 参数,并将返回所有可用结果。如果指定了限制,并且 continue 字段为空,则客户端可能会认为没有更多结果可用。如果 watch 为 true,则不支持此字段。 服务器保证使用 continue 时返回的对象与发出单个列表调用无限制地相同,也就是说,在发出第一个请求后,任何创建、修改或删除的对象都不会包含在任何后续的继续请求中。有时这被称为一致快照,并确保使用限制接收非常大结果的较小块的客户端可以确保它们看到所有可能的对象。如果在分块列表期间更新对象,则将返回在计算第一个列表结果时存在的对象版本。 |
resourceVersion | string | 否 | 当指定使用 watch 请求时,将显示在资源的特定版本之后发生的更改。默认从历史开始更改。当为 list 指定时:-如果未设置,则基于 quora -read 标志从远程存储返回结果;-如果它是 0,那么我们只是返回我们目前在缓存,没有保证;-如果设置为非零,那么结果至少与给定的 resourceVersion 一样为最新的值。 |
timeoutSeconds | integer | 否 | list/watch 方法的调用超时时长。这限制了调用的持续时间,不管是否活跃。 |
watch | boolean | 否 | 观察对所描述的资源的更改,并将其作为添加、更新和删除通知的流返回。需要指定 resourceVersion。 |
pretty | string | 否 | 如果为 true,则会将返回结果输出成适合打印的格式。 |
返回信息
Content-Type
application/json
,
application/yaml
状态码: 200
OK
返回体示例
告警模板的列表。
{
"apiVersion": "aiops.alauda.io/v1beta1",
"items": [
{
"apiVersion": "aiops.alauda.io/v1beta1",
"kind": "AlertTemplate",
"metadata": {
"annotations": {
"alert.cpaas.io/notifications": "[]",
"cpaas.io/creator": "lhsun",
"cpaas.io/description": "告警模板的描述",
"cpaas.io/updated-at": "2021-06-15T06:28:23Z"
},
"creationTimestamp": "2021-06-15T06:24:18Z",
"generation": 2,
"labels": {
"cpaas.io/kind": "cluster"
},
"managedFields": [
{
"apiVersion": "aiops.alauda.io/v1beta1",
"fieldsType": "FieldsV1",
"fieldsV1": {
"f:metadata": {
"f:annotations": {
".": {},
"f:alert.cpaas.io/notifications": {},
"f:cpaas.io/description": {},
"f:cpaas.io/updated-at": {}
},
"f:labels": {
".": {},
"f:cpaas.io/kind": {}
}
},
"f:spec": {
".": {},
"f:templates": {}
}
},
"manager": "Mozilla",
"operation": "Update",
"time": "2021-06-15T06:28:23Z"
}
],
"name": "ad",
"resourceVersion": "16896017",
"selfLink": "/apis/aiops.alauda.io/v1beta1/alerttemplates/ad",
"uid": "35c6d8ef-7f6a-4721-899c-818fdbd0a1b1"
},
"spec": {
"templates": [
{
"annotations": {},
"compare": "\u003e",
"expr": "",
"labels": {
"severity": "High"
},
"metric": {
"queries": [
{
"aggregator": "min",
"labels": [
{
"name": "__name__",
"type": "EQUAL",
"value": "cluster.cpu.utilization"
}
],
"range": 120
}
]
},
"metric_name": "cluster.cpu.utilization",
"name": "cluster.cpu.utilization-q9ld6",
"notifications": [],
"query": "",
"threshold": 0.01,
"wait": 30
}
]
}
},
{
"apiVersion": "aiops.alauda.io/v1beta1",
"kind": "AlertTemplate",
"metadata": {
"annotations": {
"alert.cpaas.io/notifications": "[]",
"cpaas.io/creator": "admin@cpaas.io",
"cpaas.io/description": "",
"cpaas.io/updated-at": "2021-06-10T02:50:48Z"
},
"creationTimestamp": "2021-06-10T02:50:48Z",
"generation": 1,
"labels": {
"cpaas.io/kind": "cluster"
},
"managedFields": [
{
"apiVersion": "aiops.alauda.io/v1beta1",
"fieldsType": "FieldsV1",
"fieldsV1": {
"f:metadata": {
"f:annotations": {
".": {},
"f:alert.cpaas.io/notifications": {},
"f:cpaas.io/description": {}
},
"f:labels": {
".": {},
"f:cpaas.io/kind": {}
}
},
"f:spec": {
".": {},
"f:templates": {}
}
},
"manager": "Mozilla",
"operation": "Update",
"time": "2021-06-10T02:50:48Z"
}
],
"name": "test",
"resourceVersion": "8435436",
"selfLink": "/apis/aiops.alauda.io/v1beta1/alerttemplates/test",
"uid": "9eda692f-1483-4fec-8017-c5a908a961ec"
},
"spec": {
"templates": [
{
"annotations": {},
"compare": "\u003e",
"labels": {
"severity": "High"
},
"metric": {
"queries": [
{
"aggregator": "origin",
"labels": [
{
"name": "__name__",
"type": "EQUAL",
"value": "cluster.cpu.utilization"
}
],
"range": 0
}
]
},
"metric_name": "cluster.cpu.utilization",
"name": "cluster.cpu.utilization-lxijs",
"notifications": [],
"query": "",
"threshold": 0.5,
"wait": 30
}
]
}
}
],
"kind": "AlertTemplateList",
"metadata": {
"continue": "",
"resourceVersion": "32362594",
"selfLink": "/apis/aiops.alauda.io/v1beta1/alerttemplates"
}
}
返回体说明
名称 | 类型 | 描述 |
---|---|---|
apiVersion | string | 查看公共参数 |
items | array |
告警模板的列表。 更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md
字段路径:items |
items[] | object |
AlertTemplate 是 AlertTemplate API 的结构。
字段路径:items[] |
items[].apiVersion | string | 查看公共参数 |
items[].kind | string | 查看公共参数 |
items[].metadata | object | 查看公共参数 |
items[].spec | object |
spec 包含了模板资源的规范参数。
字段路径:items[].spec |
spec.templates | array |
告警模板的列表。
字段路径:items[].spec.templates |
spec.templates[] | object |
模板项。
字段路径:items[].spec.templates[] |
templates[].compare | string |
模板对比信息。
字段路径:items[].spec.templates[].compare |
templates[].metric | object |
告警的指标信息。
字段路径:items[].spec.templates[].metric |
metric.queries | array |
指标的查询条件。
字段路径:items[].spec.templates[].metric.queries |
metric.queries[] | object |
查询项。
字段路径:items[].spec.templates[].metric.queries[] |
queries[].aggregator | string |
聚合方式。⽀持以下几种⽅方式:avg:平均值;max:最⼤值;min:最小值。
字段路径:items[].spec.templates[].metric.queries[].aggregator |
queries[].labels | array |
告警对象的标签。由键、值组成的监控数据查询条件。
字段路径:items[].spec.templates[].metric.queries[].labels |
queries[].labels[] | object |
查询到的标签项。
字段路径:items[].spec.templates[].metric.queries[].labels[] |
labels[].name | string |
组合查询条件中包含的键。
字段路径:items[].spec.templates[].metric.queries[].labels[].name |
labels[].value | string |
组合查询条件中键对应的值,为资源对象的实际属性值。
字段路径:items[].spec.templates[].metric.queries[].labels[].value |
queries[].range | integer |
聚合时间,单位:秒。与聚合算法配合使用,默认为 60s,即使用查询时间前 60 秒内数据进行聚合。
字段路径:items[].spec.templates[].metric.queries[].range |
templates[].name | string |
告警范围。
字段路径:items[].spec.templates[].name |
templates[].notifications | array |
被该告警触发的通知的信息。
字段路径:items[].spec.templates[].notifications |
templates[].threshold | number |
告警阈值。
字段路径:items[].spec.templates[].threshold |
templates[].wait | integer |
持续时间,单位:秒。
字段路径:items[].spec.templates[].wait |
kind | string | 查看公共参数 |
metadata | object | 查看公共参数 |