enableMetricsCollection method
Enables group metrics for the specified Auto Scaling group. For more information, see Monitoring CloudWatch metrics for your Auto Scaling groups and instances in the Amazon EC2 Auto Scaling User Guide.
May throw ResourceContentionFault.
Parameter autoScalingGroupName
:
The name of the Auto Scaling group.
Parameter granularity
:
The granularity to associate with the metrics to collect. The only valid
value is 1Minute
.
Parameter metrics
:
Specifies which group-level metrics to start collecting. You can specify
one or more of the following metrics:
-
GroupMinSize
-
GroupMaxSize
-
GroupDesiredCapacity
-
GroupInServiceInstances
-
GroupPendingInstances
-
GroupStandbyInstances
-
GroupTerminatingInstances
-
GroupTotalInstances
-
GroupInServiceCapacity
-
GroupPendingCapacity
-
GroupStandbyCapacity
-
GroupTerminatingCapacity
-
GroupTotalCapacity
Implementation
Future<void> enableMetricsCollection({
required String autoScalingGroupName,
required String granularity,
List<String>? metrics,
}) async {
ArgumentError.checkNotNull(autoScalingGroupName, 'autoScalingGroupName');
_s.validateStringLength(
'autoScalingGroupName',
autoScalingGroupName,
1,
255,
isRequired: true,
);
ArgumentError.checkNotNull(granularity, 'granularity');
_s.validateStringLength(
'granularity',
granularity,
1,
255,
isRequired: true,
);
final $request = <String, dynamic>{};
$request['AutoScalingGroupName'] = autoScalingGroupName;
$request['Granularity'] = granularity;
metrics?.also((arg) => $request['Metrics'] = arg);
await _protocol.send(
$request,
action: 'EnableMetricsCollection',
version: '2011-01-01',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
shape: shapes['EnableMetricsCollectionQuery'],
shapes: shapes,
);
}