fleet_metrics
Creates, updates, deletes, gets or lists a fleet_metrics resource.
Overview
| Name | fleet_metrics |
| Type | Resource |
| Id | aws.iot.fleet_metrics |
Fields
The following fields are returned by SELECT queries:
- describe_fleet_metric
- list_fleet_metrics
| Name | Datatype | Description |
|---|---|---|
aggregation_field | string | The field to aggregate. |
aggregation_type | object | The type of aggregation queries. |
creation_date | string (date-time) | The date when the fleet metric is created. |
description | string | The fleet metric description. (pattern: <code>[\p{Graph}\x20]*</code>) |
index_name | string | The name of the index to search. (pattern: <code>[a-zA-Z0-9:_-]+</code>) |
last_modified_date | string (date-time) | The date when the fleet metric is last modified. |
metric_arn | string | The ARN of the fleet metric to describe. |
metric_name | string | The name of the fleet metric to describe. (pattern: <code>[a-zA-Z0-9_-.]+</code>) |
period | integer | The time in seconds between fleet metric emissions. Range [60(1 min), 86400(1 day)] and must be multiple of 60. |
query_string | string | The search query string. |
query_version | string | The query version. |
unit | string | Used 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) |
version | integer (int64) | The version of the fleet metric. |
| Name | Datatype | Description |
|---|---|---|
metric_arn | string | The fleet metric ARN. |
metric_name | string | The fleet metric name. (pattern: <code>[a-zA-Z0-9_-.]+</code>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_fleet_metric | select | metric_name, region | Gets information about the specified fleet metric. Requires permission to access the DescribeFleetMetric action. | |
list_fleet_metrics | select | region | nextToken, maxResults | Lists all your fleet metrics. Requires permission to access the ListFleetMetrics action. |
create_fleet_metric | insert | metric_name, region, queryString, aggregationType, period, aggregationField | Creates a fleet metric. Requires permission to access the CreateFleetMetric action. | |
update_fleet_metric | update | metric_name, region, indexName | Updates the data for a fleet metric. Requires permission to access the UpdateFleetMetric action. | |
delete_fleet_metric | delete | metric_name, region | expectedVersion | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
metric_name | string | The name of the fleet metric to delete. |
region | string | AWS region (default: us-east-1) |
expectedVersion | integer (int64) | The expected version of the fleet metric to delete. |
maxResults | integer | The maximum number of results to return in this operation. |
nextToken | string | To retrieve the next set of results, the nextToken value from a previous response; otherwise null to receive the first set of results. |
SELECT examples
- describe_fleet_metric
- list_fleet_metrics
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
;
Lists all your fleet metrics. Requires permission to access the ListFleetMetrics action.
SELECT
metric_arn,
metric_name
FROM aws.iot.fleet_metrics
WHERE region = '{{ region }}' -- required
AND nextToken = '{{ nextToken }}'
AND maxResults = '{{ maxResults }}'
;
INSERT examples
- create_fleet_metric
- Manifest
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
;
# Description fields are for documentation purposes
- name: fleet_metrics
props:
- name: metric_name
value: "{{ metric_name }}"
description: Required parameter for the fleet_metrics resource.
- name: region
value: "{{ region }}"
description: Required parameter for the fleet_metrics resource.
- name: queryString
value: "{{ queryString }}"
- name: aggregationType
description: |
The type of aggregation queries.
value:
name: "{{ name }}"
values:
- "{{ values }}"
- name: period
value: {{ period }}
- name: aggregationField
value: "{{ aggregationField }}"
- name: description
value: "{{ description }}"
- name: queryVersion
value: "{{ queryVersion }}"
- name: indexName
value: "{{ indexName }}"
- name: unit
value: "{{ unit }}"
valid_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']
- name: tags
value:
- Key: "{{ Key }}"
Value: "{{ Value }}"
UPDATE examples
- update_fleet_metric
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
- delete_fleet_metric
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 }}'
;