콘텐츠로 이동

v2 생성



POST /api/v1/alert_policy/add_v2

개요

알림 정책을 생성합니다. v2는 연결된 모니터/지능형 모니터/지능형 점검/SLO, 보안 모니터링의 동기 업데이트를 지원합니다.

Body 요청 매개변수

매개변수명 유형 필수 설명
name string Y 알림 정책명
Null 허용: False
desc string 설명
Null 허용: False
빈 문자열 허용: True
최대 길이: 256
openPermissionSet boolean 사용자 정의 권한 구성 활성화 (기본값 false: 비활성화), 활성화 시 해당 규칙의 작업 권한은 permissionSet에 따름
Null 허용: False
permissionSet array 작업 권한 구성, 구성 가능 (역할(소유자 제외), 멤버 UUID, 팀 UUID)
예시: ['wsAdmin', 'acnt_xxxx', 'group_yyyy']
Null 허용: False
checkerUUIDs array 모니터/지능형 모니터/지능형 점검/SLO UUID (2024-12-11 반복 추가)
예시: ['rule_xxx', 'monitor_xxx']
Null 허용: False
securityRuleUUIDs array 보안 모니터링(cspm, siem, aba)의 UUID
예시: ['srul_xxx', 'srul_xxx', 'srul_xxx']
Null 허용: False
ruleTimezone str Y 알림 정책 시간대
예시: Asia/Shanghai
Null 허용: False
alertOpt json 알림 설정
Null 허용: False
alertOpt.aggType string 알림 집계 유형, 해당 필드를 전달하지 않으면 이전 버전 로직 사용 (2024-12-25 반복 추가)
Null 허용: True
선택 가능 값: ['byFields', 'byCluster', 'byAI', 'byCustom']
alertOpt.ignoreOK boolean 고급 구성, 정상 등급은 이벤트만 생성하고 알림을 전송하지 않음 (ok 알림 무시 여부) (2025-10-22 신규 필드)
Null 허용: False
alertOpt.alertType string 알림 정책 알림 유형, 등급(status)/멤버(member), 기본값은 등급
Null 허용: 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}]
Null 허용: False
alertOpt.silentTimeout integer 반복 알림 구성
Null 허용: False
alertOpt.silentTimeoutByStatusEnable boolean 등급별 반복 알림 설정 활성화 여부, 기본값 false, silentTimeout 사용
Null 허용: False
alertOpt.silentTimeoutByStatus array 등급별 반복 알림 설정, 등급별 최소 알림 간격 구성
Null 허용: False
alertOpt.aggInterval integer Y 알림 집계 간격, 단위 초, 0은 집계하지 않음
Null 허용: False
$minValue: 0
$maxValue: 1800
alertOpt.aggFields array 집계 필드 목록, 빈 목록[]은 '집계 규칙: 전체'를 의미, df_monitor_checker_id: 모니터/지능형 점검/SLO, df_dimension_tags: 감지 차원, df_label: 태그, CLUSTER: 지능형 집계
예시: ['CLUSTER']
Null 허용: False
alertOpt.aggLabels array 태그별 집계 시 태그 값 목록, aggFields에 df_label이 지정되어 있어야生效
Null 허용: False
alertOpt.aggClusterFields array 지능형 집계 시 필드 목록, aggFields에 CLUSTER가 지정되어 있어야生效, 선택 가능 값 "df_title": 제목, "df_message": 내용
예시: ['df_title']
Null 허용: False
alertOpt.aggSendFirst boolean 집계 시 첫 번째 알림을 직접 전송할지 여부 (2025-09-03 반복 추가 매개변수)
Null 허용: False

매개변수 보충 설명


데이터 설명.

1. alertOpt 매개변수 설명

매개변수명 type 필수 설명
name string 필수 규칙명
desc string 설명
type string 필수 검사기 유형
ruleTimezone string 필수 알림 정책 시간대 (2024-01-31 반복 추가 매개변수)
alertOpt Dict 필수 알림 설정
alertOpt.silentTimeout integer 최소 알림 간격, 동일한 알림을 일정 시간 동안 반복 전송하지 않음(알림 음소거 시간), 단위 초/s, 0/null은 알림을 한 번만 전송(간격이 무한대)
alertOpt.silentTimeoutByStatusEnable boolean 등급별 반복 알림 구성 활성화 여부
alertOpt.silentTimeoutByStatus array 등급별 최소 알림 간격, 단위 초, 보안 모니터링 등급은 security_ 접두사 사용
alertOpt.aggInterval integer 알림 집계 간격, 단위 초, 0은 집계하지 않음, 단위 초/s, 범위[0,1800]
alertOpt.aggFields array 집계 필드 목록, 빈 목록[]은 '집계 규칙: 전체'를 의미, df_monitor_checker_id: 모니터/지능형 점검/SLO, df_dimension_tags: 감지 차원, df_label: 태그, CLUSTER: 지능형 집계, 또는 aggType=byCustom 시 사용자 정의 집계 필드
alertOpt.aggLabels array 태그별 집계 시 태그 값 목록, aggFields에 df_label이 지정되어 있어야生效
alertOpt.aggClusterFields array 지능형 집계 시 필드 목록, aggFields에 CLUSTER가 지정되어 있어야生效, 선택 가능 값 "df_title": 제목, "df_message": 내용
alertOpt.aggSendFirst boolean 집계 시 첫 번째 알림을 직접 전송할지 여부 (2025-09-03 반복 추가 매개변수)
alertOpt.aggType string 기본값 전달하지 않으면 이전 버전 로직 사용, byFields: 규칙 집계, byCluster: 지능형 집계, byAI: AI 집계, byCustom: 규칙 집계-사용자 정의, 2024-12-25 신규 필드
alertOpt.alertTarget Array[Dict] 알림 작업
alertOpt.alertType string 알림 정책 알림 유형, 등급(status)/멤버(member), 기본값은 등급, 2024-11-06 반복 추가
alertOpt.ignoreOK boolean 고급 구성, 정상 등급은 이벤트만 생성하고 알림을 전송하지 않음 (ok 알림 무시 여부) 2025-10-22 신규 필드
openPermissionSet boolean 사용자 정의 권한 구성 활성화 여부, 기본값 false , 2024-11-06 반복 추가
permissionSet array 작업 권한 구성 , 2024-11-06 반복 추가
checkerUUIDs array 연결된 모니터/지능형 모니터/지능형 점검/SLO UUID , 2024-12-11 반복 추가
securityRuleUUIDs array 연결된 보안 모니터링(cspm, siem, aba) UUID , 2025-05-14 반복 추가

1.1 alertOpt.aggType 매개변수 설명 2024-12-25
알림 집계 유형:
 null: 집계 안 함
 byFields: 규칙 집계
 byCluster: 지능형 집계
 byAI: AI 집계


구버전 데이터 구조에는 aggType 필드가 없고 aggFields 내용으로 집계 유형을 판단했기 때문에, aggType 필드 추가 시 다음과 같이 호환 처리됩니다:
aggType이 지정된 경우, aggType에 지정된 집계 방식으로 집계
aggType이 지정되지 않거나 aggType=None인 경우 (구버전 로직에 따름)
aggFields에 "CLUSTER"가 포함된 경우, 지능형 집계 방식으로 집계
aggFields에 "CLUSTER"가 포함되지 않은 경우, 규칙 집계 방식으로 집계

파생 규칙: aggInterval=0 또는 aggInterval=null 지정 시 여전히 '집계 안 함'을 의미
aggType="byCluster" 지정 시, aggFields에 "CLUSTER"를 전달하지 않아도 됨 (전달 여부는 영향 없음)
aggType="byFields"를 지정했지만 aggFields에 "CLUSTER"가 포함된 경우, "CLUSTER"는 무시됨 (aggType 우선순위가 더 높음)
aggType="byCustom" 지정 시, aggFields의 사용자 정의 필드에 따라 집계


2. 알림 정책이 등급 유형일 때 alertOpt.alertTarget 매개변수 설명

key 유형 필수 설명
name string 구성 이름
targets Array[dict] 필수 알림 대상 구성 (알림 정책 등급/멤버 유형 시 해당 필드의 위치에 주의)
crontab String 반복 시간대 선택 시, 시작 Crontab (Crontab 문법)
crontabDuration integer 반복 시간 선택, Crontab 시작부터 지속 시간(초)
customDateUUIDs Array[String] 사용자 정의 시간 선택 시, 사용자 정의 알림 날짜의 UUID 목록, 예: ['ndate_xxxx32', 'ndate_xxxx32'], 사용자 정의 알림 날짜 참조(모니터 - 알림 정책 - 사용자 정의 알림 날짜, 인터페이스)
customStartTime String 사용자 정의 기간 선택 시, 매일 시작 시간, 형식: HH🇲🇲ss
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'], 사용자 정의 알림 날짜 참조(모니터 - 알림 정책 - 사용자 정의 알림 날짜, 인터페이스)
alertTarget[#].customStartTime String 사용자 정의 기간 선택 시, 매일 시작 시간, 형식: HH🇲🇲ss
alertTarget[#].customDuration integer 사용자 정의 기간 선택 시, customStartTime 사용자 정의 시작 시간부터 지속 시간(초)
alertTarget[#].alertInfo Array[dict] 필수 멤버 유형 알림 정책의 알림 관련 정보 구성 (2024-11-27 반복 추가)

4. 알림 정책이 멤버 유형일 때 alertOpt.alertTarget.alertInfo 매개변수 설명

key 유형 필수 설명
alertInfo[#] string 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 모두 전달 불필요
참고: 각 알림 정책에는 기타 시간에 대한 알림 규칙이 하나 존재하며, 즉 시간 구성이 없는 것은 기본 알림 대상입니다.


6. 알림 대상 필드 targets 설명
alertType이 status일 때, targets 위치는 alertOpt.alertTarget.targets
alertType이 member일 때, targets 위치는 alertOpt.alertTarget.alertInfo.targets

targets는 list이며, 내부 요소는 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 필수 알림을 전송해야 하는 event의 status 값 (여러 status는 쉼표로 구분, All은 전체를 의미). 비보안 모니터링 유형 status 값: fatal, critical,error,warning,nodata,info. 보안 모니터링 유형의 status 값: critical, high, medium, low, info (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 설명

  <br/>

alertType이 status일 때, targets 위치는 alertOpt.alertTarget.targets.upgradeTargets
alertType이 member일 때, targets 위치는 alertOpt.alertTarget.alertInfo.targets.upgradeTargets

7.1 upgradeTargets는 list이며, 내부 요소는 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 작업 권한 구성

8.1 permissionSet, openPermissionSet 필드 설명 (2024-06-26 반복 추가 필드):

openPermissionSet 활성화 시, 공간 소유자와 permissionSet에 구성된 역할, 팀, 멤버만 편집/활성화/비활성화/삭제 가능

openPermissionSet 비활성화 시(기본값), 삭제/활성화/비활성화/편집 권한은 기존 인터페이스의 편집/활성화/비활성화/삭제 권한을 따름

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 값: fatal, critical,error,warning,nodata,info. 보안 모니터링 유형의 status 값: security_critical, security_high, security_medium, security_low, security_info
silentTimeoutByStatus[#].silentTimeout integer 최소 알림 간격, 동일한 알림을 일정 시간 동안 반복 전송하지 않음(알림 음소거 시간), 단위 초/s, 0/null은 알림을 한 번만 전송(간격이 무한대)

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"
} 

문서 평가

이 페이지가 도움이 되었나요?