probe CloudWatch

get_metric_statistics

Get the value of a statistical calculation for a given metric

Run it now
View details
Typeprobe
Modulechaosaws.cloudwatch.probes
Nameget_metric_statistics
Returnmapping

Usage

JSON

{
  "name": "get-metric-statistics",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosaws.cloudwatch.probes",
    "func": "get_metric_statistics",
    "arguments": {
      "namespace": "",
      "metric_name": ""
    }
  }
}

YAML

name: get-metric-statistics
provider:
  arguments:
    metric_name: ""
    namespace: ""
  func: get_metric_statistics
  module: chaosaws.cloudwatch.probes
  type: python
type: probe

Arguments

NameTypeDefaultRequiredTitleDescriptionPlaceholder
namespacestringYesNamespaceAWS Cloud Watch namespaceAWS/ApplicationELB
metric_namestringYesMetric NameName of the metric to fetch data forHTTPCode_ELB_5XX_Count
dimension_namestringnullNoDimension NameName of a dimension of the metric, or use dimensions belowLoadBalancer
dimension_valuestringnullNoDimension ValueValue for the dimension name above when setapp/web
dimensionslistnullNoDimensionsList of dimension objects to fetch data for, when not using a single dimension above
statisticstringnullNoStatisticType of data to return: Average, Sum, Minimum, Maximum, SampleCountSum
extended_statisticstringnullNoExtended Statistic
unitstringnullNoUnit TypeThe unit type of the data to collect
durationinteger300NoDurationHow far back should we start from the offset in seconds
offsetinteger0NoOffsetWhen do we start looking back in seconds from now

The period for which the calculation will be performed is specified by a duration and an offset from the current time. Both are specified in seconds.

Example: A duration of 60 seconds and an offset of 30 seconds will yield a statistical value based on the time interval between 30 and 90 seconds in the past.

Is required one of: dimension_name, dimension_value: Required to search for ONE dimension

dimensions: Required to search for dimensions combinations, are expected as a list of dictionary objects: [{‘Name’: ‘Dim1’, ‘Value’: ‘Val1’}, {‘Name’: ‘Dim2’, ‘Value’: ‘Val2’}, ...]

More information about input parameters are available in the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/cloudwatch.html#CloudWatch.Client.get_metric_statistics

Signature

def get_metric_statistics(namespace: str,
                          metric_name: str,
                          dimension_name: str = None,
                          dimension_value: str = None,
                          dimensions: List[Dict[str, str]] = None,
                          duration: int = 60,
                          offset: int = 0,
                          statistic: str = None,
                          extended_statistic: str = None,
                          unit: str = None,
                          configuration: Dict[str, Dict[str, str]] = None,
                          secrets: Dict[str, Dict[str, str]] = None):
    pass