How we can get the medialive for a particular metrics data using aws cli?

0

Running below query? aws cloudwatch get-metric-data \

--metric-data-queries '[ { "Id": "m1", "MetricStat": { "Metric": { "Namespace": "AWS/MediaLive", "MetricName": "NetworkOut", "Dimensions": [ { "Name": "ChannelId", "Value": "4333058" } ] }, "Period": 60, "Stat": "Sum" }, "ReturnData": true } ]'
--start-time "$(date -u -d '30 minutes ago' '+%Y-%m-%dT%H:%M:%SZ')"
--end-time "$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
--region ap-south-1 Getting response as below **{ "MetricDataResults": [ { "Id": "m1", "Label": "NetworkOut", "Timestamps": [], "Values": [], "StatusCode": "Complete" } ], "Messages": [] } ** Getting no values for the Timestamps and Values.

4 Answers
0

Hi,

your call parameters look OK, so usually when you get an empty result it is driven by a typo in dimension values, that the metric is actually empty, or that the start-time and end-time don't match any data.

In order to lift ambiguity for a possible mistake in dimension values, the best would be to call aws cloudwatch list-metrics --namespace "AWS/MediaLive" and make sure the output lists NetworkOut with the exact array of dimensions and dimension values you're trying to query. According to MediaLive documentation, NetworkOut supports dimensions ChannelId, Pipeline => are you missing the Pipeline dimension? If you are, you'd need to add it to your array of dimensions, you must have a 100% match of the dimension array in your get-metric-data call with the dimension arrays that list-metrics will give you.

profile pictureAWS
Jsc
answered 4 months ago
profile picture
EXPERT
reviewed 14 days ago
0

@Jsc thank you for your answer but it did't worked. Can you please suggest where i am wrong.

answered 4 months ago
0

1- could you please share the output of aws cloudwatch list-metrics --namespace "AWS/MediaLive" --dimensions "[ { "Name": "ChannelId", "Value": "4333058" } ]" for double check? 2- can you try with a wider time range, have you checked for possible time sync issues or timezone discrepancy between what the date command gives you and your data?

profile pictureAWS
Jsc
answered 3 months ago
0

If you get the metric name and full list of dimensions 100% right, the next thing I can think of is timestamp mismatch

profile pictureAWS
Jsc
answered 3 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions