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

アラートルールを作成する (V2)

指定したプロジェクトに新しいアラートルールを作成します。現在のユーザーはプロジェクト管理者である必要があります。

POST/v2/alertRules
接続エンドポイント

このAPIのBase URLは以下の形式です:

https://api.cloud.zilliz.com

📘ノート

コントロールプレーンのエンドポイントは現在、ユーザーごと・エンドポイントごとに毎秒最大20リクエストまでサポートしています。

shell
export BASE_URL="https://api.cloud.zilliz.com"
パラメータ
Authorizationstringheader必要

認証トークンには、適切な権限を持つ API key を使用する必要があります。

値の例: Bearer {{TOKEN}}
Acceptstringheader

application/json を使用します。

値の例: application/json
リクエスト・ボディ
projectIdstring必要

アラートルールが属するプロジェクトの ID。

ruleNamestring必要

アラートルールの名前。

levelstring必要

アラートルールのレベル。

metricNamestring必要

アラートルールが監視するメトリクスの名前。

thresholdstring

アラートルールのしきい値。

windowSizestring

アラートルールの時間ウィンドウ(分)。

enabledboolean必要

アラートルールが有効かどうかを示します。

sendResolvedboolean必要

アラートルールが解決されたときに通知を送信するかどうかを示します。

actionsarray必要

アラートルールがトリガーされたときに実行するアクション。

[]actionsobject必要

アラートルールがトリガーされたときに実行するアクション。

typestring必要

アクションのタイプ。

configobject必要

アクションの設定。

comparisonMethodstring必要

アラートルールで使用される比較演算子。

targetInstanceIdsarray

アラートルールが適用されるクラスターの ID。

[]targetInstanceIdsstring

クラスターの ID。

metricUnitstring

メトリクスの単位(例: "bytes"、"percent")。

repeatIntervalSecondsinteger<int32>

アラート通知を繰り返し送信する間隔(秒)。

bash
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"
}'
レスポンス

指定したプロジェクト内のアラートルールの一覧を返します。

アラートルールの一覧を返します。

codeinteger<int32>

レスポンスコード。

dataobject

アラートルール作成リクエストのレスポンスペイロード。

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": {
"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"
]
}
}