メインコンテンツまでスキップ

Update Alert Rule

Updates an existing alert rule by its ID. The current user should be a project admin.

PUT
/v2/alertRules/{ALERT_RULE_ID}
Cluster Endpoint

The base URL for this API is in the following format:

https://${CLUSTER_ENDPOINT}

📘Notes
  • You need to fill in ${CLUSTER_ENDPOINT} with that of your Zilliz Cloud cluster.
  • To get the endpoint, use the Describe Cluster V2 API to extract the values from the responses.
export CLUSTER_ENDPOINT=""
Parameters
Authorizationstringheaderrequired

The authentication token should be an API key with appropriate privileges.

Example Value: Bearer {{TOKEN}}
ALERT_RULE_IDstringpathrequired

The ID of the alert rule to update.

Example Value: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Request Bodyapplication/json
projectIdstringrequired

The ID of the project to which the alert rule belongs.

ruleNamestringrequired

The name of the alert rule.

levelstringrequired

The level of the alert rule.

metricNamestringrequired

The name of the metric that the alert rule monitors.

thresholdstring

The threshold value of the alert rule.

windowSizestring

The time window for the alert rule in minutes.

comparisonOperatorstring

The comparison operator used in the alert rule.

targetClusterIdsarray

The IDs of the clusters to which the alert rule applies.

[]targetClusterIdsstring

The ID of the cluster.

enabledbooleanrequired

Indicates whether the alert rule is enabled.

sendResolvedbooleanrequired

Indicates whether to send notifications when the alert rule is resolved.

actionsarrayrequired

The actions to take when the alert rule is triggered.

[]actionsobjectrequired

An action to take when the alert rule is triggered.

typestringrequired

The type of the action.

configobjectrequired

The configuration for the action.

recipientsobject

The recipients of the alert notification. This applies only when the action type is EMAIL and SMS.

membersarray

A list of email addresses to receive the alert notification.

[]membersstring

An email address to receive the alert notification.

orgRolesarray

A list of organization roles to receive the alert notification.

[]orgRolesstring

An organization role to receive the alert notification.

projectRolesarray

A list of project roles to receive the alert notification.

[]projectRolesstring

A project role to receive the alert notification.

urlstring

The URL to which the alert notification should be sent. This applies only when the action type is WEBHOOK.

webhookUrlstring

The URL to which the alert notification should be sent. This applies only when the action type is SLACK, LARK, and WECOM.

regionstring

The region where your PagerDuty or OpsGenie service is located. This applies only when the action type is PAGERDUTY and OPSGENIE.

apiKeystring

The API key for your PagerDuty or OpsGenie service. This applies only when the action type is PAGERDUTY and OPSGENIE.

export TOKEN="db_admin:xxxxxxxxxxxxx"
export ALERT_RULE_ID="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

curl --request PUT \
--url "${CLUSTER_ENDPOINT}/v2/alertRules/${ALERT_RULE_ID}" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json" \
-d '{
"id": "12391290837zs09sad0d09123",
"projectId": "proj-b44a39b0c51cf21791a841",
"ruleName": "my alert name",
"level": "CRITICAL",
"metricName": "REQUEST_LATENCY_SEARCH_P99",
"threshold": "70",
"windowSize": "10",
"comparisonOperator": "GREATER_THAN",
"targetClusterIds": [
"in01-xxxxxxxxxxxx"
],
"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": "..."
}
}
]
}'
Responses200 - application/json

Returns a list of alert rules.

codeinteger

Response code.

dataobject
idstring

The ID of the alert rule.

projectIdstring

The ID of the project to which the alert rule belongs.

ruleNamestring

The name of the alert rule.

levelstring

The level of the alert rule.

metricNamestring

The name of the metric that the alert rule monitors.

thresholdstring

The threshold value of the alert rule.

windowSizestring

The time window for the alert rule in minutes.

comparisonOperatorstring

The comparison operator used in the alert rule.

targetClusterIdsarray

The IDs of the clusters to which the alert rule applies.

[]targetClusterIdsstring

The ID of the cluster.

enabledboolean

Indicates whether the alert rule is enabled.

sendResolvedboolean

Indicates whether to send notifications when the alert rule is resolved.

actionsarray

The actions to take when the alert rule is triggered.

[]actionsobject

An action to take when the alert rule is triggered.

typestring

The type of the action.

configobject

The configuration for the action.

recipientsobject

The recipients of the alert notification. This applies only when the action type is EMAIL and SMS.

membersarray

A list of email addresses to receive the alert notification.

[]membersstring

An email address to receive the alert notification.

orgRolesarray

A list of organization roles to receive the alert notification.

[]orgRolesstring

An organization role to receive the alert notification.

projectRolesarray

A list of project roles to receive the alert notification.

[]projectRolesstring

A project role to receive the alert notification.

urlstring

The URL to which the alert notification should be sent. This applies only when the action type is WEBHOOK.

webhookUrlstring

The URL to which the alert notification should be sent. This applies only when the action type is SLACK, LARK, and WECOM.

regionstring

The region where your PagerDuty or OpsGenie service is located. This applies only when the action type is PAGERDUTY and OPSGENIE.

apiKeystring

The API key for your PagerDuty or OpsGenie service. This applies only when the action type is PAGERDUTY and OPSGENIE.

Returns an error message.

codeinteger

Response code.

messagestring

Error message.

{
"code": 0,
"data": {
"id": "12391290837zs09sad0d09123",
"projectId": "proj-b44a39b0c51cf21791a841",
"ruleName": "my alert name",
"level": "CRITICAL",
"metricName": "REQUEST_LATENCY_SEARCH_P99",
"threshold": "70",
"windowSize": "10",
"comparisonOperator": "GREATER_THAN",
"targetClusterIds": [
"in01-xxxxxxxxxxxx"
],
"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": "..."
}
}
]
}
}