- Mais recentes
- Mais votos
- Mais comentários
To get metrics for all file paths, you need to use dimensions to filter the metrics.
Each file path would be a different dimension value. So you need to make multiple calls to get_metric_data, each time specifying a different path as the dimension value.
For example:
Make the first call with:
Dimensions=[
{'Name': 'path', 'Value': 'path1'}
]
Make the second call with:
Dimensions=[
{'Name': 'path', 'Value': 'path2'}
]
And so on for each path. The API does not support returning metrics for multiple dimension values in a single call. You need to make separate calls to get the data for each path individually.
A dimension is a name/value pair that is part of the identity of a metric. The file path of the disk on the CloudWatch console for a particular EC2 instance would be one of its dimension. Hence, as it is unique to each metric and instance, the path must be specified separately in the API query for accurate results.
Reference : https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html
In order to look into your requirement and issues you are running into, for the paths further, you can also consider reaching out to AWS via a support case.
Thank you guys for your answers. It helped me a lot. I got result using following dimension format iterating over all the file paths, one file path at atime.
'Dimensions': [
{'Name': 'path', 'Value': '/tmp'},
{'Name': 'InstanceId', 'Value': 'i-00xxxxxxxxxxxx'},
{'Name': 'ImageId', 'Value': 'ami-07xxxxxxxxxxx'},
{'Name': 'InstanceType', 'Value': 't2.micro'},
{'Name': 'device', 'Value': 'tmpfs'},
{'Name': 'fstype', 'Value': 'tmpfs'
]
Where the value can be changed according to what it is in CloudWatch. You can query to find out what the dimension will be for each metrics. These dimension format can be different for different metrics.
Conteúdo relevante
- AWS OFICIALAtualizada há 3 anos
- AWS OFICIALAtualizada há 3 anos
- AWS OFICIALAtualizada há 2 anos
If possible use the code block in your questions so it’s easier to read.
However can you give an example of the path value. Thanks