Creates a monitoring rule.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateQualityRule

The operation that you want to perform. Set the value to CreateQualityRule.

BlockType Integer Yes 0

The strength of the monitoring rule. Valid values: 0 and 1. 0 indicates that the monitoring rule is a weak rule. 1 indicates that the monitoring rule is a strong rule.

EntityId Long Yes 15224

The ID of the partition filter expression.

Comment String No Verified

The description of the monitoring rule.

Checker Integer Yes 9

The ID of the calibrator.

ExpectValue String No 0

The expected value of the monitoring result.

Trend String No abs

The trend of the monitoring result.

MethodName String Yes count/table_count

The method used to collect sample data. If you want to use a custom SQL statement as a sampling method, set this parameter to user_define.

Operator String No >

The comparison operator of the monitoring rule.

ProjectName String Yes autotest

The name of the computing engine instance or data source.

Property String No table_id

The fields you want to monitor. If you want to monitor all fields in a table and check the table rows, set this parameter to table_count. If you want to monitor all fields in a table and check the table size, set this parameter to table_size.

PropertyType String No bigint

The data type of the fields that you want to monitor. If you want to monitor all fields in a table, set this parameter to table. If you want to monitor only a specific field, set this parameter to bigint.

RuleType Integer Yes 0

The type of the monitoring rule. Valid values: 0, 1, and 2. 0 indicates that the monitoring rule is created by the system. 1 indicates that the monitoring rule is created by a user. 2 indicates that the monitoring rule is a workspace-level rule.

WhereCondition String No table_id>1

The filter condition or custom SQL statement.

CriticalThreshold String No 20

The threshold for determining that an alert is critical.

WarningThreshold String No 10

The threshold for determining that an alert is a warning.

TemplateId Integer No 7

The ID of the monitoring template.

RegionId String Yes cn-shanghai

The region ID of the workspace. For example, the ID of the China (Shanghai) region is cn-shanghai, and the ID of the China (Zhangjiakou) region is cn-zhangjiakou. The system determines the value of this parameter based on the endpoint that is used to call the operation.

RuleName String Yes 1234

The name of the monitoring rule.

PredictType Integer Yes 0

Specifies whether the monitoring rule is a dynamic threshold rule. Valid values: 0 and 1. 0 indicates that the monitoring rule is not a dynamic threshold rule. 1 indicates that the monitoring rule is a dynamic threshold rule.

Response parameters

Parameter Type Example Description
HttpStatusCode Integer 200

The HTTP status code returned.

Data String 12345

The ID of the monitoring rule that you created.

ErrorMessage String You have no permission.

The error message returned.

RequestId String ecb967ec-c137-48****

The ID of the request.

ErrorCode String 401

The error code returned.

Success Boolean true

Indicates whether the request is successful.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateQualityRule
&BlockType=0
&EntityId=15224
&Comment=Verified
&Checker=9
&ExpectValue=0
&Trend=abs
&MethodName=count/table_count
&Operator=>
&ProjectName=autotest
&Property=table_id
&PropertyType=bigint
&RuleType=0
&WhereCondition=table_id>1
&CriticalThreshold=20
&WarningThreshold=10
&TemplateId=7
&RuleName=1234
&PredictType=0
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateQualityRuleResponse>
    <HttpStatusCode>200</HttpStatusCode>
    <Data>12345</Data>
    <ErrorMessage>You have no permission.</ErrorMessage>
    <RequestId>ecb967ec-c137-48****</RequestId>
    <ErrorCode>401</ErrorCode>
    <Success>true</Success>
</CreateQualityRuleResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "HttpStatusCode" : 200,
  "Data" : 12345,
  "ErrorMessage" : "You have no permission.",
  "RequestId" : "ecb967ec-c137-48****",
  "ErrorCode" : 401,
  "Success" : true
}

Error codes

For a list of error codes, visit the API Error Center.