CloudWatch get-metric-widget-image for gauges?

0

I was trying to get an image from my CloudWatch Dashboard of a Gauge widget that I created.

I am successfully able to download the image, but the image looks more like a line graph than a gauge. Why is that?

% aws cloudwatch get-metric-widget-image --metric-widget file://cpu_gauge.json | grep MetricWidgetImage | awk '{split($0,a,"\""); print a[4]}' | base64 --decode > cpu_gauge.png
# cpu_gauge.json

{
   "view":"gauge",
   "metrics":[
      [
         "AWS/EC2",
         "CPUUtilization",
         "InstanceId",
         "i-000000000000000",
         {
            "region":"ap-northeast-1"
         }
      ],
      [
         "...",
         "i-111111111111111",
         {
            "region":"ap-northeast-1"
         }
      ]
   ],
   "region":"ap-northeast-1",
   "yAxis":{
      "left":{
         "min":0,
         "max":100
      }
   },
   "period":300,
   "title":"CPU (Gauge)"
}

cpu_gauge.png:

Enter image description here


This is the image that I expected to see, and is how I see it on the CloudWatch Dashboard

Enter image description here


Likewise, when I used AWS ChatBot to send the image to slack, it sent the same non-gauge result.

Enter image description here

profile picture
gefragt vor 3 Monaten211 Aufrufe
1 Antwort
1
Akzeptierte Antwort

Hello.

Currently, only "timeSeries | bar | pie" is supported from the API, and "gauge" cannot be obtained.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CloudWatch-Metric-Widget-Structure.html
a

profile picture
EXPERTE
beantwortet vor 3 Monaten
profile picture
EXPERTE
überprüft vor 2 Monaten
  • Thank you for your answer! While this does change the image from a line graph, it expectedly changes it to a pie graph. A gauge would be ideal for me so I'm afraid this doesn't resolve my problem. Thanks anyway

  • Thank you for directing my attention to this in the docs. So gauge is not supported... how unfortunate. Thanks for the help

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen