Queries metric import tasks.
Operation description
This topic provides an example on how to query all metric import tasks that belong to the current Alibaba Cloud account. The returned result indicates that the current account has only one metric import task. The metric import task is named aliyun_task
.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
cms:DescribeHybridMonitorTaskList | list |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
Keyword | string | No | The keyword that is used for the search. | task |
TaskId | string | No | The ID of the metric import task. | 36**** |
GroupId | string | No | The ID of the application group. For information about how to obtain the ID of an application group, see DescribeMonitorGroups . | 3607**** |
Namespace | string | No | The name of the namespace. For information about how to obtain the name of a namespace, see DescribeHybridMonitorNamespaceList . | aliyun |
PageSize | integer | No | The number of entries per page. Pages start from page 1. Default value: 10. | 10 |
PageNumber | integer | No | The page number. Pages start from page 1. Default value: 1. | 1 |
IncludeAliyunTask | boolean | No | Specifies whether the returned result includes metric import tasks for Alibaba Cloud services. Valid values:
| true |
TaskType | string | No | The type of the metric import task. Valid values:
| aliyun_fc |
TargetUserId | long | No | The ID of the member account. Note
This parameter is required only if you use a management account to call this operation to delete the metric import tasks that belong to a member in a resource directory. In this case, the TaskType parameter is set to aliyun_fc .
| 120886317861**** |
For more information about common request parameters, see Common parameters.
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "11145B76-566A-5D80-A8A3-FAD98D310079",
"Success": "true",
"Code": "200",
"Message": "success",
"PageSize": 10,
"PageNumber": 1,
"Total": 1,
"TaskList": [
{
"YARMConfig": "products:- namespace: acs_ecs_dashboard metric_info: - metric_list: - cpu_total",
"CreateTime": "1639382496000",
"TaskName": "aliyun_task",
"Namespace": "aliyun",
"UploadRegion": "cn-hangzhou",
"NetworkType": "vpc",
"CollectTimout": 15,
"CollectTargetEndpoint": "http://localhost",
"TaskType": "aliyun_sls",
"MatchExpressRelation": "or",
"Description": "aliyun",
"GroupId": "3607****",
"CollectInterval": 60,
"TargetUserId": "120886317861****",
"CollectTargetPath": "/metrics",
"CollectTargetType": "nginx",
"TaskId": "36****",
"AttachLabels": [
{
"Name": "key1",
"Value": "value1"
}
],
"MatchExpress": [
{
"Value": "ECS_instance1",
"Name": "name",
"Function": "all"
}
],
"Instances": [
"i-hp368focau7dp0hw****"
],
"ExtraInfo": "test",
"LogFilePath": "C:\\UserData\\log\\*.Log",
"LogSplit": "{\"type\": \"regex\",\"regex\": \"\\\\d+\\\\.\\\\d+\\\\.\\\\d+\\\\.\\\\d+\\\\s+(\\\\d+)\\\\s+\\\\S+\\\\s+\\\\[\\\\d+/\\\\S+/\\\\d+:\\\\d+:\\\\d+:\\\\d+\\\\s+\\\\+\\\\d+\\\\]\\\\s+(\\\\S+)\\\\s+\\\\S+\\\\s+/\\\\S+/\\\\S+/\\\\S+\\\\s+(\\\\d+)\",\"columns\": [{\"name\": \"field1\"},{\"name\": \"filed2\",\"translate\": {\"default\": \"-\",\"mappings\": [{\"from\": \"(\\\\w+)\",\"to\": \"$1x\",\"type\": \"regex\"}]}},{\"name\": \"filed3\",\"translate\": {\"default\": \"-\",\"mappings\": [{\"from\": \"NumberRange(100,300)\",\"to\": \"true\",\"type\": \"function\"}]}}]}",
"LogProcess": "[{\"metric\": \"metric1\",\"filters\": [{\"column\": \"filed2\",\"type\": \"include\",\"values\": [\"222222\"]}],\"groupBys\": [{\"column\": \"filed3\",\"name\": \"filed3\"}],\"calculates\": [{\"column\": \"field1\",\"name\": \"avg\",\"type\": \"avg\"}]},{\"metric\": \"metric2\",\"filters\": [{\"column\": \"field1\",\"type\": \"include\",\"values\": [\"11111\"]}],\"groupBys\": [{\"column\": \"filed2\",\"name\": \"filed2\"}],\"calculates\": [{\"column\": \"field1\",\"name\": \"avg\",\"type\": \"avg\"}]}]",
"LogSample": "{\"logContent\":\"100.116.134.26 1119 - [13/Aug/2019:16:55:46 +0800] POST metrichub-cn-hongkong.aliyun.com /agent/metrics/putLines 200 0 \\\"-\\\" \\\"127.0.0.1:7001\\\" \\\"Go-http-client/1.1\\\" \\\"-\\\" \\\"-\\\" \\\"0a98a21a15656865460656276e\\\"\",\"addData\":{\"field1\":[\"1119\",\"1119\"],\"filed2\":[\"POSTx\",\"POST\"],\"filed3\":[\"true\",\"200\"]}}",
"SLSProcess": "{\"express\": [],\"filter\": {\"filters\": [{\"key\": \"task_type\",\"operator\": \"=\",\"value\": \"1\"}]},\"groupby\": [{\"alias\": \"isp\",\"key\": \"isp\",\"sqlKey\": \"t.`isp`\",\"valueKey\": \"isp\"}],\"interval\": 60,\"labels\": [{\"name\": \"__cms_app__\",\"type\": 0,\"value\": \"sitemonitor\"}],\"statistics\": [{\"alias\": \"http_dns_time_avg\",\"function\": \"avg\",\"key\": \"http_dns_time\"}]}",
"SLSProcessConfig": {
"Filter": {
"Relation": "and",
"Filters": [
{
"SLSKeyName": "host",
"Operator": "=",
"Value": "200"
}
]
},
"Statistics": [
{
"SLSKeyName": "name",
"Function": "count",
"Alias": "level_count",
"Parameter1": "200",
"Parameter2": "299"
}
],
"GroupBy": [
{
"SLSKeyName": "code",
"Alias": "ApiResult"
}
],
"Express": [
{
"Express": "success_count",
"Alias": "SuccRate"
}
]
}
}
]
}
Error codes
HTTP status code | Error code | Error message |
---|---|---|
400 | %s | %s |
500 | InternalError | %s |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2022-07-20 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2021-10-25 | Add Operation | View Change Details |