查看告警规则列表 (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
响应码。
dataobject
countinteger
告警规则总数。
currentPageinteger
当前页码。
pageSizeinteger
每页记录数。
alertRulesarray
告警规则列表。
[]alertRulesobject
idstring
告警规则 ID。
projectIdstring
告警规则所属项目 ID。
ruleNamestring
告警规则名称。
levelstring
告警规则级别。
metricNamestring
告警规则监控的指标名称。
thresholdstring
告警规则阈值。
windowSizestring
告警规则的时间窗口,单位为分钟。
enabledboolean
告警规则是否启用。
sendResolvedboolean
告警规则是否发送已解决的通知。
actionsarray
触发告警规则时采取的操作列表。
[]actionsobject
触发告警规则时采取的操作。
typestring
操作类型。
configobject
操作配置。
recipientsobject
告警通知的接收者。仅当操作类型为 EMAIL 和 SMS 时适用。
membersarray
用于接收通知的邮件地址列表。
[]membersstring
用于接收通知的邮件地址。
orgRolesarray
用于接收通知的组织角色列表。
[]orgRolesstring
用于接收通知的组织角色。
projectRolesarray
用于接收通知的项目角色列表。
[]projectRolesstring
用于接收通知的项目角色。
urlstring
告警通知应发送到的 URL。仅当操作类型为 WEBHOOK 时适用。
webhookUrlstring
告警通知应发送到的 URL。仅当操作类型为 SLACK、LARK、WECOM 时适用。
regionstring
您的 PagerDuty 或 OpsGenie 服务所在的区域。仅当操作类型为 PAGERDUTY 和 OPSGENIE 时适用。
apiKeystring
您的 PagerDuty 或 OpsGenie 服务的 API 密钥。仅当操作类型为 PAGERDUTY 和 OPSGENIE 时适用。
comparisonMethodstring
告警规则使用的比较运算符。
targetInstanceIdsarray
告警规则适用的集群 ID 列表。
[]targetInstanceIdsstring
集群 ID。
返回错误消息。
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"
]
}
]
}
}