Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hc2p
Last active July 20, 2016 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hc2p/19876f7860291107604f809c08f6ad5b to your computer and use it in GitHub Desktop.
Save hc2p/19876f7860291107604f809c08f6ad5b to your computer and use it in GitHub Desktop.
cloudwatch AWS/ECS returns wrong CPUUtilization metrics when both dimensions, ClusterName and ServiceName are set. It does return correctly when dimension is only ClusterName.
$ aws cloudwatch get-metric-statistics --namespace AWS/ECS --metric-name CPUUtilization --period 180 --statistics Average --dimensions Name=ClusterName,Value=jet-production Name=ServiceName,Value=jet-production --start-time 2016-07-14T10:15:00 --end-time 2016-07-14T11:00:00
{
"Datapoints": [
{
"Timestamp": "2016-07-14T10:48:00Z",
"Average": 81675.18434092174,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:39:00Z",
"Average": 103709.39114214522,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:51:00Z",
"Average": 19.330512713270576,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:18:00Z",
"Average": 16.2821569693716,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:27:00Z",
"Average": 37230.54646701979,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:57:00Z",
"Average": 18.988085901528077,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:54:00Z",
"Average": 18.80328689123455,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:24:00Z",
"Average": 17.175868162634778,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:30:00Z",
"Average": 104176.17951806249,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:45:00Z",
"Average": 104851.72961204791,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:15:00Z",
"Average": 16.909794673585054,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:36:00Z",
"Average": 104887.60920090285,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:33:00Z",
"Average": 105251.61943050016,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:21:00Z",
"Average": 41.90878309540742,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:42:00Z",
"Average": 103630.95255462469,
"Unit": "Percent"
}
],
"Label": "CPUUtilization"
}
$ aws cloudwatch get-metric-statistics --namespace AWS/ECS --metric-name CPUUtilization --period 180 --statistics Average --dimensions Name=ClusterName,Value=jet-production --start-time 2016-07-14T10:15:00 --end-time 2016-07-14T11:00:00
{
"Datapoints": [
{
"Timestamp": "2016-07-14T10:48:00Z",
"Average": 40.0651929788911,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:39:00Z",
"Average": 50.83104127746113,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:51:00Z",
"Average": 0.16231633914084506,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:18:00Z",
"Average": 0.08878160775666348,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:27:00Z",
"Average": 18.335167804843206,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:57:00Z",
"Average": 0.15746615980602038,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:54:00Z",
"Average": 0.1568291576746688,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:24:00Z",
"Average": 0.1466204669430024,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:30:00Z",
"Average": 51.05638192994016,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:45:00Z",
"Average": 51.388086287679876,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:15:00Z",
"Average": 0.13577438407027495,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:36:00Z",
"Average": 52.023197701320214,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:33:00Z",
"Average": 51.58542941101794,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:21:00Z",
"Average": 1.6066724619559898,
"Unit": "Percent"
},
{
"Timestamp": "2016-07-14T10:42:00Z",
"Average": 50.793050104675935,
"Unit": "Percent"
}
],
"Label": "CPUUtilization"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment