コンテンツにスキップ

作成



POST /api/v1/incidents/schedule/add

概要

新しいオンコールスケジュールを作成します。

Body リクエストパラメータ

パラメータ名 型 必須 説明
name string Y 名前
空を許可: False
最大長: 256
空文字列を許可: False
timezone string タイムゾーン、デフォルトは Asia/Shanghai
例: Asia/Shanghai
空を許可: False
最大長: 48
start string Y 時間帯の開始時刻
例: 00:00
空を許可: False
最大長: 48
end string Y 時間帯の終了時刻
例: 23:59
空を許可: False
最大長: 48
tagFilter array フィルタリングするタグに対応する UUID のリスト
空を許可: False
例: ['tag1', 'tag2']
dimensionFilter string フィルタリングするディメンション
空を許可: False
例: host:127.0.0.1
notifyTargets array Y 通知先(アカウント UUID、通知先 UUID、メールアドレスを含む)
例: ['acnt_xxx', 'notify_', 'xxx@guance.com']
空を許可: False
extend json 拡張情報(ローテーション通知先設定を含む)
空を許可: False
extend.enableRotateNotification boolean ローテーションを有効にするかどうか、デフォルトは無効
例: False
空を許可: False
extend.rotationCycle string ローテーション周期(日: day、週: week、月: month、営業日: workDay、週末: weekend)
例: day
空を許可: False
選択可能な値: ['day', 'week', 'month', 'workDay', 'weekend']
extend.effectiveTime json スケジュールの有効期間、デフォルトは永久有効、開始/終了時刻は 11 桁のタイムスタンプ
例: {'start': 1719990196, 'end': 1729990196}
空を許可: False
scheduleStrategy array エスカレーションポリシールール

パラメータ補足説明

1. リクエストパラメータの説明

パラメータ名 型 必須 説明
name String 必須 スケジュール名
start String 必須 時間帯の開始時刻
end String 必須 時間帯の終了時刻
timezone String タイムゾーン
tagFilter array フィルタリングするタグに対応する UUID のリスト
dimensionFilter array ディメンションフィルター。現在は等価(equal)とワイルドカード(wildcard)ロジックをサポートします。
notifyTargets array 必須 通知先(アカウント UUID、通知先 UUID、メールアドレスを含む)
extend Json 拡張情報
scheduleStrategy Json エスカレーションポリシールール

2. dimensionFilter パラメータの説明

ディメンションフィルターです。現在は等価(equal)とワイルドカード(wildcard)ロジックをサポートします。形式は key:value です。例えば host:127.0.0.1 は、host が 127.0.0.1 のディメンションのみを含むことを意味します。 ワイルドカードロジックは * ワイルドカード文字をサポートします。例えば host:127.0.0.* は、host が 127.0.0. で始まるディメンションのみを含むことを意味します。 また、複数条件の or/and もサポートします。例えば host:127.0.0.1 AND service:mysql などです。 現在サポートされているディメンションフィールドは次のとおりです: host、service、resource、pod_name、app_name、env、url


3. extend 内のパラメータの説明

パラメータ名 型 必須 説明
enableRotateNotification Boolean 通知先のローテーションを有効にするかどうか、デフォルトは無効
rotationCycle string 通知先ローテーションを有効にした場合のローテーション周期
effectiveTime json スケジュールの有効期間設定、デフォルトは永久有効、開始/終了時刻は 11 桁のタイムスタンプ

4. scheduleStrategy 内のパラメータの説明

パラメータ名 型 必須 説明
scheduleStrategy[].uuid string Y 一意の UUID
scheduleStrategy[].name string Y ポリシー名
scheduleStrategy[].strategy array N エスカレーションポリシーのリスト
scheduleStrategy[].strategy[].level integer Y レベル
scheduleStrategy[].strategy[].notifyConfig array Y 通知設定のリスト
scheduleStrategy[].strategy[].notifyConfig[].notifyType array Y 通知先のタイプ(member - メンバー、object - 通知先)
scheduleStrategy[].strategy[].notifyConfig[].notifyObject array Y 通知先のリスト(watchkeeper は現在のオンコール担当者を表します)
scheduleStrategy[].strategy[].notifyConfig[].notifyMethod array N 通知方法(通知先の場合は不要)mobile - 電話、message - ショートメッセージ、email - メール
scheduleStrategy[].strategy[].ifRepeatNotify boolean Y 通知を繰り返し送信するかどうか
scheduleStrategy[].strategy[].repeatNotifyInterval integer N 通知の繰り返し間隔(秒単位)
scheduleStrategy[].strategy[].levelUpTime integer N エスカレーションの継続時間
scheduleStrategy[].strategy[].incidentsLevel array N 対応するインシデントレベルのリスト
scheduleStrategy[].strategy[].incidentsStatus array N 対応するインシデントステータス(open - 未割り当て、working - 処理中)

scheduleStrategy フィールドの例:

  [
    {
        "uuid": "",
        "name": "AAA",
        "strategy": [
            {
                "level": 0,
                "notifyConfig": [
                    {
                        "notifyObjectType": "member",
                        "notifyObject": ["watchkeeper"]
                    }
                    {
                        "notifyObjectType": "member",
                        "notifyObject": ["uuid_xxx1"]
                    }
                ],
                "ifRepeatNotify": true,
                "repeatNotifyInterval": 300
            },
            {
                "level": 1,
                "notifyConfig": [
                    {
                        "notifyObjectType": "member",
                        "notifyObject": ["uuid_xxx1"],
                        "notifyMethod": ["mobile", "message", "email"]
                    },
                    {
                        "notifyObjectType": "group",
                        "notifyObject": ["uuid_xxx2"],
                        "notifyMethod": ["mobile", "message", "email"]
                    }
                ],
                "ifRepeatNotify": true,
                "repeatNotifyInterval": 300,
                "levelUpTime": 1800,
                "incidentsLevel": ["uuid_xxxx"],
                "incidentsStatus": ["open"]
            }
        ]
    },
    {
        "uuid": "",
        "name": "BBB",
        "strategy": [
            {
                "level": 0,
                "notifyConfig": [
                    {
                        "notifyObject": "uuid_xxx"
                    }
                ],
                "ifRepeatNotify": true,
                "repeatNotifyInterval": 300
            }
        ]
    }
]

リクエスト例

curl 'https://openapi.guance.com/api/v1/incidents/schedule/add' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"name":"test","timezone":"Asia/Shanghai","start":"00:00","end":"23:59","tagFilter":[],"dimensionFilter":"host:172.16.242.113","scheduleStrategy":[{"name":"test","uuid":"4c5851c0-f692-11f0-9ba3-87705656b525","strategy":[{"level":0,"notifyConfig":[{"notifyMethod":["email","message"],"notifyObject":["watchkeeper"],"notifyObjectType":"member"},{"notifyMethod":[],"notifyObject":["notify_xxx"],"notifyObjectType":"notify"}],"ifRepeatNotify":false,"repeatNotifyInterval":null},{"level":1,"levelUpTime":1800,"notifyConfig":[{"notifyMethod":["email"],"notifyObject":["acnt_xxxx"],"notifyObjectType":"member"}],"ifRepeatNotify":true,"incidentsLevel":["system_level_0"],"incidentsStatus":["open"],"repeatNotifyInterval":300}]}],"notifyTargets":["acnt_xxx"],"extend":{"enableRotateNotification":false,"rotationCycle":"day"}}' \
--compressed

レスポンス

{
    "code": 200,
    "content": {
        "workspaceUUID": "wksp_xxx",
        "name": "test",
        "timezone": "Asia/Shanghai",
        "start": "00:00",
        "end": "23:59",
        "tagFilter": [],
        "dimensionFilter": "host:172.16.242.113",
        "notifyTargets": [
            "acnt_xxx"
        ],
        "strategyConfig": [
            {
                "name": "test",
                "uuid": "4c5851c0-f692-11f0-9ba3-87705656b525",
                "strategy": [
                    {
                        "level": 0,
                        "notifyConfig": [
                            {
                                "notifyMethod": [
                                    "email",
                                    "message"
                                ],
                                "notifyObject": [
                                    "watchkeeper"
                                ],
                                "notifyObjectType": "member"
                            },
                            {
                                "notifyMethod": [],
                                "notifyObject": [
                                    "notify_xxx"
                                ],
                                "notifyObjectType": "notify"
                            }
                        ],
                        "ifRepeatNotify": false,
                        "repeatNotifyInterval": null
                    },
                    {
                        "level": 1,
                        "levelUpTime": 1800,
                        "notifyConfig": [
                            {
                                "notifyMethod": [
                                    "email"
                                ],
                                "notifyObject": [
                                    "acnt_xxx"
                                ],
                                "notifyObjectType": "member"
                            }
                        ],
                        "ifRepeatNotify": true,
                        "incidentsLevel": [
                            "system_level_0"
                        ],
                        "incidentsStatus": [
                            "open"
                        ],
                        "repeatNotifyInterval": 300
                    }
                ]
            }
        ],
        "extend": {
            "enableRotateNotification": false,
            "rotationCycle": "day"
        },
        "isDefault": false,
        "rotationUpdateAt": 1768989775,
        "id": 9180,
        "uuid": "incsch_xxx",
        "status": 0,
        "creator": "acnt_xxx",
        "updator": "acnt_xxx",
        "createAt": 1768964659,
        "deleteAt": -1,
        "updateAt": 1768989775
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "xxx"
}

フィードバック

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