create_fleet_metric

IoT.Client.create_fleet_metric(**kwargs)

Creates a fleet metric.

Requires permission to access the CreateFleetMetric action.

See also: AWS API Documentation

Request Syntax

response = client.create_fleet_metric(
    metricName='string',
    queryString='string',
    aggregationType={
        'name': 'Statistics'|'Percentiles'|'Cardinality',
        'values': [
            'string',
        ]
    },
    period=123,
    aggregationField='string',
    description='string',
    queryVersion='string',
    indexName='string',
    unit='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',
    tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
Parameters
  • metricName (string) --

    [REQUIRED]

    The name of the fleet metric to create.

  • queryString (string) --

    [REQUIRED]

    The search query string.

  • aggregationType (dict) --

    [REQUIRED]

    The type of the aggregation query.

    • name (string) -- [REQUIRED]

      The name of the aggregation type.

    • values (list) --

      A list of the values of aggregation types.

      • (string) --
  • period (integer) --

    [REQUIRED]

    The time in seconds between fleet metric emissions. Range [60(1 min), 86400(1 day)] and must be multiple of 60.

  • aggregationField (string) --

    [REQUIRED]

    The field to aggregate.

  • description (string) -- The fleet metric description.
  • queryVersion (string) -- The query version.
  • indexName (string) -- The name of the index to search.
  • unit (string) -- Used to support unit transformation such as milliseconds to seconds. The unit must be supported by CW metric. Default to null.
  • tags (list) --

    Metadata, which can be used to manage the fleet metric.

    • (dict) --

      A set of key/value pairs that are used to manage the resource.

      • Key (string) -- [REQUIRED]

        The tag's key.

      • Value (string) --

        The tag's value.

Return type

dict

Returns

Response Syntax

{
    'metricName': 'string',
    'metricArn': 'string'
}

Response Structure

  • (dict) --

    • metricName (string) --

      The name of the fleet metric to create.

    • metricArn (string) --

      The Amazon Resource Name (ARN) of the new fleet metric.

Exceptions

  • IoT.Client.exceptions.InvalidRequestException
  • IoT.Client.exceptions.ThrottlingException
  • IoT.Client.exceptions.UnauthorizedException
  • IoT.Client.exceptions.ServiceUnavailableException
  • IoT.Client.exceptions.InternalFailureException
  • IoT.Client.exceptions.LimitExceededException
  • IoT.Client.exceptions.ResourceAlreadyExistsException
  • IoT.Client.exceptions.ResourceNotFoundException
  • IoT.Client.exceptions.InvalidQueryException
  • IoT.Client.exceptions.InvalidAggregationException
  • IoT.Client.exceptions.IndexNotReadyException