コンテンツにスキップ

作成(このAPIは2025-12-30に廃止予定です。v2版APIの使用を推奨します)



POST /api/v1/alert_policy/add

概要

アラートポリシーを作成します。

Body リクエストパラメータ

パラメータ名 必須 説明
name string Y アラートポリシー名
空許容: False
desc string 説明
空許容: False
空文字列許容: True
最大長: 256
openPermissionSet boolean カスタム権限設定を有効にする(デフォルト false: 無効)。有効にすると、このルールの操作権限は permissionSet に従います。
空許容: False
permissionSet array 操作権限設定。設定可能(ロール(所有者を除く)、メンバー UUID、チーム UUID)
例: ['wsAdmin', 'acnt_xxxx', 'group_yyyy']
空許容: False
ruleTimezone str Y アラートポリシーのタイムゾーン
例: Asia/Shanghai
空許容: False
alertOpt json アラート設定
空許容: False
alertOpt.alertType string アラートポリシー通知タイプ。ステータス(status)/メンバー(member)。デフォルトはステータス
空許容: False
選択可能値: ['status', 'member']
alertOpt.alertTarget array トリガーアクション。トリガー時間のパラメータ処理に注意。
例: [{'name': '通知設定1', 'targets': [{'to': ['acnt_xxxx32'], 'status': 'critical', 'tags': {'pod_name': ['coredns-7769b554cf-w95fk']}, 'upgradeTargets': [{'to': ['acnt_xxxx32'], 'duration': 600}, {'to': ['group_xxxx32'], 'duration': 6000}]}], 'crontabDuration': 600, 'crontab': '0 9 * * 0,1,2,3,4'}, {'name': '通知設定2', 'targets': [{'status': 'error', 'to': ['group_xxxx32'], 'upgradeTargets': [{'to': ['acnt_xxxx32'], 'duration': 600}, {'to': ['group_xxxx32'], 'duration': 6000}]}], 'customDateUUIDs': ['ndate_xxxx32'], 'customStartTime': '09:30:10', 'crontabDuration': 600}]
空許容: False
alertOpt.silentTimeout integer 重複アラート設定
空許容: False
alertOpt.silentTimeoutByStatusEnable boolean レベル別の重複アラート設定を有効にするかどうか。デフォルト false で、silentTimeout を使用します。
空許容: False
alertOpt.silentTimeoutByStatus array レベル別の重複アラート設定。レベル別の最小アラート間隔を設定します。
空許容: False
alertOpt.aggInterval integer Y アラート集約間隔(秒)。0 は集約なしを意味します。
空許容: False
$minValue: 0
$maxValue: 1800
alertOpt.aggFields array 集約フィールドリスト。空リスト[]は「集約ルール:すべて」を意味します。df_monitor_checker_id:モニター/インテリジェントインスペクション/SLO、df_dimension_tags:検出ディメンション、df_label:タグ、CLUSTER:インテリジェント集約
例: ['CLUSTER']
空許容: False
alertOpt.aggLabels array タグで集約する際のタグ値リスト。aggFields に df_label を指定している場合に有効です。
空許容: False
alertOpt.aggClusterFields array インテリジェント集約時のフィールドリスト。aggFields に CLUSTER を指定している場合に有効です。選択可能値 "df_title":タイトル、"df_message":内容
例: ['df_title']
空許容: False

パラメータ補足説明


データ説明.

1. alertOpt パラメータ説明

パラメータ名 type 必須 説明
name string 必須 ルール名
desc string 説明
type string 必須 チェッカータイプ
ruleTimezone string 必須 アラートポリシータイムゾーン(2024-01-31 イテレーションで追加されたパラメータ)
alertOpt Dict 必須 アラート設定
alertOpt.silentTimeout integer 最小アラート間隔。同じアラートを再送信しない時間(アラートサイレント期間)。単位:秒。0/null はアラートを1回のみ送信することを意味します(間隔は無限長)。
alertOpt.silentTimeoutByStatusEnable boolean レベル別の重複アラート設定を有効にするかどうか。
alertOpt.silentTimeoutByStatus array レベル別の最小アラート間隔。単位:秒。セキュリティモニタリングレベルは security_ プレフィックスを使用します。
alertOpt.aggInterval integer アラート集約間隔。単位:秒。0 は集約なしを意味します。範囲 [0,1800]
alertOpt.aggFields array 集約フィールドリスト。空リスト[]は「集約ルール:すべて」を意味します。df_monitor_checker_id:モニター/インテリジェントインスペクション/SLO、df_dimension_tags:検出ディメンション、df_label:タグ、CLUSTER:インテリジェント集約
alertOpt.aggLabels array タグで集約する際のタグ値リスト。aggFields に df_label を指定している場合に有効です。
alertOpt.aggClusterFields array インテリジェント集約時のフィールドリスト。aggFields に CLUSTER を指定している場合に有効です。選択可能値 "df_title":タイトル、"df_message":内容
alertOpt.alertTarget Array[Dict] アラートアクション
alertOpt.alertType string アラートポリシー通知タイプ。ステータス(status)/メンバー(member)。デフォルトはステータス。2024-11-06 イテレーションで追加。
openPermissionSet boolean カスタム権限設定を有効にするかどうか。デフォルト false。2024-11-06 イテレーションで追加。
permissionSet array 操作権限設定。2024-11-06 イテレーションで追加。

2. アラートポリシーがステータスタイプの場合の alertOpt.alertTarget パラメータ説明

key 必須 説明
alertTarget[#] dict alertTarget リスト要素
alertTarget[#].name string 設定名
alertTarget[#].targets Array[dict] 必須 通知先設定(アラートポリシーがステータス/メンバータイプの場合、このフィールドの位置に注意)
alertTarget[#].crontab String 繰り返し時間帯を選択する場合の開始 Crontab(Crontab 構文)
alertTarget[#].crontabDuration integer 繰り返し時間を選択。Crontab 開始からの持続時間(秒)
alertTarget[#].customDateUUIDs Array[String] カスタム時間を選択する場合のカスタム通知日の UUID リスト。例: ['ndate_xxxx32', 'ndate_xxxx32']。カスタム通知日は(モニタリング - アラートポリシー - カスタム通知日、API)を参照。
alertTarget[#].customStartTime String カスタム時間を選択する場合の毎日の開始時間。形式:HH🇲🇲ss
alertTarget[#].customDuration integer カスタム時間帯を選択する場合の、customStartTime からの持続時間(秒)

3. アラートポリシーがメンバータイプの場合の alertOpt.alertTarget パラメータ説明

key 必須 説明
alertTarget[#] dict alertTarget リスト要素
alertTarget[#].name string 設定名
alertTarget[#].crontab String 繰り返し時間帯を選択する場合の開始 Crontab(Crontab 構文)
alertTarget[#].crontabDuration integer 繰り返し時間を選択。Crontab 開始からの持続時間(秒)
alertTarget[#].customDateUUIDs Array[String] カスタム時間を選択する場合のカスタム通知日の UUID リスト。例: ['ndate_xxxx32', 'ndate_xxxx32']。カスタム通知日は(モニタリング - アラートポリシー - カスタム通知日、API)を参照。
alertTarget[#].customStartTime String カスタム時間を選択する場合の毎日の開始時間。形式:HH🇲🇲ss
alertTarget[#].customDuration integer カスタム時間帯を選択する場合の、customStartTime からの持続時間(秒)
alertTarget[#].alertInfo Array[dict] 必須 メンバータイプのアラートポリシーに関する通知情報設定。2024-11-27 イテレーションで追加。

4. アラートポリシーがメンバータイプの場合の alertOpt.alertTarget.alertInfo パラメータ説明

key 必須 説明
alertInfo[#] dict alertInfo リスト要素
alertInfo[#].name string 設定名
alertInfo[#].targets Array[dict] 必須 通知先設定(アラートポリシーがステータス/メンバータイプの場合、このフィールドの位置に注意)
alertInfo[#].filterString string alertType が member の場合に使用します。フィルター条件の生文字列。2024-11-27 イテレーションで追加。
alertInfo[#].memberInfo array alertType が member の場合に使用します(チーム UUID、メンバー UUID)。例: [group_xxxx,acnt_xxxx]。2024-11-27 イテレーションで追加。

5. 時間設定に関する説明

繰り返し時間帯を選択する場合、crontab、crontabDuration フィールドは必須パラメータです。
カスタム時間帯を選択する場合、customDateUUIDs、customDuration、customStartTime フィールドは必須パラメータです。
その他の時間を選択する場合、crontab、crontabDuration、customDateUUIDs、customStartTime、customDuration はすべて不要です。
注意: 各アラートポリシーには、その他の時間の通知ルールが1つ存在します。つまり、時間設定がない場合はフォールバックの通知先となります。


6. 通知先フィールド targets 説明

alertType が status の場合、targets は alertOpt.alertTarget.targets にあります。
alertType が member の場合、targets は alertOpt.alertTarget.alertInfo.targets にあります。
targets はリストで、内部要素は dict です。内部フィールドの説明は以下の通りです。

key 必須 説明
to Array[String] 必須 通知先/メンバー/チーム。例: [group_xxxx,acnt_xxxx,notify_xxxx]。(alertType が member の場合、通知先と固定フィールド email、sms(SaaS 版は sms をサポート)のみ選択可能。例: [email,notify_xxxx]。2024-11-06 イテレーションで追加。)
status Enum 必須 アラートを送信する必要があるイベントの status 値(複数の status はカンマで区切り、All ですべてを意味します)。非セキュリティモニタリングタイプの status 値: fatalcriticalerrorwarningnodatainfo。セキュリティモニタリングタイプの status 値: criticalhighmediumlowinfo(2025-05-14 イテレーションでセキュリティモニタリングの列挙値を追加)。
df_source Enum status をセキュリティモニタリングの status にする場合、ここで df_source を security に指定する必要があります。デフォルトでは指定しない場合、非セキュリティモニタリングの status を意味します(2025-05-14 イテレーションで追加)。
upgradeTargets Array 各アラート設定のステータスに対するエスカレーション通知。
tags dict フィルター条件。
filterString dict フィルター条件の生文字列。tags を置き換えることができます。filterString の使用優先度は tags よりも高くなります。2024-11-27 イテレーションで追加。

7. 通知先フィールド upgradeTargets 説明

alertType が status の場合、targets は alertOpt.alertTarget.targets.upgradeTargets にあります。
alertType が member の場合、targets は alertOpt.alertTarget.alertInfo.targets.upgradeTargets にあります。
upgradeTargets はリストで、内部要素は dict です。内部フィールドの説明は以下の通りです。

key 必須 説明
to Array[String] 必須 通知先/メンバー/チーム。例: [group_xxxx,acnt_xxxx,notify_xxxx]。(alertType が member の場合、メンバーとチームのみ選択可能。2024-11-06 イテレーションで追加。)
duration integer 持続時間。このステータスのイベントが継続して発生した場合、エスカレーション通知をトリガーします。
toWay Array[String] alertType がメンバー(member)タイプの場合に使用します。通知先と固定フィールド email、sms(SaaS 版は sms をサポート)のみ選択可能。例: [email,notify_xxxx]。2024-11-06 イテレーションで追加。

8. 操作権限設定パラメータ説明

パラメータ名 type 説明
openPermissionSet boolean カスタム権限設定を有効にするかどうか。デフォルト false
permissionSet array 操作権限設定

permissionSet、openPermissionSet フィールド説明(2024-06-26 イテレーションで追加されたフィールド):

openPermissionSet を有効にすると、ワークスペース所有者と permissionSet 設定に含まれるロール、チーム、メンバーのみが編集/有効/無効/削除を実行できます。
openPermissionSet を無効にすると(デフォルト)、削除/有効/無効/編集の権限は既存のAPIの編集/有効/無効/削除権限に従います。

permissionSet フィールドには、ロール UUID(wsAdmin、general、readOnly、role_xxxxx)、チーム UUID(group_yyyy)、メンバー UUID(acnt_xxx)を設定できます。 permissionSet フィールドの例:

  ["wsAdmin", "general", "group_yyyy", "acnt_xxxx"]


9. alertOpt[#].silentTimeoutByStatus パラメータ説明

パラメータ名 type 説明
silentTimeoutByStatus[#] dict silentTimeoutByStatus リスト要素
silentTimeoutByStatus[#].status boolean 非セキュリティモニタリングタイプの status 値: fatalcriticalerrorwarningnodatainfo。セキュリティモニタリングタイプの status 値: security_criticalsecurity_highsecurity_mediumsecurity_lowsecurity_info
silentTimeoutByStatus[#].silentTimeout integer 最小アラート間隔。同じアラートを再送信しない時間(アラートサイレント期間)。単位:秒。0/null はアラートを1回のみ送信することを意味します(間隔は無限長)。

silentTimeoutByStatus フィールドの例:

  [
      {
          "status": "fatal",
          "silentTimeout": 600
      },
      {
          "status": "critical,error",
          "silentTimeout": 900
      },
      {
          "status": "security_high",
          "silentTimeout": 600
      },
  ]


リクエスト例

curl 'https://openapi.guance.com/api/v1/alert_policy/add' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"name":"jj_test","ruleTimezone":"Asia/Shanghai","alertOpt":{"alertTarget":[{"name":"Notification Configuration1","targets":[{"status":"critical","tags":{"pod_name":["coredns-7769b554cf-w95fk"]},"to":["acnt_xxxx32"]}],"crontabDuration":600,"crontab":"0 9 * * 0,1,2,3,4"},{"name":"Notification Configuration2","targets":[{"status":"error","to":["group_xxxx32"]}],"customDateUUIDs":["ndate_xxxx32"],"customStartTime":"09:30:10","customDuration":600},{"targets":[{"status":"warning","to":["notify_xxxx32"]}]}],"silentTimeout":21600,"aggInterval":120,"aggFields":["df_monitor_checker_id"]}}' \
--compressed

レスポンス

{
    "code": 200,
    "content": {
        "alertOpt": {
            "aggFields": [
                "df_monitor_checker_id"
            ],
            "aggInterval": 120,
            "alertTarget": [
                {
                    "crontab": "0 9 * * 0,1,2,3,4",
                    "crontabDuration": 600,
                    "name": "Notification Configuration1",
                    "targets": [
                        {
                            "status": "critical",
                            "tags": {
                                "pod_name": [
                                    "coredns-7769b554cf-w95fk"
                                ]
                            },
                            "to": [
                                "acnt_xxxx32"
                            ]
                        }
                    ]
                },
                {
                    "customDateUUIDs": [
                        "ndate_xxxx32"
                    ],
                    "customDuration": 600,
                    "customStartTime": "09:30:10",
                    "name": "Notification Configuration2",
                    "targets": [
                        {
                            "status": "error",
                            "to": [
                                "group_xxxx32"
                            ]
                        }
                    ]
                },
                {
                    "targets": [
                        {
                            "status": "warning",
                            "to": [
                                "notify_xxxx32"
                            ]
                        }
                    ]
                }
            ],
            "silentTimeout": 21600
        },
        "createAt": 1719373984,
        "creator": "wsak_xxxx32",
        "declaration": {
            "asd": "aa,bb,cc,1,True",
            "asdasd": "dawdawd",
            "business": "aaa",
            "fawf": "afawf",
            "organization": "64fe7b4062f74d0007b46676"
        },
        "deleteAt": -1,
        "id": null,
        "name": "jj_test",
        "ruleTimezone": "Asia/Shanghai",
        "score": 0,
        "status": 0,
        "updateAt": 1719373984,
        "updator": "wsak_xxxx32",
        "uuid": "altpl_xxxx32",
        "workspaceUUID": "wksp_xxxx32"
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "TRACE-148B6846-6180-4594-BD26-8A2077F0E911"
}

フィードバック

このページは役に立ちましたか?