Skip to main content

fleet_metrics

Creates, updates, deletes, gets or lists a fleet_metrics resource.

Overview

Namefleet_metrics
TypeResource
Idaws.iot.fleet_metrics

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
aggregation_fieldstringThe field to aggregate.
aggregation_typeobjectThe type of aggregation queries.
creation_datestring (date-time)The date when the fleet metric is created.
descriptionstringThe fleet metric description. (pattern: <code>[\p{Graph}\x20]*</code>)
index_namestringThe name of the index to search. (pattern: <code>[a-zA-Z0-9:_-]+</code>)
last_modified_datestring (date-time)The date when the fleet metric is last modified.
metric_arnstringThe ARN of the fleet metric to describe.
metric_namestringThe name of the fleet metric to describe. (pattern: <code>[a-zA-Z0-9_-.]+</code>)
periodintegerThe time in seconds between fleet metric emissions. Range [60(1 min), 86400(1 day)] and must be multiple of 60.
query_stringstringThe search query string.
query_versionstringThe query version.
unitstringUsed to support unit transformation such as milliseconds to seconds. The unit must be supported by CW metric. (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)
versioninteger (int64)The version of the fleet metric.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_fleet_metricselectmetric_name, regionGets information about the specified fleet metric. Requires permission to access the DescribeFleetMetric action.
list_fleet_metricsselectregionnextToken, maxResultsLists all your fleet metrics. Requires permission to access the ListFleetMetrics action.
create_fleet_metricinsertmetric_name, region, queryString, aggregationType, period, aggregationFieldCreates a fleet metric. Requires permission to access the CreateFleetMetric action.
update_fleet_metricupdatemetric_name, region, indexNameUpdates the data for a fleet metric. Requires permission to access the UpdateFleetMetric action.
delete_fleet_metricdeletemetric_name, regionexpectedVersionDeletes the specified fleet metric. Returns successfully with no error if the deletion is successful or you specify a fleet metric that doesn't exist. Requires permission to access the DeleteFleetMetric action.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
metric_namestringThe name of the fleet metric to delete.
regionstringAWS region (default: us-east-1)
expectedVersioninteger (int64)The expected version of the fleet metric to delete.
maxResultsintegerThe maximum number of results to return in this operation.
nextTokenstringTo retrieve the next set of results, the nextToken value from a previous response; otherwise null to receive the first set of results.

SELECT examples

Gets information about the specified fleet metric. Requires permission to access the DescribeFleetMetric action.

SELECT
aggregation_field,
aggregation_type,
creation_date,
description,
index_name,
last_modified_date,
metric_arn,
metric_name,
period,
query_string,
query_version,
unit,
version
FROM aws.iot.fleet_metrics
WHERE metric_name = '{{ metric_name }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a fleet metric. Requires permission to access the CreateFleetMetric action.

INSERT INTO aws.iot.fleet_metrics (
queryString,
aggregationType,
period,
aggregationField,
description,
queryVersion,
indexName,
unit,
tags,
metric_name,
region
)
SELECT
'{{ queryString }}' /* required */,
'{{ aggregationType }}' /* required */,
{{ period }} /* required */,
'{{ aggregationField }}' /* required */,
'{{ description }}',
'{{ queryVersion }}',
'{{ indexName }}',
'{{ unit }}',
'{{ tags }}',
'{{ metric_name }}',
'{{ region }}'
RETURNING
metric_arn,
metric_name
;

UPDATE examples

Updates the data for a fleet metric. Requires permission to access the UpdateFleetMetric action.

UPDATE aws.iot.fleet_metrics
SET
queryString = '{{ queryString }}',
aggregationType = '{{ aggregationType }}',
period = {{ period }},
aggregationField = '{{ aggregationField }}',
description = '{{ description }}',
queryVersion = '{{ queryVersion }}',
indexName = '{{ indexName }}',
unit = '{{ unit }}',
expectedVersion = {{ expectedVersion }}
WHERE
metric_name = '{{ metric_name }}' --required
AND region = '{{ region }}' --required
AND indexName = '{{ indexName }}' --required;

DELETE examples

Deletes the specified fleet metric. Returns successfully with no error if the deletion is successful or you specify a fleet metric that doesn't exist. Requires permission to access the DeleteFleetMetric action.

DELETE FROM aws.iot.fleet_metrics
WHERE metric_name = '{{ metric_name }}' --required
AND region = '{{ region }}' --required
AND expectedVersion = '{{ expectedVersion }}'
;