tencent cloud

Feedback

CreatePolicyGroup

Last updated: 2023-08-11 16:09:13

1. API Description

Domain name for API request: monitor.tencentcloudapi.com.

This API is used to add a policy group.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CreatePolicyGroup.
Version Yes String Common Params. The value used for this API: 2018-07-24.
Region No String Common Params. This parameter is not required for this API.
GroupName Yes String Policy group name.
Module Yes String The value is fixed to monitor.
ViewName No String Name of the view to which the policy group belongs. If the policy group is created based on a template, this parameter is optional.
ProjectId No Integer ID of the project to which the policy group belongs, which will be used for authentication.
ConditionTempGroupId No Integer ID of a template-based policy group. This parameter is required only when the policy group is created based on a template.
IsShielded No Integer Whether the policy group is shielded. The value 0 indicates that the policy group is not shielded. The value 1 indicates that the policy group is shielded. The default value is 0.
Remark No String Remarks of the policy group.
InsertTime No Integer Insertion time in the format of Unix timestamp. If this parameter is not configured, the backend processing time is used.
Conditions.N No Array of CreatePolicyGroupCondition Alarm threshold rules in the policy group.
EventConditions.N No Array of CreatePolicyGroupEventCondition Event alarm rules in the policy group.
BackEndCall No Integer Whether it is a backend call. Rules pulled from the policy template will be used to fill in the Conditions and EventConditions fields only when the value of this parameter is 1.
IsUnionRule No Integer The 'AND' and 'OR' rules for alarm metrics. The value 0 indicates 'OR', which means that an alarm will be triggered when any rule is met. The value 1 indicates 'AND', which means that an alarm will be triggered only when all rules are met.

3. Output Parameters

Parameter Name Type Description
GroupId Integer ID of the created policy group.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Adding a policy group

Input Example

POST / HTTP/1.1
Host: monitor.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreatePolicyGroup
<Common request parameters>

{
    "EventConditions": [
        {
            "EventId": "42",
            "AlarmNotifyType": "0",
            "AlarmNotifyPeriod": "0"
        }
    ],
    "Remark": "backup_group",
    "BackEndCall": "0",
    "ViewName": "cvm_device",
    "ProjectId": "0",
    "Module": "monitor",
    "IsUnionRule": "1",
    "GroupName": "test_group",
    "Conditions": [
        {
            "MetricId": "19",
            "CalcType": "1",
            "AlarmNotifyPeriod": "0",
            "ContinuePeriod": "1",
            "AlarmNotifyType": "0",
            CalcPeriod
            "CalcValue": "100"
        }
    ]
}

Output Example

{
    "Response": {
        "GroupId": 1288099,
        "RequestId": "a91f70ed-e385-4817-9928-994ff06e56ec"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation Operation failed.
InternalError Internal error.
InvalidParameter Invalid parameter.
LimitExceeded Quota limit is reached.
MissingParameter Missing parameter.
ResourceInUse The resource is in use.
ResourceInsufficient Insufficient resources.
ResourceNotFound The resource is not found.
ResourceUnavailable The resource is unavailable.
ResourcesSoldOut The resources have been sold out.
UnauthorizedOperation Unauthorized operation.
UnknownParameter Unknown parameter.
UnsupportedOperation Unsupported operation.
Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support