ServiceResource / Collection / metrics

metrics#

CloudWatch.ServiceResource.metrics#

A collection of Metric resources.A Metric Collection will include all resources by default, and extreme caution should be taken when performing actions on all resources.

all()#

Creates an iterable of all Metric resources in the collection.

See also: AWS API Documentation

Request Syntax

metric_iterator = cloudwatch.metrics.all()
Return type:

list(cloudwatch.Metric)

Returns:

A list of Metric resources

filter(**kwargs)#

Creates an iterable of all Metric resources in the collection filtered by kwargs passed to method. A Metric collection will include all resources by default if no filters are provided, and extreme caution should be taken when performing actions on all resources.

See also: AWS API Documentation

Request Syntax

metric_iterator = cloudwatch.metrics.filter(
    Namespace='string',
    MetricName='string',
    Dimensions=[
        {
            'Name': 'string',
            'Value': 'string'
        },
    ],
    NextToken='string',
    RecentlyActive='PT3H',
    IncludeLinkedAccounts=True|False,
    OwningAccount='string'
)
Parameters:
  • Namespace (string) – The metric namespace to filter against. Only the namespace that matches exactly will be returned.

  • MetricName (string) – The name of the metric to filter against. Only the metrics with names that match exactly will be returned.

  • Dimensions (list) –

    The dimensions to filter against. Only the dimensions that match exactly will be returned.

    • (dict) –

      Represents filters for a dimension.

      • Name (string) – [REQUIRED]

        The dimension name to be matched.

      • Value (string) –

        The value of the dimension to be matched.

  • NextToken (string) – The token returned by a previous call to indicate that there is more data available.

  • RecentlyActive (string) –

    To filter the results to show only metrics that have had data points published in the past three hours, specify this parameter with a value of PT3H. This is the only valid value for this parameter.

    The results that are returned are an approximation of the value you specify. There is a low probability that the returned results include metrics with last published data as much as 40 minutes more than the specified time interval.

  • IncludeLinkedAccounts (boolean) –

    If you are using this operation in a monitoring account, specify true to include metrics from source accounts in the returned data.

    The default is false.

  • OwningAccount (string) – When you use this operation in a monitoring account, use this field to return metrics only from one source account. To do so, specify that source account ID in this field, and also specify true for IncludeLinkedAccounts.

Return type:

list(cloudwatch.Metric)

Returns:

A list of Metric resources

limit(**kwargs)#

Creates an iterable up to a specified amount of Metric resources in the collection.

See also: AWS API Documentation

Request Syntax

metric_iterator = cloudwatch.metrics.limit(
    count=123
)
Parameters:

count (integer) – The limit to the number of resources in the iterable.

Return type:

list(cloudwatch.Metric)

Returns:

A list of Metric resources

page_size(**kwargs)#

Creates an iterable of all Metric resources in the collection, but limits the number of items returned by each service call by the specified amount.

See also: AWS API Documentation

Request Syntax

metric_iterator = cloudwatch.metrics.page_size(
    count=123
)
Parameters:

count (integer) – The number of items returned by each service call

Return type:

list(cloudwatch.Metric)

Returns:

A list of Metric resources