Amazon CloudWatchのメトリクスをCSVで出力する
前提
jqを使用するのでyum等で別途インストールが必要。
sudo yum -y install jq
コマンド
aws cloudwatch get-metric-statistics --namespace AWS/Neptune --metric-name VolumeBytesUsed --start-time 2020-05-06T00:00:00 --end-time 2020-05-07T12:00:00 --period 300 --statistics Average --dimensions Name=DBClusterIdentifier,Value=neploadtest1 | jq -r '.Datapoints[] | [ .Timestamp ,.Average ,.Unit] | @csv' | sort -t ',' -k 1
結果
[ec2-user@bastin ~]$ aws cloudwatch get-metric-statistics --namespace AWS/Neptune --metric-name VolumeBytesUsed --start-time 2020-05-06T00:00:00 --end-time 2020-05-07T12:00:00 --period 300 --statistics Average --dimensions Name=DBClusterIdentifier,Value=neploadtest1 | jq -r '.Datapoints[] | [ .Timestamp ,.Average ,.Unit] | @csv' | sort -t ',' -k 1
"2020-05-06T06:05:00Z",0,"Bytes"
"2020-05-06T06:15:00Z",126189568,"Bytes"
"2020-05-06T06:20:00Z",24679677952,"Bytes"
"2020-05-06T06:25:00Z",24679677952,"Bytes"
"2020-05-06T06:30:00Z",24679677952,"Bytes"
"2020-05-06T06:35:00Z",35896573952,"Bytes"
"2020-05-06T06:40:00Z",35896573952,"Bytes"
"2020-05-06T06:45:00Z",35896573952,"Bytes"
"2020-05-06T06:50:00Z",55787798528,"Bytes"
"2020-05-06T06:55:00Z",55787798528,"Bytes"
"2020-05-06T07:00:00Z",64544718848,"Bytes"
"2020-05-06T07:05:00Z",64544718848,"Bytes"
"2020-05-06T07:10:00Z",64544718848,"Bytes"
"2020-05-06T07:15:00Z",64546799616,"Bytes"
"2020-05-06T07:20:00Z",64546799616,"Bytes"
"2020-05-06T07:25:00Z",64546799616,"Bytes"
"2020-05-06T07:30:00Z",76659359744,"Bytes"
"2020-05-06T07:35:00Z",76659359744,"Bytes"
"2020-05-06T07:40:00Z",92551282688,"Bytes"
"2020-05-06T07:45:00Z",92551282688,"Bytes"
"2020-05-06T07:50:00Z",92551282688,"Bytes"
"2020-05-06T07:55:00Z",93257973760,"Bytes"
関連しているかもしれない記事
- Elasticsearchの個人的によく使うコマンド集
- Elasticsearchのエイリアス設定方法
- Elasticsearchのマスターノードの確認
- Aurora PostgreSQL でリードレプリカかプライマリか見分ける方法
- EC2にElasticsearch + kibanaをインストールする