查看告警规则列表 (V2)
本接口列出指定项目的所有告警规则。当前用户须为项目管理员。
GET/v2/alertRules
该 API 的 Base URL 格式如下:
https://api.cloud.zilliz.com
📘说明
控制面接口速率限制为单用户单接口每秒最多 20 个请求。
shell
export BASE_URL="https://api.cloud.zilliz.com"
参数
Authorizationstringheader必填项
认证令牌,应为具备适当权限的 API 密钥。
示例值:Bearer {{TOKEN}}
projectIdstringquery必填项
告警规则所属项目 ID。
示例值:proj-xxxxxxxxxxxxxxxxxxxxxx
pageSizeintegerquery
每页返回的项目数量。
示例值:10
currentPageintegerquery
要返回的页码。
示例值:1
bash
export TOKEN="YOUR_API_KEY"
curl --request GET \
--url "${BASE_URL}/v2/alertRules?projectId=proj-xxxxxxxxxxxxxxxxxxxxxx" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Request-Timeout: 5" \
--header "Content-Type: application/json"
响应200 OK - application/json
返回指定项目的所有告警规则列表。
返回告警规则列表。
codeinteger<int32>
响应码。
dataobject
告警规则请求的响应载荷。
countinteger<int32>
告警规则总数。
currentPageinteger<int32>
当前页码。
pageSizeinteger<int32>
每页记录数。
alertRulesarray
告警规则列表。
[]alertRulesobject
列表中返回的一条告警规则。
idstring
告警规则 ID。
orgIdstring
该告警规则所属组织的 ID。
projectIdstring
告警规则所属项目 ID。
enabledboolean
告警规则是否启用。
sendResolvedboolean
告警规则是否发送已解决的通知。
levelstring
告警规则级别。
ruleNamestring
告警规则名称。
metricNamestring
告警规则监控的指标名称。
metricUnitstring
被监控指标的单位。
windowSizestring
告警规则的时间窗口,单位为分钟。
thresholdstring
告警规则阈值。
comparisonMethodstring
告警规则使用的比较运算符。
targetInstanceIdsarray
告警规则适用的集群 ID 列表。
[]targetInstanceIdsstring
集群 ID。
actionsarray
触发告警规则时采取的操作列表。
[]actionsobject
触发告警规则时采取的操作。
typestring必填项
操作类型。
configobject必填项
操作配置。
repeatIntervalSecondsinteger<int32>
告警通知的重复间隔(秒)。
返回错误消息。
codeinteger
响应码。
messagestring
错误描述。
Successjson
{
"code": 0,
"data": {
"count": 1,
"currentPage": 1,
"pageSize": 10,
"alertRules": [
{
"id": "12391290837zs09sad0d09123",
"projectId": "proj-b44a39b0c51cf21791a841",
"ruleName": "my alert name",
"level": "CRITICAL|WARNING",
"metricName": "REQUEST_LATENCY_SEARCH_P99",
"threshold": "70",
"windowSize": "10",
"comparisonMethod": "GREATER_THAN",
"enabled": true,
"sendResolved": true,
"actions": [
{
"type": "EMAIL",
"config": {
"recipients": {
"members": [
"your-email@your-org.com"
],
"orgRoles": [
"OWNER",
"MEMBER",
"BILLING_ADMIN"
],
"projectRoles": [
"OWNER",
"MEMBER"
]
}
}
},
{
"type": "SMS",
"config": {
"recipients": {
"members": [
"your-email@your-org.com"
],
"orgRoles": [
"OWNER",
"MEMBER",
"BILLING_ADMIN"
],
"projectRoles": [
"OWNER",
"MEMBER"
]
}
}
},
{
"type": "WEBHOOK",
"config": {
"url": "https://xxxx"
}
},
{
"type": "SLACK",
"config": {
"webhookUrl": "https://xxxx"
}
},
{
"type": "LARK",
"config": {
"webhookUrl": "https://xxxx"
}
},
{
"type": "WECOM",
"config": {
"webhookUrl": "https://xxxx"
}
},
{
"type": "PAGERDUTY",
"config": {
"region": "US",
"apiKey": "..."
}
},
{
"type": "OPSGENIE",
"config": {
"region": "US",
"apiKey": "..."
}
}
],
"targetInstanceIds": [
"in01-xxxxxxxxxxxx"
]
}
]
}
}