Create Alert Rule (V2)
Creates a new alert rule in the specified project. The current user should be a project admin.
The base URL for this API is in the following format:
https://api.cloud.zilliz.com
The endpoints on the control plane currently supports up to 20 requests per second per user per endpoint.
export BASE_URL="https://api.cloud.zilliz.com"
The authentication token should be an API key with appropriate privileges.
Use application/json.
The ID of the project to which the alert rule belongs.
The name of the alert rule.
The level of the alert rule.
The name of the metric that the alert rule monitors.
The threshold value of the alert rule.
The time window for the alert rule in minutes.
Indicates whether the alert rule is enabled.
Indicates whether to send notifications when the alert rule is resolved.
The actions to take when the alert rule is triggered.
An action to take when the alert rule is triggered.
The type of the action.
The configuration for the action.
The comparison operator used in the alert rule.
The IDs of the clusters to which the alert rule applies.
The ID of the cluster.
The unit of the metric (e.g., "bytes", "percent").
The interval in seconds between repeated alert notifications.
export TOKEN="YOUR_API_KEY"
curl --request POST \
--url "${BASE_URL}/v2/alertRules" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Accept: application/json" \
--header "Request-Timeout: 5" \
--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",
"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": "..."
}
}
],
"comparisonMethod": "GREATER_THAN"
}'
Returns a list of alert rules in the specified project.
Returns a list of alert rules.
Response code.
Response payload for the alert rule creation request.
The ID of the alert rule.
The ID of the organization this alert rule belongs to.
The ID of the project to which the alert rule belongs.
Indicates whether the alert rule is enabled.
Indicates whether to send notifications when the alert rule is resolved.
The level of the alert rule.
The name of the alert rule.
The name of the metric that the alert rule monitors.
The unit of the monitored metric.
The time window for the alert rule in minutes.
The threshold value of the alert rule.
The comparison operator used in the alert rule.
The IDs of the clusters to which the alert rule applies.
The ID of the cluster.
The actions to take when the alert rule is triggered.
An action to take when the alert rule is triggered.
The type of the action.
The configuration for the action.
Repeat interval in seconds for alert notifications
Returns an error message.
Response code.
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",
"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": "..."
}
}
],
"comparisonMethod": "GREATER_THAN",
"targetInstanceIds": [
"in01-xxxxxxxxxxxx"
]
}
}