Skip to content

cloudwatch get-metric-stats

Retrieve CloudWatch metric statistics

Description

retrieve CloudWatch metric statistics

Synopsis

cloudwatch get-metric-stats
    [--site <site>]
    [--region <region>]
    <name>
    --start_time <start_time>
    --end_time <end_time>
    --namespace <namespace>
    [--unit <unit>]
    [--stat <stat>]
    [--extended_stat <extended_stat>]
    --period <period>
    [--dimensions <dimensions>]

Arguments

site - (string)

     Site where this command will be executed
     Example: --site "site-1"
     Default: input.site      Attributes: optional

region - (string)

     AWS region for the service
     Example: --region "region-1"
     Default: _None_      Attributes: optional

name - (string)

     The name of the metric, with or without spaces
     Example: "name-1"
     Default: _None_      Attributes: required

start_time - (time)

     The time stamp indicating the earliest data to be returned
     Example: --start_time "60m ago"
     Default: 60m ago      Attributes: required

end_time - (time)

     The time stamp indicating the latest data to be returned
     Example: --end_time "now"
     Default: now      Attributes: required

namespace - (string)

     The namespace of the metric, with or without spaces
     Example: --namespace "namespace-1"
     Default: _None_      Attributes: required

unit - (string)

     The unit for a given metric
     Example: --unit "Seconds" , --unit "Bytes" , --unit "Percent" , --unit "Count" , --unit "Bytes/Second"
     Default: _None_      Attributes: optional

     Validation:
         allowed values: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None

stat - (string)

     The unit for a given metric
     Example: --stat "SampleCount" , --stat "Average" , --stat "Sum" , --stat "Maximum" , --stat "Minimum"
     Default: _None_      Attributes: optional, multiple allowed

     Validation:
         allowed values: SampleCount, Average, Sum, Maximum, Minimum

extended_stat - (string)

     The percentile stats for a given metric
     Example: --extended_stat "p0.1" , --extended_stat "p99"
     Default: _None_      Attributes: optional, multiple allowed

period - (int)

     The granularity, in seconds, of the returned data points
     Example: --period * Start time between 3 hours and 15 days ago - Use a multiple of 60 seconds (1 minute). * Start time between 15 and 63 days ago - Use a multiple of 300 seconds (5 minutes). * Start time greater than 63 days ago - Use a multiple of 3600 seconds (1 hour).
     Default: _None_      Attributes: required

dimensions - (string)

     The dimensions to filter against
     Example: --dimensions "{"Class":"None"}"
     Default: _None_      Attributes: optional

Examples

cloudwatch get-metric-stats --region "region-1" "name-1" --namespace "namespace-1" --unit "Seconds" --stat "SampleCount" --extended_stat "p0.1" --period * Start time between 3 hours and 15 days ago - Use a multiple of 60 seconds (1 minute). * Start time between 15 and 63 days ago - Use a multiple of 300 seconds (5 minutes). * Start time greater than 63 days ago - Use a multiple of 3600 seconds (1 hour). --dimensions "{"Class":"None"}"

Access Control

To use this command, you need access to the following:

Field Value
Action "read"
Service Type "cloudwatch"
Service Instance
Namespace
Object Type "alarm"
Object ID

Please see Access Control for details.