Calls the CreateHybridMonitorTask operation to create a data import task for an Alibaba Cloud service or a metric for Simple Log Service (SLS) logs.
Operation description
Before you begin
-
Make sure that you have activated Hybrid Cloud Monitoring. For more information, see Activate Hybrid Cloud Monitoring.
-
If you want to create a metric for SLS logs, make sure that you have activated SLS and created a project and a Logstore. For more information, see Quick Start.
Operation description
This topic provides an example of how to create a data import task named aliyun_task for an Alibaba Cloud service to import the cpu_total metric of Elastic Compute Service (ECS) into the aliyun metric repository. The response shows that the data import task is created.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
cms:CreateHybridMonitorTask |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Namespace |
string |
Yes |
The name of the metric repository. For information about how to obtain the name of a metric repository, see DescribeHybridMonitorNamespaceList. |
aliyun |
| Description |
string |
No |
The description of the monitoring task. |
Alibaba Cloud product data ingestion task. |
| TaskName |
string |
No |
The name of the monitoring task.
|
aliyun_task |
| TaskType |
string |
Yes |
The type of the monitoring task. Valid values:
Valid values:
|
aliyun_fc |
| CollectTargetType |
string |
Yes |
The type of the collection target for monitoring data.
|
aliyun_fc |
| CollectInterval |
string |
No |
The collection period of the metric. Valid values:
Unit: seconds. Note
This parameter is required only when TaskType is set to Valid values:
|
60 |
| GroupId |
string |
No |
The ID of the application group. For information about how to obtain the application group ID, see DescribeMonitorGroups. Note
This parameter is required only when TaskType is set to |
3607**** |
| YARMConfig |
string |
No |
The configuration file of the Alibaba Cloud service that is connected to Hybrid Cloud Monitoring.
The following example shows a sample configuration file:
Note
This parameter is required only when TaskType is set to |
products:- namespace: acs_ecs_dashboard metric_info: - metric_list: - cpu_total |
| TargetUserId |
string |
No |
The ID of the member account. When you call this operation by using a management account, you can connect any Alibaba Cloud service of any member account in the resource directory to Hybrid Cloud Monitoring. This allows you to use the resource directory to monitor the Alibaba Cloud services of member accounts across the enterprise in a unified manner. Note
This parameter is required only when TaskType is set to |
120886317861**** |
| AttachLabels |
array<object> |
No |
The tags of the metric. Note
This parameter is required only when TaskType is set to |
|
|
object |
No |
None. |
||
| Value |
string |
No |
The tag value of the metric. |
testValue |
| Name |
string |
No |
The tag key of the metric. |
app_service |
| TargetUserIdList |
string |
No |
The IDs of the member accounts. Separate multiple IDs with commas (,). Note
This parameter is required only when you call this operation by using a management account. |
120886317861**** |
| SLSProcessConfig |
object |
No |
The configurations of SLS logs. Note
This parameter is required only when TaskType is set to |
|
| Filter |
object |
No |
The filter conditions for parameters in SLS logs. |
|
| Relation |
string |
No |
The relationship between multiple filter conditions. Valid values:
Valid values:
|
and |
| Filters |
array<object> |
No |
The list of filter conditions for parameters in SLS logs. |
|
|
object |
No |
None. |
||
| SLSKeyName |
string |
No |
The name of the parameter that is used to filter logs. |
code |
| Operator |
string |
No |
The operator that is used to filter logs based on the parameter value. Valid values:
|
= |
| Value |
string |
No |
The value of the parameter that is used to filter logs. |
200 |
| Statistics |
array<object> |
No |
The method used to aggregate SLS log data. |
|
|
object |
No |
None. |
||
| SLSKeyName |
string |
No |
The name of the parameter for SLS log statistics. |
name |
| Function |
string |
No |
Aggregates log data within the statistical period by using the specified statistical method. Valid values:
|
count |
| Alias |
string |
No |
The alias of the SLS log statistics result. |
level_count |
| Parameter1 |
string |
No |
The statistical value of SLS logs.
|
200 |
| Parameter2 |
string |
No |
The statistical value of SLS logs. Note
This parameter is required only when Function is set to |
299 |
| GroupBy |
array<object> |
No |
Aggregates data by spatial dimension, which is equivalent to the GROUP BY clause in SQL. |
|
|
object |
No |
None. |
||
| SLSKeyName |
string |
No |
The name of the parameter for SLS log statistics. |
code |
| Alias |
string |
No |
The alias of the SLS log statistics result. |
ApiResult |
| Express |
array<object> |
No |
The result of arithmetic operations on the extended fields of SLS log statistics results. |
|
|
object |
No |
None. |
||
| Express |
string |
No |
The result of arithmetic operations on the extended fields of SLS log statistics results. |
success_count |
| Alias |
string |
No |
The alias of the arithmetic operation result on the extended fields of SLS log statistics results. |
SuccRate |
| CloudAccessId |
array |
No |
The IDs of the accounts of other cloud providers that are connected to CloudMonitor. |
|
|
string |
No |
The ID of the account of another cloud provider that is connected to CloudMonitor. |
n5n9ik1b**** |
For more information about common request parameters, see Common parameters.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
None. |
||
| Code |
string |
The status code. Note
200 indicates success. |
200 |
| Message |
string |
The error message. |
yamlConfigFail |
| RequestId |
string |
The request ID. |
28CEA2E0-3E90-51B2-A7E8-B1ED75534E49 |
| Success |
string |
Indicates whether the operation was successful. Valid values:
|
true |
| TaskId |
integer |
The ID of the monitoring task. |
36**** |
Examples
Success response
JSON format
{
"Code": "200",
"Message": "yamlConfigFail",
"RequestId": "28CEA2E0-3E90-51B2-A7E8-B1ED75534E49",
"Success": "true",
"TaskId": 0
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | %s | %s | |
| 500 | %s | %s | |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 403 | %s | %s | |
| 404 | %s | %s | |
| 409 | %s | %s |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.