IoT.Client.
create_custom_metric
(**kwargs)¶Use this API to define a Custom Metric published by your devices to Device Defender.
Requires permission to access the CreateCustomMetric action.
See also: AWS API Documentation
Request Syntax
response = client.create_custom_metric(
metricName='string',
displayName='string',
metricType='string-list'|'ip-address-list'|'number-list'|'number',
tags=[
{
'Key': 'string',
'Value': 'string'
},
],
clientRequestToken='string'
)
[REQUIRED]
The name of the custom metric. This will be used in the metric report submitted from the device/thing. The name can't begin with aws:
. You can't change the name after you define it.
[REQUIRED]
The type of the custom metric.
Warning
The type number
only takes a single metric value as an input, but when you submit the metrics value in the DeviceMetrics report, you must pass it as an array with a single value.
Metadata that can be used to manage the custom metric.
A set of key/value pairs that are used to manage the resource.
The tag's key.
The tag's value.
[REQUIRED]
Each custom metric must have a unique client request token. If you try to create a new custom metric that already exists with a different token, an exception occurs. If you omit this value, Amazon Web Services SDKs will automatically generate a unique client request.
This field is autopopulated if not provided.
dict
Response Syntax
{
'metricName': 'string',
'metricArn': 'string'
}
Response Structure
(dict) --
metricName (string) --
The name of the custom metric to be used in the metric report.
metricArn (string) --
The Amazon Resource Number (ARN) of the custom metric. For example, arn:aws-partition:iot:region:accountId:custommetric/metricName
Exceptions
IoT.Client.exceptions.InvalidRequestException
IoT.Client.exceptions.LimitExceededException
IoT.Client.exceptions.ResourceAlreadyExistsException
IoT.Client.exceptions.ThrottlingException
IoT.Client.exceptions.InternalFailureException