CreateHybridMonitorTask
Creates a monitoring task for Alibaba Cloud services or Simple Log Service (SLS) logs.
Operation description
Request description
Before you call this operation, make sure that Hybrid Cloud Monitoring is activated.
To create a metric for SLS logs, make sure that Simple Log Service is activated, and a project and a Logstore are created.
Some parameters are required based on the TaskType. For example, if TaskType is set to aliyun_fc, you must configure YARMConfig. If TaskType is set to aliyun_sls, you must configure parameters such as CollectInterval.
For cross-account operations, you can specify TargetUserId or TargetUserIdList to import resources of other members to Hybrid Cloud Monitoring.
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 service data import 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 aliyun_sls. Valid values:
|
60 |
| GroupId |
string |
No |
The ID of the application group. For information about how to obtain the ID of an application group, see DescribeMonitorGroups. Note
This parameter is required only when TaskType is set to aliyun_sls. |
3607**** |
| YARMConfig |
string |
No |
The configuration file for the Alibaba Cloud service that is connected to Hybrid Cloud Monitoring.
Sample configuration file:
Note
This parameter is required when TaskType is set to aliyun_fc. |
products:- namespace: acs_ecs_dashboard metric_info: - metric_list: - cpu_total |
| TargetUserId |
string |
No |
The ID of the member. When you invoke this API by using a management account, you can use the cloud native mode to connect the Alibaba Cloud services of any member in the resource folder to Hybrid Cloud Monitoring (CloudMonitor). This allows you to monitor the target Alibaba Cloud services across accounts in an enterprise by using the resource folder. Note
The Settings for this parameter are required only when TaskType is set to aliyun_fc. |
120886317861**** |
| AttachLabels |
array<object> |
No |
The tags of the metric. Note
This parameter is required only when TaskType is set to aliyun_sls. |
|
|
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 members. Separate multiple member 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 for SLS logs. Note
This parameter is required only when TaskType is set to aliyun_sls. |
|
| Filter |
object |
No |
The filter conditions for parameters in SLS logs. |
|
| Relation |
string |
No |
The relationship between multiple parameter 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 filtered parameter in SLS logs. |
code |
| Operator |
string |
No |
The filtering method for parameter values in SLS logs. Valid values:
Valid values:
|
= |
| Value |
string |
No |
The filter value of the parameter in SLS logs. |
200 |
| Statistics |
array<object> |
No |
The statistical method for SLS logs. |
|
|
object |
No |
None. |
||
| SLSKeyName |
string |
No |
The name of the parameter for SLS log statistics. |
name |
| Function |
string |
No |
The aggregation method used to process log data based on the selected statistical method within the calculation period. Valid values:
|
count |
| Alias |
string |
No |
The alias of the SLS log statistical 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 distribution. It specifies the upper limit of the statistical range. For example, to count the number of 2XX HTTP status codes, enter 299. |
299 |
| GroupBy |
array<object> |
No |
Aggregates data by dimension, which is equivalent to GROUP BY 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 statistical result. |
ApiResult |
| Express |
array<object> |
No |
The arithmetic operation result of the extended fields in the SLS log statistical result. |
|
|
object |
No |
None. |
||
| Express |
string |
No |
The arithmetic operation result of the extended fields in the SLS log statistical result. |
success_count |
| Alias |
string |
No |
The alias of the arithmetic operation result of the extended fields in the SLS log statistical result. |
SuccRate |
| CloudAccessId |
array |
No |
The list of Alibaba Cloud account IDs used by other cloud providers to connect to CloudMonitor. |
|
|
string |
No |
The Alibaba Cloud account ID used by other cloud providers to connect 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
A status code of 200 indicates that the call was successful. |
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.