Create v2¶
POST /api/v1/alert_policy/add_v2
Overview¶
Create an alert policy and fully maintain Monitor/SLO/security rule bindings.
Before You Call and Usage Steps¶
At minimum, provide name and ruleTimezone to save an alert policy with empty notifications; when actual notifications are required, submit a complete alertOpt, including aggInterval and target actions for the corresponding mode. v2 can bind Monitors/SLOs through checkerUUIDs and security rules through securityRuleUUIDs at creation time; if omitted, these associations are not established. Clients should first verify that each UUID belongs to the current workspace; a successful save does not replace verification of ownership and actual bindings. In the current version, the top-level ruleTimezone is saved and displayed, but execution caches read the historical alertOpt.ruleTimezone, defaulting to Asia/Shanghai; other time zones cannot be considered effective merely because the save succeeded, and integrators must verify based on the actual execution time zone. Do not bypass public parameters with additional undeclared fields. Saving and cache refresh do not equal notification delivery; actual sending depends on valid targets, event severity, time periods, filters, duplicate suppression, and the alert execution service. After a failure or timeout, first read the policy and binding status to avoid duplicate creation or misjudging partial updates.
Request Headers¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI authentication credential for the workspace. Example: <DF-API-KEY>How to obtain or enter: Obtain an OpenAPI Key with the required operation permissions from API Key Management in the target workspace. |
Body Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| permissionSet[*] | string | A single operable subject identifier; whether it takes effect also depends on the identity and the current state of the resource. Example: wsAdminHow to obtain or enter: Use a role UUID (for example, wsAdmin/general/readOnly/role_), an acnt_ account, or a group_ team; accounts/teams are subject to the actual resources in this workspace. |
|
| alertOpt.silentTimeoutByStatus[*] | json | Severity-based interval object. Example: {"status": "critical,error", "silentTimeout": 600}How to obtain or enter: Each item defines a set of severities and their seconds. |
|
| alertOpt.silentTimeoutByStatus[*].status | string | For non-security, use fatal/critical/error/warning/nodata/info/ALL; for security, use security_critical/security_high/security_medium/security_low/security_info/security_ALL. Separate multiple values with English commas without spaces. Example: critical,errorHow to obtain or enter: Select from event severities; security severities use the security_ prefix, such as security_high. |
|
| alertOpt.silentTimeoutByStatus[*].silentTimeout | integer | Required repeat interval for each group, in seconds. Invalid severities may trigger internal errors; validate before sending. Example: 600How to obtain or enter: Enter a non-negative integer number of seconds for the severity; 0 means no further periodic repetition. |
|
| alertOpt.aggFields[*] | string | A single aggregation field. For byCustom, select based on actual event fields; do not guess fields solely from display names. Example: df_monitor_checker_idHow to obtain or enter: For event Monitors, use df_monitor_checker_id; for detection dimensions, use df_dimension_tags; for tags, use df_label; for historical intelligent aggregation, use CLUSTER. |
|
| alertOpt.aggLabels[*] | string | A single tag value. Example: productionHow to obtain or enter: Use the tag values in actual events. |
|
| alertOpt.aggClusterFields[*] | string | A single text field. Example: df_titleHow to obtain or enter: Use df_title for the title and df_message for the content. |
|
| alertOpt.alertTarget[*] | json | Rule object. When a fallback is needed, explicitly add a rule without time configuration; do not assume the system fills it in automatically. Example: {"name": "默认通知", "targets": [{"status": "critical", "to": ["notify_example"]}]}How to obtain or enter: Configure one time window or a fallback rule with no time period limit per item. |
|
| alertOpt.alertTarget[*].name | string | Optional rule name, up to 256 characters. Example: 默认通知How to obtain or enter: Name it according to the business purpose. |
|
| alertOpt.alertTarget[*].crontab | string | Periodic start time expression; must be paired with crontabDuration. Use either this or the custom date approach. Example: 0 9 * * 1-5How to obtain or enter: Enter a Cron expression based on the repeat start time, such as 9 AM on weekdays; also provide crontabDuration. |
|
| alertOpt.alertTarget[*].crontabDuration | integer | Duration of the periodic window in seconds; required when crontab is provided; if no repeat period is configured, omit both. Example: 28800How to obtain or enter: Convert the time window length into a positive integer number of seconds, for example, 28800 for 8 hours. |
|
| alertOpt.alertTarget[*].customDateUUIDs | array | Reference to a custom date set, up to 366 items; provide together with customStartTime and customDuration; do not use crontabDuration as a substitute. Example: ["ndate_example"]How to obtain or enter: Obtain the date set from content.data[].uuid in Custom Notification Dates; each item is a date configuration UUID, not a date string. |
|
| alertOpt.alertTarget[*].customDateUUIDs[*] | string | A single date configuration UUID. Example: ndate_exampleHow to obtain or enter: Copy a valid date configuration UUID from the same workspace in Custom Notification Dates. |
|
| alertOpt.alertTarget[*].customStartTime | string | Start time on the custom date; used together with customDateUUIDs/customDuration. Example: 09:30:00How to obtain or enter: Enter HH:MM:SS based on the local time of the selected date; interpreted according to the actual execution time zone. |
|
| alertOpt.alertTarget[*].customDuration | integer | Duration of the custom date window in seconds; must be provided together with the date set and start time. Example: 3600How to obtain or enter: Enter a positive integer number of seconds for the window length, for example, 3600 for 1 hour. |
|
| alertOpt.alertTarget[*].targets | array | Status mode action array. Example: [{"status": "critical", "to": ["notify_example"]}]How to obtain or enter: For accounts, obtain content.data[].uuid from Workspace Members; for teams, obtain the group_ UUID from member_group of a member or from Team Management; for notification targets, obtain the UUID from Notification Target List. Use actual resources in the current workspace for all. |
|
| alertOpt.alertTarget[*].targets[*] | json | A single severity action. Example: {"status": "critical", "to": ["notify_example"]}How to obtain or enter: Set one action for each event source and severity. |
|
| alertOpt.alertTarget[*].targets[*].status | string | Required severity selection: fatal, critical, error, warning, nodata, info, and uppercase ALL for all; connect multiple values with English commas without spaces. For the security source, use critical, high, medium, low, info, or ALL instead. Example: criticalHow to obtain or enter: Use df_status from actual events; for security events, also set df_source=security. |
|
| alertOpt.alertTarget[*].targets[*].df_source | string | Optional; the public target structure supports only security. If omitted, the execution layer excludes the security source. Example: securityHow to obtain or enter: Enter security only for security monitoring events; omit it for regular events. |
|
| alertOpt.alertTarget[*].targets[*].to | array | Required array of recipient targets; members, teams, notification targets, or email addresses are supported; agent accounts can use their valid default Webhook. Example: ["notify_example"]How to obtain or enter: For accounts, obtain content.data[].uuid from Workspace Members; for teams, obtain the group_ UUID from member_group of a member or from Team Management; for notification targets, obtain the UUID from Notification Target List. Use actual resources in the current workspace for all. |
|
| alertOpt.alertTarget[*].targets[*].to[*] | string | In member mode, email/sms/notify_ are commonly used; in status mode, use acnt_/agent_/group_/notify_ or email addresses. Whether channels such as SMS are available depends on the site and target configuration. Example: notify_exampleHow to obtain or enter: For accounts, obtain content.data[].uuid from Workspace Members; for teams, obtain the group_ UUID from member_group of a member or from Team Management; for notification targets, obtain the UUID from Notification Target List. Use actual resources in the current workspace for all. |
|
| alertOpt.alertTarget[*].targets[*].tags | json | In status mode, filter events by field values; in member mode, use the parent alertInfo.filterString; tags here are not used as member selection conditions. Example: {"env": ["production"]}How to obtain or enter: Build a dictionary from the original event fields and values. |
|
| alertOpt.alertTarget[*].targets[*].tags.字段 | array | Array of match values for a single field. Example: ["production"]How to obtain or enter: Use actual event fields as keys, such as env; use an array of actual field values to match as values. |
|
| alertOpt.alertTarget[*].targets[*].tags.字段[*] | string | A single match value. Example: productionHow to obtain or enter: Obtain the value from the same field in the event. |
|
| alertOpt.alertTarget[*].targets[*].filterString | string | In status mode, when non-empty, takes precedence over tags and is also used for escalation actions; in member mode, use the parent alertInfo.filterString; fields within this target are not valid filtering entry points. Example: env:productionHow to obtain or enter: Use the server-side FilterString syntax, for example, env:production; generate complex conditions in the console and copy them. |
|
| alertOpt.alertTarget[*].targets[*].upgradeTargets | array | Optional escalation action; executed after the event remains at the corresponding severity for duration; use [] to configure no escalation. Example: [{"to": ["acnt_example"], "duration": 600}]How to obtain or enter: For accounts, obtain content.data[].uuid from Workspace Members; for teams, obtain the group_ UUID from member_group of a member or from Team Management; for notification targets, obtain the UUID from Notification Target List. Use actual resources in the current workspace for all. |
|
| alertOpt.alertTarget[*].targets[*].upgradeTargets[*] | json | A single escalation action. Example: {"to": ["acnt_example"], "duration": 600}How to obtain or enter: Select a recipient target and the number of seconds to wait for each escalation. |
|
| alertOpt.alertTarget[*].targets[*].upgradeTargets[*].to | array | In member mode, this is the member/team that receives the escalation; in status mode, this is the escalation notification target, which can be a member/team/notification target/email address. Example: ["acnt_example"]How to obtain or enter: For accounts, obtain content.data[].uuid from Workspace Members; for teams, obtain the group_ UUID from member_group of a member or from Team Management; for notification targets, obtain the UUID from Notification Target List. Use actual resources in the current workspace for all. |
|
| alertOpt.alertTarget[*].targets[*].upgradeTargets[*].to[*] | string | A single escalation recipient identifier. Example: acnt_exampleHow to obtain or enter: For accounts, obtain content.data[].uuid from Workspace Members; for teams, obtain the group_ UUID from member_group of a member or from Team Management; for notification targets, obtain the UUID from Notification Target List. Use actual resources in the current workspace for all. |
|
| alertOpt.alertTarget[*].targets[*].upgradeTargets[*].duration | integer | Required duration in seconds; each escalation is configured relative to the event's continuous state, and multiple durations are not automatically accumulated. Example: 600How to obtain or enter: Enter a positive integer number of seconds according to business requirements, for example, 600 means the severity lasts 10 minutes. |
|
| alertOpt.alertTarget[*].targets[*].upgradeTargets[*].toWay | array | Array of notification methods for member escalation; status mode does not use this field. Example: ["email"]How to obtain or enter: In member mode, select from email/sms or the notify_ objects in Notification Target List; in status mode, omit it. |
|
| alertOpt.alertTarget[*].targets[*].upgradeTargets[*].toWay[*] | string | A single escalation notification method. Example: emailHow to obtain or enter: Select an actually available email/sms or notification target UUID. |
|
| alertOpt.alertTarget[*].alertInfo | array | Array of member groups used only in member mode; status mode does not use it. Example: [{"name": "生产负责人", "memberInfo": ["acnt_example"], "filterString": "env:production", "targets": [{"status": "critical", "to": ["email"]}]}]How to obtain or enter: For accounts, obtain content.data[].uuid from Workspace Members; for teams, obtain the group_ UUID from member_group of a member or from Team Management; for notification targets, obtain the UUID from Notification Target List. Use actual resources in the current workspace for all. |
|
| alertOpt.alertTarget[*].alertInfo[*] | json | Member group object. Example: {"name": "生产负责人", "memberInfo": ["acnt_example"], "targets": [{"status": "critical", "to": ["email"]}]}How to obtain or enter: For each group, fill in the member scope, event conditions, and notification methods. |
|
| alertOpt.alertTarget[*].alertInfo[*].name | string | Optional member group name, up to 256 characters. Example: 生产负责人How to obtain or enter: Name it according to the business purpose of the member group. |
|
| alertOpt.alertTarget[*].alertInfo[*].memberInfo | array | Array of members/teams that receive regular notifications in member mode, which may include agent accounts; combined with the notification methods in targets.to. Example: ["acnt_example"]How to obtain or enter: For accounts, obtain content.data[].uuid from Workspace Members; for teams, obtain the group_ UUID from member_group of a member or from Team Management; for notification targets, obtain the UUID from Notification Target List. Use actual resources in the current workspace for all. |
|
| alertOpt.alertTarget[*].alertInfo[*].memberInfo[*] | string | A single member or team identifier. Example: acnt_exampleHow to obtain or enter: For accounts, obtain content.data[].uuid from Workspace Members; for teams, obtain the group_ UUID from member_group of a member or from Team Management; for notification targets, obtain the UUID from Notification Target List. Use actual resources in the current workspace for all. |
|
| alertOpt.alertTarget[*].alertInfo[*].filterString | string | Member group-level event filter; both regular and escalation actions use this condition. Example: env:productionHow to obtain or enter: Organize it from actual event fields, for example, env:production. |
|
| alertOpt.alertTarget[*].alertInfo[*].targets | array | Array of notification methods/severity actions in member mode. Example: [{"status": "critical", "to": ["email"]}]How to obtain or enter: For accounts, obtain content.data[].uuid from Workspace Members; for teams, obtain the group_ UUID from member_group of a member or from Team Management; for notification targets, obtain the UUID from Notification Target List. Use actual resources in the current workspace for all. |
|
| alertOpt.alertTarget[*].alertInfo[*].targets[*] | json | A single severity action. Example: {"status": "critical", "to": ["email"]}How to obtain or enter: Set one action for each event source and severity. |
|
| alertOpt.alertTarget[*].alertInfo[*].targets[*].status | string | Required severity selection: fatal, critical, error, warning, nodata, info, and uppercase ALL for all; connect multiple values with English commas without spaces. For the security source, use critical, high, medium, low, info, or ALL instead. Example: criticalHow to obtain or enter: Use df_status from actual events; for security events, also set df_source=security. |
|
| alertOpt.alertTarget[*].alertInfo[*].targets[*].df_source | string | Optional; the public target structure supports only security. If omitted, the execution layer excludes the security source. Example: securityHow to obtain or enter: Enter security only for security monitoring events; omit it for regular events. |
|
| alertOpt.alertTarget[*].alertInfo[*].targets[*].to | array | In member mode, email, sms, or a notify_ notification target is commonly used to specify the notification method; the execution layer also supports targets such as direct accounts/teams, but using the combination of memberInfo and notification methods is recommended. Example: ["email"]How to obtain or enter: For accounts, obtain content.data[].uuid from Workspace Members; for teams, obtain the group_ UUID from member_group of a member or from Team Management; for notification targets, obtain the UUID from Notification Target List. Use actual resources in the current workspace for all. |
|
| alertOpt.alertTarget[*].alertInfo[*].targets[*].to[*] | string | In member mode, email/sms/notify_ are commonly used; in status mode, use acnt_/agent_/group_/notify_ or email addresses. Whether channels such as SMS are available depends on the site and target configuration. Example: emailHow to obtain or enter: For accounts, obtain content.data[].uuid from Workspace Members; for teams, obtain the group_ UUID from member_group of a member or from Team Management; for notification targets, obtain the UUID from Notification Target List. Use actual resources in the current workspace for all. |
|
| alertOpt.alertTarget[*].alertInfo[*].targets[*].tags | json | In status mode, filter events by field values; in member mode, use the parent alertInfo.filterString; tags here are not used as member selection conditions. Example: {"env": ["production"]}How to obtain or enter: Build a dictionary from the original event fields and values. |
|
| alertOpt.alertTarget[*].alertInfo[*].targets[*].tags.字段 | array | Array of match values for a single field. Example: ["production"]How to obtain or enter: Use actual event fields as keys, such as env; use an array of actual field values to match as values. |
|
| alertOpt.alertTarget[*].alertInfo[*].targets[*].tags.字段[*] | string | A single match value. Example: productionHow to obtain or enter: Obtain the value from the same field in the event. |
|
| alertOpt.alertTarget[*].alertInfo[*].targets[*].filterString | string | In status mode, when non-empty, takes precedence over tags and is also used for escalation actions; in member mode, use the parent alertInfo.filterString; fields within this target are not valid filtering entry points. Example: env:productionHow to obtain or enter: Use the server-side FilterString syntax, for example, env:production; generate complex conditions in the console and copy them. |
|
| alertOpt.alertTarget[*].alertInfo[*].targets[*].upgradeTargets | array | Optional escalation action; executed after the event remains at the corresponding severity for duration; use [] to configure no escalation. Example: [{"to": ["acnt_example"], "duration": 600, "toWay": ["email"]}]How to obtain or enter: For accounts, obtain content.data[].uuid from Workspace Members; for teams, obtain the group_ UUID from member_group of a member or from Team Management; for notification targets, obtain the UUID from Notification Target List. Use actual resources in the current workspace for all. |
|
| alertOpt.alertTarget[*].alertInfo[*].targets[*].upgradeTargets[*] | json | A single escalation action. Example: {"to": ["acnt_example"], "duration": 600, "toWay": ["email"]}How to obtain or enter: Select a recipient target and the number of seconds to wait for each escalation. |
|
| alertOpt.alertTarget[*].alertInfo[*].targets[*].upgradeTargets[*].to | array | In member mode, this is the member/team that receives the escalation; in status mode, this is the escalation notification target, which can be a member/team/notification target/email address. Example: ["acnt_example"]How to obtain or enter: For accounts, obtain content.data[].uuid from Workspace Members; for teams, obtain the group_ UUID from member_group of a member or from Team Management; for notification targets, obtain the UUID from Notification Target List. Use actual resources in the current workspace for all. |
|
| alertOpt.alertTarget[*].alertInfo[*].targets[*].upgradeTargets[*].to[*] | string | A single escalation recipient identifier. Example: acnt_exampleHow to obtain or enter: For accounts, obtain content.data[].uuid from Workspace Members; for teams, obtain the group_ UUID from member_group of a member or from Team Management; for notification targets, obtain the UUID from Notification Target List. Use actual resources in the current workspace for all. |
|
| alertOpt.alertTarget[*].alertInfo[*].targets[*].upgradeTargets[*].duration | integer | Required duration in seconds; each escalation is configured relative to the event's continuous state, and multiple durations are not automatically accumulated. Example: 600How to obtain or enter: Enter a positive integer number of seconds according to business requirements, for example, 600 means the severity lasts 10 minutes. |
|
| alertOpt.alertTarget[*].alertInfo[*].targets[*].upgradeTargets[*].toWay | array | Array of notification methods for member escalation; status mode does not use this field. Example: ["email"]How to obtain or enter: In member mode, select from email/sms or the notify_ objects in Notification Target List; in status mode, omit it. |
|
| alertOpt.alertTarget[*].alertInfo[*].targets[*].upgradeTargets[*].toWay[*] | string | A single escalation notification method. Example: emailHow to obtain or enter: Select an actually available email/sms or notification target UUID. |
|
| checkerUUIDs[*] | string | A single Monitor or SLO UUID. Example: rul_exampleHow to obtain or enter: Use the UUID of an actual Monitor or SLO in the same workspace; do not enter an alert policy UUID. |
|
| securityRuleUUIDs[*] | string | A single security rule UUID. Example: srul_exampleHow to obtain or enter: Use the UUID of a security monitoring rule in the same workspace. |
|
| name | string | Y | Required new policy name; a maximum of 256 characters is recommended; avoid duplicate names within the workspace. Allows null: False Example: 生产服务告警How to obtain or enter: Check existing names in this workspace from Alert Policy List, and choose an unused name. |
| desc | string | Optional description, up to 256 characters. If omitted on creation, it is an empty string; if omitted on update, it is retained; an empty string clears it. Allows null: False Allows empty string: True Maximum length: 256 Example: 生产服务异常通知与升级。How to obtain or enter: Fill it in according to the business scope that the policy is responsible for. |
|
| openPermissionSet | boolean | Optional custom operation permission switch; defaults to false on creation and is retained if omitted on update. When enabled, the creator, owner, and identities that meet advanced operation permissions or permissionSet can perform operations. Allows null: False Example: falseHow to obtain or enter: Enable it when operations such as editing need to be restricted by specific roles, teams, or members; disable it when operations are controlled by API permissions as usual. |
|
| permissionSet | array | Complete array of custom operation subjects, which can contain role, account, and team identifiers; omit for [] on creation, pass a complete replacement on update, and use [] to clear. The creator and owner are not locked out by an empty array. Allows null: False Example: ["wsAdmin"]How to obtain or enter: Obtain role UUIDs from Workspace Roles, and account/team UUIDs from Workspace Members; do not enter role display names. |
|
| checkerUUIDs | array | Optional on v2 creation; on v2 update, this is the complete target binding; omitting it or using [] clears Monitor and SLO bindings. Allows null: False Example: ["rul_example"]How to obtain or enter: Obtain the actual UUID (rul_ or monitor_, etc.) from Monitor/Smart Monitoring/Intelligent Inspection/SLO configuration; you can also obtain existing bindings from refCheckerInfo in Alert Policy Details. |
|
| securityRuleUUIDs | array | Optional on v2 creation; on v2 update, this is the complete target security rule binding; omitting it or using [] clears it. Allows null: False Example: ["srul_example"]How to obtain or enter: Obtain the srul_ UUID from the security monitoring rule list/console, or from refSecurityRuleInfo in Alert Policy Details. |
|
| ruleTimezone | str | Y | Time zone string required for both creation and update; saved to the policy entity; the current public version has differences in where execution reads it. Allows null: False Example: Asia/ShanghaiHow to obtain or enter: Select an IANA time zone according to business expectations, for example, Asia/Shanghai; see the usage notes for current execution-side limitations. |
| alertOpt | json | Alert notification configuration object; omitting it on creation saves an empty configuration, and passing it on update replaces it entirely. When the object is provided, aggInterval is a required validation field. Allows null: False Example: {"alertType": "status", "aggInterval": 0, "silentTimeout": 900, "alertTarget": []}How to obtain or enter: Fill it in according to the target structure below. Before updating, copy the complete object from the details and then adjust it. |
|
| alertOpt.aggType | string | Optional v2 mode: byFields for rule aggregation, byCluster for intelligent aggregation, byAI for AI aggregation, and byCustom for custom field rule aggregation. If omitted or null, the historical aggFields logic is used; aggregation still requires aggInterval>0. Allows null: True Allowed values: ['byFields', 'byCluster', 'byAI', 'byCustom'] Example: byFieldsHow to obtain or enter: Select a mode according to the aggregation intent. |
|
| alertOpt.ignoreOK | boolean | Optional in v2; ignores normal-severity notifications; defaults to false. Allows null: False Example: falseHow to obtain or enter: Use false if a normal notification is still required after recovery; use true to retain normal events without notifying. |
|
| alertOpt.alertType | string | status for severity-based, member for member-based; defaults to status if omitted. The targets hierarchy differs between the two modes and they cannot be mixed. Allows null: False Allowed values: ['status', 'member'] Example: statusHow to obtain or enter: Choose either selecting recipients by severity or selecting notification methods by member. |
|
| alertOpt.alertTarget | array | Array of notification rules. In status mode, put severity actions in targets; in member mode, organize members and notification methods in alertInfo. Allows null: False Example: [{"name": "默认通知", "targets": [{"status": "critical", "to": ["notify_example"]}]}]How to obtain or enter: Configure the array according to business time and recipient rules; use [] when there are no actions. |
|
| alertOpt.silentTimeout | integer | Unified alert repeat interval; if omitted, execution defaults to 900 seconds; 0 means no further periodic repetition in this round. If non-zero and less than 300, execution uses 300 seconds; do not pass null. Allows null: False Example: 900How to obtain or enter: Enter the number of seconds for the minimum repeat sending interval expected for the same type of alert. |
|
| alertOpt.silentTimeoutByStatusEnable | boolean | When default false on creation, silentTimeout is used; when true, severity-based intervals are expanded according to silentTimeoutByStatus. Allows null: False Example: falseHow to obtain or enter: Enter true when repeat intervals need to be set separately for different event severities. |
|
| alertOpt.silentTimeoutByStatus | array | Array of severity-based repeat intervals; when enabled, it should cover the severities that need control. This severity-based configuration is not normalized to the 300-second value of the unified silentTimeout. Allows null: False Example: [{"status": "critical,error", "silentTimeout": 600}]How to obtain or enter: Set it separately according to actual event sources and severities, using the severity-based array structure below. |
|
| alertOpt.aggInterval | integer | Conditionally required | Required when alertOpt is provided; 0 to 1800 seconds. 0 means no aggregation; even if byAI is selected, it does not mean effective AI aggregation is enabled. Allows null: False $minValue: 0 $maxValue: 1800 Example: 0How to obtain or enter: When aggregation is needed, enter the number of seconds to wait; enter 0 for no aggregation. |
| alertOpt.aggFields | array | Field list. Predefined values are df_monitor_checker_id, df_dimension_tags, df_label, and CLUSTER; in byCustom mode, business custom fields can be used; for v2 aggregation modes, see aggType. Allows null: False Example: ["df_monitor_checker_id"]How to obtain or enter: Select the following fields based on which events should be grouped together; [] means aggregate all. |
|
| alertOpt.aggLabels | array | Array of tag values for tag-based aggregation; when df_label is selected, a non-empty array must be provided. Allows null: False Example: ["production"]How to obtain or enter: Obtain actual tag values from event tags; use only when aggFields contains df_label. |
|
| alertOpt.aggClusterFields | array | Text fields for intelligent aggregation; when CLUSTER is included, at least df_title or df_message must be selected. Allows null: False Example: ["df_title"]How to obtain or enter: Select the title or content field when CLUSTER aggregation is needed. |
|
| alertOpt.aggSendFirst | boolean | Optional in v2; whether to send the first item immediately during aggregation; defaults to false; when aggInterval=0, it does not constitute valid aggregation. Allows null: False Example: falseHow to obtain or enter: Enter true when the first alert should be sent immediately while aggregating. |
Additional Parameter Notes¶
In status mode, configure alertTarget[].targets; in member mode, configure alertTarget[].alertInfo[].memberInfo and targets. For escalation, use to for recipients and toWay for notification methods. For a periodic window, enter crontab+crontabDuration; for a specified date window, enter customDateUUIDs+customStartTime+customDuration. Do not use crontabDuration as customDuration.
Example request body structure for member mode (submit to the URL on this page; replace the example accounts and teams):
{
"name": "生产服务告警",
"ruleTimezone": "Asia/Shanghai",
"alertOpt": {
"alertType": "member",
"aggInterval": 0,
"silentTimeout": 900,
"alertTarget": [
{
"name": "默认成员通知",
"alertInfo": [
{
"name": "生产负责人",
"memberInfo": [
"acnt_example"
],
"filterString": "env:production",
"targets": [
{
"status": "critical",
"to": [
"email"
],
"upgradeTargets": [
{
"to": [
"group_example"
],
"duration": 600,
"toWay": [
"email"
]
}
]
}
]
}
]
}
]
},
"checkerUUIDs": [],
"securityRuleUUIDs": []
}
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/alert_policy/add_v2' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"name":"生产服务告警","ruleTimezone":"Asia/Shanghai","alertOpt":{"alertType":"status","aggInterval":0,"silentTimeout":900,"alertTarget":[{"name":"默认通知","targets":[{"status":"critical","to":["notify_example"]}]}]},"checkerUUIDs":[],"securityRuleUUIDs":[]}'
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content.id | integer or null | Policy record number; it may not yet be assigned in the creation response. Use uuid for operations. |
| content.uuid | string | altpl_ alert policy UUID. |
| content.workspaceUUID | string | UUID of the workspace it belongs to. |
| content.name | string | Policy name. |
| content.desc | string | Policy description. |
| content.ruleTimezone | string | Time zone saved on the entity; see the usage notes for execution read differences; this is not proof that the time zone has taken effect. |
| content.score | integer | Policy score field; defaults to 0 on creation; this public request does not provide this field. |
| content.openPermissionSet | boolean | Custom operation permission switch. |
| content.permissionSet | array<string> |
Identifiers of roles/members/teams that can perform operations. |
| content.permissionSet[] | string | A single subject identifier. |
| content.status | integer | Record status: 0 active, 2 disabled, 3 deleted; the list includes policies that are not deleted. |
| content.creator | string | Creator identity. |
| content.updator | string | Last updater identity. |
| content.createAt | integer | Creation time, Unix seconds. |
| content.updateAt | integer | Update time, Unix seconds; initially -1. |
| content.deleteAt | integer | Deletion time, Unix seconds; -1 if not deleted. |
| content.alertOpt | object | Saved configuration: alert notification configuration object; omitting it on creation saves an empty configuration, and passing it on update replaces it entirely. When the object is provided, aggInterval is a required validation field. |
| content.alertOpt.alertType | string | Saved configuration: status for severity-based, member for member-based; defaults to status if omitted. The targets hierarchy differs between the two modes and they cannot be mixed. |
| content.alertOpt.silentTimeout | integer | Saved configuration: unified alert repeat interval; if omitted, execution defaults to 900 seconds; 0 means no further periodic repetition in this round. If non-zero and less than 300, execution uses 300 seconds; do not pass null. |
| content.alertOpt.silentTimeoutByStatusEnable | boolean | Saved configuration: when default false on creation, silentTimeout is used; when true, severity-based intervals are expanded according to silentTimeoutByStatus. |
| content.alertOpt.silentTimeoutByStatus | array<object> |
Saved configuration: array of severity-based repeat intervals; when enabled, it should cover the severities that need control. This severity-based configuration is not normalized to the 300-second value of the unified silentTimeout. |
| content.alertOpt.silentTimeoutByStatus[] | object | Saved configuration: severity-based interval object. |
| content.alertOpt.silentTimeoutByStatus[].status | string | Saved configuration: for non-security, use fatal/critical/error/warning/nodata/info/ALL; for security, use security_critical/security_high/security_medium/security_low/security_info/security_ALL. Separate multiple values with English commas without spaces. |
| content.alertOpt.silentTimeoutByStatus[].silentTimeout | integer | Saved configuration: required repeat interval for each group, in seconds. Invalid severities may trigger internal errors; validate before sending. |
| content.alertOpt.aggInterval | integer | Saved configuration: required when alertOpt is provided; 0 to 1800 seconds. 0 means no aggregation; even if byAI is selected, it does not mean effective AI aggregation is enabled. |
| content.alertOpt.aggFields | array<string> |
Saved configuration: field list. Predefined values are df_monitor_checker_id, df_dimension_tags, df_label, and CLUSTER; in byCustom mode, business custom fields can be used; for v2 aggregation modes, see aggType. |
| content.alertOpt.aggFields[] | string | Saved configuration: a single aggregation field. For byCustom, select based on actual event fields; do not guess fields solely from display names. |
| content.alertOpt.aggLabels | array<string> |
Saved configuration: array of tag values for tag-based aggregation; when df_label is selected, a non-empty array must be provided. |
| content.alertOpt.aggLabels[] | string | Saved configuration: a single tag value. |
| content.alertOpt.aggClusterFields | array<string> |
Saved configuration: text fields for intelligent aggregation; when CLUSTER is included, at least df_title or df_message must be selected. |
| content.alertOpt.aggClusterFields[] | string | Saved configuration: a single text field. |
| content.alertOpt.alertTarget | array<object> |
Saved configuration: array of notification rules. In status mode, put severity actions in targets; in member mode, organize members and notification methods in alertInfo. |
| content.alertOpt.alertTarget[] | object | Saved configuration: rule object. When a fallback is needed, explicitly add a rule without time configuration; do not assume the system fills it in automatically. |
| content.alertOpt.alertTarget[].name | string | Saved configuration: optional rule name, up to 256 characters. |
| content.alertOpt.alertTarget[].crontab | string | Saved configuration: periodic start time expression; must be paired with crontabDuration. Use either this or the custom date approach. |
| content.alertOpt.alertTarget[].crontabDuration | integer | Saved configuration: duration of the periodic window in seconds; required when crontab is provided; if no repeat period is configured, omit both. |
| content.alertOpt.alertTarget[].customDateUUIDs | array<string> |
Saved configuration: reference to a custom date set, up to 366 items; provide together with customStartTime and customDuration; do not use crontabDuration as a substitute. |
| content.alertOpt.alertTarget[].customDateUUIDs[] | string | Saved configuration: a single date configuration UUID. |
| content.alertOpt.alertTarget[].customStartTime | string | Saved configuration: start time on the custom date; used together with customDateUUIDs/customDuration. |
| content.alertOpt.alertTarget[].customDuration | integer | Saved configuration: duration of the custom date window in seconds; must be provided together with the date set and start time. |
| content.alertOpt.alertTarget[].targets | array<object> |
Saved configuration: status mode action array. |
| content.alertOpt.alertTarget[].targets[] | object | Saved configuration: a single severity action. |
| content.alertOpt.alertTarget[].targets[].status | string | Saved configuration: required severity selection: fatal, critical, error, warning, nodata, info, and uppercase ALL for all; connect multiple values with English commas without spaces. For the security source, use critical, high, medium, low, info, or ALL instead. |
| content.alertOpt.alertTarget[].targets[].df_source | string | Saved configuration: optional; the public target structure supports only security. If omitted, the execution layer excludes the security source. |
| content.alertOpt.alertTarget[].targets[].to | array<string> |
Saved configuration: required array of recipient targets; members, teams, notification targets, or email addresses are supported; agent accounts can use their valid default Webhook. |
| content.alertOpt.alertTarget[].targets[].to[] | string | Saved configuration: in member mode, email/sms/notify_ are commonly used; in status mode, use acnt_/agent_/group_/notify_ or email addresses. Whether channels such as SMS are available depends on the site and target configuration. |
| content.alertOpt.alertTarget[].targets[].tags | object | Saved configuration: in status mode, filter events by field values; in member mode, use the parent alertInfo.filterString; tags here are not used as member selection conditions. |
| content.alertOpt.alertTarget[].targets[].tags.字段 | array<string> | Saved configuration: array of match values for a single field. |
| content.alertOpt.alertTarget[].targets[].tags.字段[] | string | Saved configuration: a single match value. |
| content.alertOpt.alertTarget[].targets[].filterString | string | Saved configuration: in status mode, when non-empty, takes precedence over tags and is also used for escalation actions; in member mode, use the parent alertInfo.filterString; fields within this target are not valid filtering entry points. |
| content.alertOpt.alertTarget[].targets[].upgradeTargets | array<object> |
Saved configuration: optional escalation action; executed after the event remains at the corresponding severity for duration; use [] to configure no escalation. |
| content.alertOpt.alertTarget[].targets[].upgradeTargets[] | object | Saved configuration: a single escalation action. |
| content.alertOpt.alertTarget[].targets[].upgradeTargets[].to | array<string> |
Saved configuration: in member mode, this is the member/team that receives the escalation; in status mode, this is the escalation notification target, which can be a member/team/notification target/email address. |
| content.alertOpt.alertTarget[].targets[].upgradeTargets[].to[] | string | Saved configuration: a single escalation recipient identifier. |
| content.alertOpt.alertTarget[].targets[].upgradeTargets[].duration | integer | Saved configuration: required duration in seconds; each escalation is configured relative to the event's continuous state, and multiple durations are not automatically accumulated. |
| content.alertOpt.alertTarget[].targets[].upgradeTargets[].toWay | array<string> |
Saved configuration: array of notification methods for member escalation; status mode does not use this field. |
| content.alertOpt.alertTarget[].targets[].upgradeTargets[].toWay[] | string | Saved configuration: a single escalation notification method. |
| content.alertOpt.alertTarget[].alertInfo | array<object> |
Saved configuration: array of member groups used only in member mode; status mode does not use it. |
| content.alertOpt.alertTarget[].alertInfo[] | object | Saved configuration: member group object. |
| content.alertOpt.alertTarget[].alertInfo[].name | string | Saved configuration: optional member group name, up to 256 characters. |
| content.alertOpt.alertTarget[].alertInfo[].memberInfo | array<string> |
Saved configuration: array of members/teams that receive regular notifications in member mode, which may include agent accounts; combined with the notification methods in targets.to. |
| content.alertOpt.alertTarget[].alertInfo[].memberInfo[] | string | Saved configuration: a single member or team identifier. |
| content.alertOpt.alertTarget[].alertInfo[].filterString | string | Saved configuration: member group-level event filter; both regular and escalation actions use this condition. |
| content.alertOpt.alertTarget[].alertInfo[].targets | array<object> |
Saved configuration: array of notification methods/severity actions in member mode. |
| content.alertOpt.alertTarget[].alertInfo[].targets[] | object | Saved configuration: a single severity action. |
| content.alertOpt.alertTarget[].alertInfo[].targets[].status | string | Saved configuration: required severity selection: fatal, critical, error, warning, nodata, info, and uppercase ALL for all; connect multiple values with English commas without spaces. For the security source, use critical, high, medium, low, info, or ALL instead. |
| content.alertOpt.alertTarget[].alertInfo[].targets[].df_source | string | Saved configuration: optional; the public target structure supports only security. If omitted, the execution layer excludes the security source. |
| content.alertOpt.alertTarget[].alertInfo[].targets[].to | array<string> |
Saved configuration: in member mode, email, sms, or a notify_ notification target is commonly used to specify the notification method; the execution layer also supports targets such as direct accounts/teams, but using the combination of memberInfo and notification methods is recommended. |
| content.alertOpt.alertTarget[].alertInfo[].targets[].to[] | string | Saved configuration: in member mode, email/sms/notify_ are commonly used; in status mode, use acnt_/agent_/group_/notify_ or email addresses. Whether channels such as SMS are available depends on the site and target configuration. |
| content.alertOpt.alertTarget[].alertInfo[].targets[].tags | object | Saved configuration: in status mode, filter events by field values; in member mode, use the parent alertInfo.filterString; tags here are not used as member selection conditions. |
| content.alertOpt.alertTarget[].alertInfo[].targets[].tags.字段 | array<string> | Saved configuration: array of match values for a single field. |
| content.alertOpt.alertTarget[].alertInfo[].targets[].tags.字段[] | string | Saved configuration: a single match value. |
| content.alertOpt.alertTarget[].alertInfo[].targets[].filterString | string | Saved configuration: in status mode, when non-empty, takes precedence over tags and is also used for escalation actions; in member mode, use the parent alertInfo.filterString; fields within this target are not valid filtering entry points. |
| content.alertOpt.alertTarget[].alertInfo[].targets[].upgradeTargets | array<object> |
Saved configuration: optional escalation action; executed after the event remains at the corresponding severity for duration; use [] to configure no escalation. |
| content.alertOpt.alertTarget[].alertInfo[].targets[].upgradeTargets[] | object | Saved configuration: a single escalation action. |
| content.alertOpt.alertTarget[].alertInfo[].targets[].upgradeTargets[].to | array<string> |
Saved configuration: in member mode, this is the member/team that receives the escalation; in status mode, this is the escalation notification target, which can be a member/team/notification target/email address. |
| content.alertOpt.alertTarget[].alertInfo[].targets[].upgradeTargets[].to[] | string | Saved configuration: a single escalation recipient identifier. |
| content.alertOpt.alertTarget[].alertInfo[].targets[].upgradeTargets[].duration | integer | Saved configuration: required duration in seconds; each escalation is configured relative to the event's continuous state, and multiple durations are not automatically accumulated. |
| content.alertOpt.alertTarget[].alertInfo[].targets[].upgradeTargets[].toWay | array<string> |
Saved configuration: array of notification methods for member escalation; status mode does not use this field. |
| content.alertOpt.alertTarget[].alertInfo[].targets[].upgradeTargets[].toWay[] | string | Saved configuration: a single escalation notification method. |
| content.alertOpt.aggType | string | Saved configuration: optional v2 mode: byFields for rule aggregation, byCluster for intelligent aggregation, byAI for AI aggregation, and byCustom for custom field rule aggregation. If omitted or null, the historical aggFields logic is used; aggregation still requires aggInterval>0. |
| content.alertOpt.ignoreOK | boolean | Saved configuration: optional in v2; ignores normal-severity notifications; defaults to false. |
| content.alertOpt.aggSendFirst | boolean | Saved configuration: optional in v2; whether to send the first item immediately during aggregation; defaults to false; when aggInterval=0, it does not constitute valid aggregation. |
| content.declaration | object or null | Workspace public declaration; write APIs return only the saved entity and do not include additional query fields. |
{
"code": 200,
"content": {
"id": null,
"uuid": "altpl_example",
"workspaceUUID": "wksp_example",
"name": "生产服务告警",
"desc": "",
"alertOpt": {
"alertType": "status",
"aggInterval": 0,
"silentTimeout": 900,
"alertTarget": [
{
"name": "默认通知",
"targets": [
{
"status": "critical",
"to": [
"notify_example"
]
}
]
}
]
},
"ruleTimezone": "Asia/Shanghai",
"score": 0,
"openPermissionSet": false,
"permissionSet": [],
"status": 0,
"creator": "wsak_example",
"updator": "",
"createAt": 1785430800,
"updateAt": -1,
"deleteAt": -1,
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Responses¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | A request field is missing, or a field value violates the declared validation conditions | Parameter parsing failed | Check the parameter location, field name, type, and value. |
| 400 | ft.RequestJsonFormatError | Request JSON syntax is invalid | Request JSON format error | Fix the JSON according to content.reason, line, and column. |
| 400 | ft.JsonFormatError | The JSON top level is not an object | Partial json file format error | Submit a single JSON object. |
| 400 | ft.AlertPolicyNameRepeat | An undeleted policy with the same name exists, or a short-term concurrent creation has taken the name | Alert policy name already exists | First query whether it has already been created; after a short wait, determine whether to retry with a different name. |
| 400 | ft.ParamsValidateError | The status/member action structure or time field dependencies do not comply with the rules | Parameter validation failed: {} | Complete the required fields according to the corresponding mode on this page; custom dates require customDuration, and crontabDuration must not be used as a substitute. |
| 400 | ft.InvalidEventStatus | In status mode, the event severity is not in the corresponding regular/security enumeration | Invalid event status: {} | Use uppercase ALL and the correct source enumeration on this page; do not include spaces between commas. |
| 406 | ft.InvalidCrontabFormat | The periodic expression cannot be parsed | Invalid crontab format | Use a valid Cron expression and provide crontabDuration. |
| 400 | ft.ErrorFilterString | filterString cannot be parsed | filterString parsing failed: {} | First use the console filter to generate valid conditions, or correct them according to the example. |
| 400 | ft.InvalidCustomNoticeDateUUID | The referenced date configuration does not exist, has been deleted, or does not belong to the current workspace | Invalid custom date UUIDs: {} | Obtain a valid UUID again through Custom Notification Dates. |
| 400 | ft.InvalidAggFields | In a non-byCustom mode, aggregation fields that do not meet validation were provided | Invalid aggregation type | Select from the predefined fields, or explicitly select byCustom in v2 and use actual business fields. |
| 400 | ft.TagFieldMissing | df_label aggregation was selected but no non-empty aggLabels was provided | Missing tags | Provide an array of actual tag values. |
| 400 | ft.InvalidAggClusterFields | CLUSTER was selected but no title or content aggregation field was provided | Invalid aggregation fields | aggClusterFields must contain at least df_title or df_message. |
| 400 | ft.UnsupportExternalEmail | A restricted workspace plan used an external email address in a status target | Free Plan workspace; external email addresses are not supported as notification targets | Select a member of the current workspace, or check the plan and channel support. |
| 500 | ft.InternalServerError | A direct exception is triggered by a severity-based repeat alert status value, or saving/caching/other internal processing fails | Internal error | First self-check against the enumerations and complete structure on this page, query the saved status, and then decide whether to retry; if it continues to fail, provide the traceId. |