probe CloudWatch

get_metric_data

Gets metric data for a given metric in a given time period. This method allows for more data to be retrieved than get_metric_statistics

Run it now
View details
Typeprobe
Modulechaosaws.cloudwatch.probes
Nameget_metric_data
Returnnumber

Usage

JSON

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

YAML

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

Arguments

NameTypeDefaultRequiredTitleDescription
namespacestringYesNamespaceAWS Cloud Watch namespace
metric_namestringYesMetric NameName of the metric to fetch data for
dimension_namestringnullNoDimension NameName of a dimension of the metric, or use dimensions below
dimension_valuestringnullNoDimension ValueValue for the dimension name above when set
dimensionslistnullNoDimensionsList of dimension objects to fetch data for, when not using a single dimension above
statisticstringnullNoStatisticsType of data to return: Average, Sum, Minimum, Maximum, SampleCount
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
periodinteger60NoPeriodThe window for which pull data points
  • namespace: The AWS metric namespace
  • metric_name: The name of the metric to pull data for
  • One of: dimension_name, dimension_value: Required to search for ONE dimension
  • dimensions: Required to search for dimensions combinations, expected as a list of dictionary objects: [{‘Name’: ‘Dim1’, ‘Value’: ‘Val1’}, {‘Name’: ‘Dim2’, ‘Value’: ‘Val2’}, ...]
  • unit: The type of unit desired to be collected
  • statistic: The type of data to return
    • One of: Average, Sum, Minimum, Maximum, SampleCount
  • period: The window in which to pull datapoints for
  • offset: The time (seconds) to offset the end time (from now)
  • duration: The time (seconds) to set the start time (from now)

Signature

def get_metric_data(namespace: str,
                    metric_name: str,
                    dimension_name: str = None,
                    dimension_value: str = None,
                    dimensions: List[Dict[str, str]] = None,
                    statistic: str = None,
                    duration: int = 300,
                    period: int = 60,
                    offset: int = 0,
                    unit: str = None,
                    configuration: Dict[str, Dict[str, str]] = None,
                    secrets: Dict[str, Dict[str, str]] = None) -> float:
    pass