Queries metric import tasks.

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

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 DescribeHybridMonitorTaskList

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

Keyword String No task

The keyword that is used to search for metric import tasks.

TaskId String No 36****

The ID of the metric import task.

GroupId String No 3607****

The ID of the application group.

For information about how to obtain the ID of an application group, see DescribeMonitorGroups.

Namespace String No aliyun

The name of the namespace.

For information about how to obtain the name of a namespace, see DescribeHybridMonitorNamespaceList.

PageSize Integer No 10

The number of entries per page.

Minimum value: 1. Default value: 10.

PageNumber Integer No 1

The page number.

Pages start from page 1. Default value: 1.

IncludeAliyunTask Boolean No true

Specifies whether the returned result includes metric import tasks for Alibaba Cloud services. Valid values:

  • true (default): includes metric import tasks for Alibaba Cloud services.
  • false: excludes metric import tasks for Alibaba Cloud services.
TaskType String No aliyun_fc

The type of the metric import task. Valid values:

  • aliyun_fc: metric import tasks for Alibaba Cloud services
  • aliyun_sls: metrics for logs imported from Log Service
TargetUserId Long No 120886317861****

The ID of the member account.

Note This parameter is required only if you call this operation to delete metric import tasks that belong to a member in a resource directory. In this case, the TaskType parameter is set to aliyun_fc.

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
RequestId String 11145B76-566A-5D80-A8A3-FAD98D310079

The request ID.

Success String true

Indicates whether the request was successful. Valid values:

  • true
  • false
Code String 200

The status code.

Note The status code 200 indicates that the request was successful.
Message String success

The returned message.

  • If the request was successful, the value successful is returned.
  • If the request failed, an error message is returned.
PageSize Integer 10

The number of entries per page.

PageNumber Integer 1

The page number.

Total Integer 1

The total number of entries returned.

TaskList Array of TaskList

The metric import tasks.

YARMConfig String products:- namespace: acs_ecs_dashboard metric_info: - metric_list: - cpu_total

The configuration file of the Alibaba Cloud service that you want to monitor by using Hybrid Cloud Monitoring.

  • namespace: the namespace of the Alibaba Cloud service.
  • metric_list: the metrics of the Alibaba Cloud service.
CreateTime String 1639382496000

The timestamp when the metric import task was created.

Unit: milliseconds.

TaskName String aliyun_task

The name of the metric import task.

Namespace String aliyun

The namespace to which the host belongs.

UploadRegion String cn-hangzhou

The region where the host resides.

NetworkType String vpc

The network type of the host. Valid values:

  • vpc: a virtual private cloud (VPC)
  • Internet: Internet
CollectTimout Integer 15

The timeout period during which the CloudMonitor agent collects host monitoring data. Valid values:

  • 0
  • 15
  • 30
  • 60

Unit: seconds.

CollectTargetEndpoint String http://localhost

The URL of the destination from which the CloudMonitor agent collects host monitoring data.

TaskType String aliyun_sls

The type of the metric import task. Valid values:

  • aliyun_fc: metric import tasks for Alibaba Cloud services
  • aliyun_sls: metrics for logs imported from Log Service
MatchExpressRelation String or

The relationship between the conditions that are used to filter metric import tasks. Valid values:

  • or
  • and
Description String aliyun

The description of the metric import task.

GroupId String 3607****

The ID of the application group.

CollectInterval Integer 60

The interval at which the CloudMonitor agent collects host monitoring data. Valid values:

  • 15
  • 30
  • 60

Unit: seconds.

TargetUserId String 120886317861****

The ID of the member account.

Note This parameter is returned only if you call this operation by using a management account.
CollectTargetPath String /metrics

The relative path from which the CloudMonitor agent collects monitoring data.

CollectTargetType String nginx

The type of the monitoring data. Valid values: Spring, Tomcat, Nginx, Tengine, JVM, Redis, and MySQL.

TaskId String 36****

The ID of the metric import task.

AttachLabels Array of AttachLabels

The tags of the metric import task.

Name String key1

The tag key

Value String value1

The tag value.

MatchExpress Array of MatchExpress

The conditions that are used to match the instances in the application group.

Value String ECS_instance1

The keyword that corresponds to the instance name.

Name String name

The name of the monitored instance.

Function String all

The method that is used to match the instance name. Valid values:

  • startWith: starts with a prefix
  • endWith: ends with a suffix
  • all: matches all
  • equals: equals
  • contains: contains
  • notContains: does not contain
Instances Array of String i-hp368focau7dp0hw****

The instance ID.

ExtraInfo String test

The additional information of the instance.

LogFilePath String C:\UserData\log\*.Log

The path where on-premises log data is stored. On-premises log data is stored in the specified path of the host where CloudMonitor is deployed.

  • Windows: The log path must start with a drive letter. Example: C:\UserData\log\*.Log. You cannot specify wildcard characters in a log path.
  • Linux: The log path must start with a forward slash (/). Example: /home/appdata/log/**/*.log. In this example, /**/ is used to match all files in the appdata directory.
LogSplit String {"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"}]}}]}

The result that is returned after on-premises log data is split based on the specified matching mode.

Note The matching modes of on-premises log data include full regex mode, delimiter mode, and JSON mode.
LogProcess String [{"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"}]}]

The method that is used to aggregate on-premises log data.

LogSample String {"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"]}}

The sample on-premises log.

SLSProcess String {"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"}]}

The configurations of the logs that are imported from Log Service.

SLSProcessConfig Object

The configurations of the logs that are imported from Log Service.

Note This parameter is returned only if the TaskType parameter is set to aliyun_sls.
Filter Object

The conditions that are used to filter logs imported from Log Service.

Relation String and

The relationship between multiple filter conditions. Valid values:

  • and (default): Logs are processed only if all filter conditions are met.
  • or: Logs are processed if one of the filter conditions is met.
Filters Array of Filters

The conditions that are used to filter logs imported from Log Service.

SLSKeyName String host

The name of the key that is used to filter logs imported from Log Service.

Operator String =

The method that is used to filter logs imported from Log Service. Valid values:

  • contain: contains
  • notContain: does not contain
  • >: greater than
  • <: less than
  • =: equal to
  • ! =: not equal to
  • >=: greater than or equal to
  • <=: less than or equal to
Value String 200

The value of the key that is used to filter logs imported from Log Service.

Statistics Array of Statistics

The method that is used to aggregate logs imported from Log Service.

SLSKeyName String name

The name of the key that is used to aggregate logs imported from Log Service.

Function String count

The function that is used to aggregate the log data of a statistical period. Valid values:

  • count: calculates the number of values of the specified field.
  • sum: calculates the sum of the values of the specified field.
  • avg: calculates the average of the values of the specified field.
  • max: calculates the maximum value of the specified field.
  • min: calculates the minimum value of the specified field.
  • value: collects samples within the statistical period.
  • countps: calculates the sum of the values of the specified field divided by the total number of seconds of the statistical period.
  • sumps: calculates the number of values of the specified field divided by the total number of seconds of the statistical period.
  • distinct: calculates the number of unique values of the specified field within the statistical period.
  • distribution: calculates the number of logs that meet a specified condition within the statistical period.
  • percentile: sorts the values of the specified field in ascending order, and then returns the value that is at the specified percentile (such as P50) within the statistical period.
Alias String level_count

The alias of the aggregation result.

Parameter1 String 200

The value of the function that is used to aggregate logs imported from Log Service.

  • If you set the Function parameter to distribution, this parameter specifies the lower limit of the statistical interval. For example, if you want to calculate the number of HTTP requests whose status code is 2XX, set this parameter to 200.
  • If you set the Function parameter to percentile, this parameter specifies the percentile at which the expected value is. For example, 0.5 specifies P50.
Parameter2 String 299

The value of the function that is used to aggregate logs imported from Log Service.

Note This parameter is returned only if the Function parameter is set to distribution. This parameter indicates the upper limit of the statistical interval. For example, 299 indicates that the number of HTTP requests whose status code is 2XX is calculated.
GroupBy Array of GroupBy

The dimension based on which data is aggregated. This parameter is equivalent to the GROUP BY clause in SQL.

SLSKeyName String code

The name of the key that is used to aggregate logs imported from Log Service.

Alias String ApiResult

The alias of the aggregation result.

Express Array of Express

The extended fields that indicate the results of basic operations that are performed on aggregation results.

Express String success_count

The extended field that indicates the result of basic operations that are performed on aggregation results.

Alias String SuccRate

The alias of the extended field that indicates the result of basic operations that are performed on aggregation results.

Examples

Sample requests

http(s)://[Endpoint]/?Action=DescribeHybridMonitorTaskList
&<Common request parameters>

Sample success responses

XML format

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

<DescribeHybridMonitorTaskListResponse>
	<RequestId>11145B76-566A-5D80-A8A3-FAD98D310079</RequestId>
	<PageSize>10</PageSize>
	<PageNumber>1</PageNumber>
	<Total>1</Total>
	<TaskList>
		<CollectTimout>15</CollectTimout>
		<CollectInterval>0</CollectInterval>
		<Description></Description>
		<TaskId>36****</TaskId>
		<CreateTime>1639382496000</CreateTime>
		<YARMConfig></YARMConfig>
		<CollectTargetPath></CollectTargetPath>
		<Namespace>aliyun</Namespace>
		<GroupId>0</GroupId>
		<MatchExpressRelation></MatchExpressRelation>
		<SLSProcess>{\"express\":[],\"filter\":{\"filters\":[]},\"groupby\":[],\"interval\":60,\"labels\":[],\"statistics\":[{\"alias\":\"referer_count\",\"function\":\"count\",\"key\":\"referer\"}]}</SLSProcess>
		<CollectTargetEndpoint></CollectTargetEndpoint>
		<TaskName>aliyun_task</TaskName>
		<UploadRegion>unknown</UploadRegion>
		<NetworkType>vpc</NetworkType>
		<TaskType>aliyun_sls</TaskType>
		<CollectTargetType></CollectTargetType>
		<TargetUserId></TargetUserId>
	</TaskList>
	<Code>200</Code>
	<Success>true</Success>
</DescribeHybridMonitorTaskListResponse>

JSON format

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

{
  "RequestId" : "11145B76-566A-5D80-A8A3-FAD98D310079",
  "PageSize" : 10,
  "PageNumber" : 1,
  "Total" : 1,
  "TaskList" : [ {
    "CollectTimout" : 15,
    "CollectInterval" : 0,
    "Description" : "",
    "TaskId" : "36****",
    "CreateTime" : 1639382496000,
    "AttachLabels" : [ ],
    "YARMConfig" : "",
    "CollectTargetPath" : "",
    "Namespace" : "aliyun",
    "GroupId" : 0,
    "MatchExpressRelation" : "",
    "Instances" : [ ],
    "SLSProcess" : "{\"express\":[],\"filter\":{\"filters\":[]},\"groupby\":[],\"interval\":60,\"labels\":[],\"statistics\":[{\"alias\":\"referer_count\",\"function\":\"count\",\"key\":\"referer\"}]}",
    "CollectTargetEndpoint" : "",
    "TaskName" : "aliyun_task",
    "UploadRegion" : "unknown",
    "NetworkType" : "vpc",
    "TaskType" : "aliyun_sls",
    "CollectTargetType" : "",
    "TargetUserId" : ""
  } ],
  "Code" : 200,
  "Success" : true
}

Error codes

For a list of error codes, see Service error codes.