GetMetricWidgetImage not able to retrieve image

0

I am trying to get Dashboard metric graphs using GetMetricWidgetImage API, Could not figure out how make it work.

Below is the postman screen

Enter image description here

demandé il y a un an387 vues
2 réponses
1

Hi There

If you don't use one of the AWS SDKs, you can make CloudWatch API requests over HTTP using the POST request method. The POST method requires you to specify the operation in the header of the request and provide the data for the operation in JSON format in the body of the request. See https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/making-api-requests.html#CloudWatch-API-requests-using-post-method

You will need to construct the MetricWidget parameter in json format and pass it with your POST request. See https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricWidgetImage.html

profile pictureAWS
EXPERT
Matt-B
répondu il y a un an
0

@Matt-B

Below is the request I am using (redacted credentials) , able to see error message ( {"__type":"com.amazon.coral.service#UnknownOperationException"} ) when request is sent. Can you help to resolve this.

curl --location --request POST 'http://monitoring.us-east-1.amazonaws.com'
--header 'x-amz-target: GraniteServiceVersion20100801.MetricWidget'
--header 'Content-Encoding: amz-1.0'
--header 'X-Amz-Content-Sha256: beaead3198f7da1e70d03ab969765e0821b24fc913697e929e726aeaebf0eba3'
--header 'X-Amz-Date: 20230104T054615Z'
--header 'Authorization: AWS4-HMAC-SHA256 Credential=<redacted>/20230104/us-east-1/execute-api/aws4_request, SignedHeaders=content-encoding;host;x-amz-content-sha256;x-amz-date;x-amz-target, Signature=6d1c80d2b6c38895ee28dacae25d756387d2e37595d67a0ae5b5b08e34c679a8'
--header 'Content-Type: application/json'
--data-raw '{ "OutputFormat":"png", "MetricWidget":{ "width":600, "height":395, "metrics": [ [ "AWS/EC2", "CPUUtilization", "AutoScalingGroupName", "LoadTest-Clister-A", { "visible": false } ], [ "AWS/EC2", "CPUUtilization", "InstanceId", "i-0fff55f4e57f7289d" ], [ "AWS/EC2", "CPUUtilization", "InstanceId", "i-0c9c05fa7dc1a28f2" ], [ "AWS/EC2", "CPUUtilization", "InstanceId", "i-0349c01a4508abd6e" ], [ "AWS/EC2", "CPUUtilization", "InstanceId", "i-0d2eea8bd67634a75" ], [ "AWS/EC2", "CPUUtilization", "AutoScalingGroupName", "LoadTest-ML" ], [ "AWS/EC2", "CPUUtilization", "AutoScalingGroupName", "Loadtest-Monitoring" ], [ "AWS/EC2", "CPUUtilization", "AutoScalingGroupName", "platform-loadtest-clustera" ] ], "view": "timeSeries", "stacked": false, "region": "us-east-1", "title": "CPU Utilization", "stat": "Maximum", "period":300, "start":"-P30D", "end":"PT0H", "yAxis":{ "left":{ "min":0.1, "max":1 }, "right":{ "min":0 } }, "annotations":{ "horizontal":[ { "color":"#ff6961", "label":"Trouble threshold start", "fill":"above", "value":0.5 } ], "vertical":[ { "visible":true, "color":"#9467bd", "label":"Bug fix deployed", "value":"2018-08-28T15:25:26Z", "fill":"after" } ] } } } '

répondu il y a un an
  • You have: --header 'x-amz-target: GraniteServiceVersion20100801.MetricWidget'

    Usage is: GraniteServiceVersion20100801.API_Name

    API_Name should be GetMetricWidgetImage GraniteServiceVersion20100801.GetMetricData

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions