aws memo

AWS関連の備忘録 (※本ブログの内容は個人的見解であり、所属組織及び企業の意見を代弁するものではありません。1年以上古いエントリは疑ってかかってください)

CW: CloudWatchのNamespaceとMetricNameの一覧を取得する (PHP)

AmazonCloudWatch::get_metric_statistics で、CloudWatchに溜まったメトリクスを取得するためには、引数として、取得対象のメトリクスの NamespaceとMetricNameを指定する必要がある。

ということで、AmazonCloudWatch::list_metricsを使って、とりあえず今取得できるMetricsの一覧を取得し、その中からNamespaceとMetricNameを抜いてみる。

<?php
require_once '/usr/share/pear/AWSSDKforPHP/sdk.class.php';
$cw = new AmazonCloudWatch();
$cw->set_region(AmazonCloudWatch::REGION_TOKYO);

$res = $cw->list_metrics();
$mets = $res->body->ListMetricsResult->Metrics->member;
$tree = array();
foreach ($mets as $met ){
    $ns = $met->Namespace;
    $mn = $met->MetricName;
    print($ns .":". $mn ."\n");
}
?>

というかんじ。実行結果は

$ php getcw.php  
AWS/ElasticMapReduce:RunningReduceTasks
AWS/EC2:NetworkIn
AWS/ElasticMapReduce:HDFSBytesRead
AWS/ElasticMapReduce:RunningMapTasks
AWS/EC2:NetworkIn
AWS/ElasticMapReduce:RunningReduceTasks
AWS/ElasticMapReduce:RunningReduceTasks
AWS/EBS:VolumeWriteOps
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/EBS:VolumeTotalWriteTime
AWS/EC2:CPUUtilization
AWS/EBS:VolumeWriteBytes
AWS/EBS:VolumeWriteBytes
AWS/EC2:NetworkIn
AWS/EC2:CPUUtilization
AWS/EC2:DiskReadBytes
AWS/EC2:DiskWriteBytes
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/EC2:DiskWriteOps
AWS/ElasticMapReduce:RunningReduceTasks
AWS/RDS:ReadIOPS
AWS/EBS:VolumeQueueLength
AWS/RDS:ReadLatency
AWS/RDS:WriteIOPS
AWS/EBS:VolumeReadBytes
AWS/ElasticMapReduce:HDFSBytesRead
AWS/StorageGateway:WorkingStorageFree
AWS/EC2:DiskReadOps
AWS/EC2:DiskWriteBytes
AWS/ElasticMapReduce:RemainingMapTasksPerSlot
AWS/ElastiCache:NewConnections
AWS/EC2:DiskWriteOps
AWS/EC2:DiskReadBytes
AWS/ElasticMapReduce:RunningReduceTasks
AWS/EC2:NetworkOut
AWS/EC2:DiskWriteOps
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/RDS:ReadThroughput
AWS/ElasticMapReduce:HDFSBytesRead
AWS/EC2:DiskReadOps
AWS/EC2:CPUUtilization
AWS/EC2:DiskWriteOps
AWS/RDS:WriteThroughput
AWS/ElasticMapReduce:RunningReduceTasks
AWS/EC2:NetworkIn
AWS/EC2:NetworkOut
AWS/ElasticMapReduce:RemainingMapTasksPerSlot
AWS/ELB:HTTPCode_ELB_5XX
AWS/ElasticMapReduce:ReduceSlotsOpen
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/ElasticMapReduce:RemainingMapTasksPerSlot
AWS/EC2:DiskWriteOps
AWS/EBS:VolumeTotalWriteTime
AWS/ElasticMapReduce:MissingBlocks
AWS/EC2:DiskReadBytes
AWS/EC2:DiskWriteOps
AWS/EC2:DiskWriteOps
AWS/EBS:VolumeReadBytes
AWS/ElasticMapReduce:HDFSBytesRead
AWS/EC2:DiskWriteBytes
AWS/EC2:NetworkIn
AWS/ElasticMapReduce:S3BytesRead
AWS/EC2:DiskReadOps
AWS/RDS:ReadLatency
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/EC2:CPUUtilization
AWS/ElastiCache:CmdFlush
AWS/EBS:VolumeReadBytes
AWS/ElastiCache:CmdFlush
AWS/RDS:WriteIOPS
AWS/RDS:WriteLatency
AWS/ElasticMapReduce:S3BytesWritten
AWS/EBS:VolumeWriteOps
AWS/EBS:VolumeTotalReadTime
AWS/ElasticMapReduce:MissingBlocks
AWS/ElasticMapReduce:S3BytesRead
AWS/ElasticMapReduce:S3BytesWritten
AWS/ElasticMapReduce:ReduceSlotsOpen
AWS/ElastiCache:CasBadval
AWS/EC2:NetworkIn
AWS/EC2:CPUUtilization
AWS/ElasticMapReduce:CoreNodesRunning
AWS/RDS:WriteIOPS
AWS/ElastiCache:CurrConnections
AWS/RDS:WriteThroughput
AWS/ElasticMapReduce:RunningMapTasks
AWS/ElasticMapReduce:LiveTaskTrackers
AWS/EC2:DiskWriteBytes
AWS/ElastiCache:SwapUsage
AWS/ElasticMapReduce:JobsRunning
AWS/EC2:NetworkOut
AWS/EC2:DiskWriteOps
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/EC2:DiskWriteBytes
AWS/EC2:NetworkOut
AWS/ElasticMapReduce:RunningMapTasks
AWS/EBS:VolumeQueueLength
AWS/EC2:NetworkOut
AWS/EC2:CPUUtilization
AWS/EC2:DiskReadOps
AWS/ElasticMapReduce:RunningMapTasks
AWS/EC2:CPUUtilization
AWS/EC2:DiskWriteOps
AWS/EBS:VolumeIdleTime
AWS/EBS:VolumeIdleTime
AWS/EC2:NetworkIn
AWS/EC2:DiskWriteBytes
AWS/EBS:VolumeTotalReadTime
AWS/ElasticMapReduce:CoreNodesRunning
AWS/EC2:NetworkIn
AWS/EC2:NetworkOut
AWS/ElasticMapReduce:HDFSBytesWritten
AWS/EC2:DiskReadBytes
AWS/EC2:CPUUtilization
AWS/EBS:VolumeTotalReadTime
AWS/ElastiCache:IncrMisses
AWS/EC2:NetworkIn
AWS/RDS:FreeableMemory
AWS/ElasticMapReduce:S3BytesRead
AWS/EBS:VolumeWriteBytes
AWS/EC2:NetworkOut
AWS/EC2:DiskReadOps
AWS/EC2:DiskWriteOps
AWS/EC2:DiskReadOps
AWS/EC2:CPUUtilization
AWS/EBS:VolumeReadBytes
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/ElasticMapReduce:JobsFailed
AWS/EC2:NetworkOut
AWS/ElastiCache:CasHits
AWS/ElasticMapReduce:RunningMapTasks
AWS/ElasticMapReduce:S3BytesRead
AWS/ElasticMapReduce:HDFSUtilization
AWS/ElasticMapReduce:RemainingMapTasks
AWS/ElasticMapReduce:S3BytesRead
AWS/ElasticMapReduce:RunningMapTasks
AWS/EC2:CPUUtilization
AWS/EBS:VolumeQueueLength
AWS/EC2:DiskReadOps
AWS/EC2:DiskWriteOps
AWS/EC2:DiskWriteBytes
AWS/ElasticMapReduce:RunningMapTasks
AWS/ElasticMapReduce:JobsRunning
AWS/EC2:CPUUtilization
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/EC2:NetworkOut
AWS/EC2:NetworkOut
AWS/ElasticMapReduce:RunningMapTasks
AWS/ElasticMapReduce:S3BytesWritten
AWS/EC2:DiskReadOps
AWS/ElasticMapReduce:HDFSBytesWritten
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/EBS:VolumeReadBytes
AWS/EBS:VolumeWriteOps
AWS/EC2:DiskReadOps
AWS/ElastiCache:Evictions
AWS/EC2:NetworkIn
AWS/ElastiCache:Evictions
AWS/EC2:NetworkIn
AWS/EC2:CPUUtilization
AWS/ElasticMapReduce:HDFSBytesWritten
AWS/ElasticMapReduce:RunningReduceTasks
AWS/EC2:NetworkIn
AWS/EBS:VolumeTotalReadTime
AWS/StorageGateway:CloudBytesUploaded
AWS/EC2:NetworkIn
AWS/EC2:NetworkIn
AWS/EC2:CPUUtilization
AWS/ElasticMapReduce:HDFSBytesRead
AWS/RDS:SwapUsage
AWS/ElastiCache:DeleteMisses
AWS/EC2:NetworkIn
AWS/ElasticMapReduce:JobsFailed
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/ElasticMapReduce:RunningMapTasks
AWS/RDS:ReadLatency
AWS/RDS:SwapUsage
AWS/EBS:VolumeReadOps
AWS/EC2:NetworkIn
AWS/EC2:NetworkIn
AWS/EC2:DiskWriteOps
AWS/EC2:DiskReadOps
AWS/EBS:VolumeReadOps
AWS/ElastiCache:GetMisses
AWS/EBS:VolumeReadBytes
AWS/EC2:NetworkIn
AWS/ElasticMapReduce:RemainingMapTasks
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/EC2:DiskReadOps
AWS/EC2:NetworkOut
AWS/ElasticMapReduce:RunningMapTasks
AWS/EC2:DiskReadOps
AWS/ElastiCache:GetHits
AWS/EBS:VolumeWriteBytes
AWS/EC2:DiskReadBytes
AWS/EBS:VolumeReadBytes
AWS/EC2:DiskReadBytes
AWS/EC2:DiskWriteBytes
AWS/EC2:NetworkIn
AWS/ElasticMapReduce:RemainingMapTasks
AWS/RDS:CPUUtilization
AWS/RDS:FreeableMemory
AWS/EBS:VolumeWriteOps
AWS/ElasticMapReduce:MapSlotsOpen
AWS/RDS:ReadIOPS
AWS/EBS:VolumeReadOps
AWS/EC2:DiskWriteOps
AWS/EC2:DiskReadOps
AWS/ElasticMapReduce:RemainingMapTasks
AWS/ElasticMapReduce:S3BytesRead
AWS/ElasticMapReduce:JobsFailed
AWS/EC2:DiskWriteBytes
AWS/EBS:VolumeTotalWriteTime
AWS/ElasticMapReduce:HDFSBytesRead
AWS/EC2:DiskReadOps
AWS/ElasticMapReduce:JobsFailed
AWS/EC2:DiskReadBytes
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/EC2:DiskWriteBytes
AWS/EC2:NetworkOut
AWS/ElasticMapReduce:IsIdle
AWS/EC2:DiskReadBytes
AWS/EC2:DiskReadBytes
AWS/EC2:DiskWriteBytes
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/RDS:WriteThroughput
AWS/EC2:DiskReadBytes
AWS/ElasticMapReduce:HDFSBytesRead
AWS/EC2:DiskWriteBytes
AWS/EC2:CPUUtilization
AWS/ElasticMapReduce:HDFSBytesRead
AWS/ElasticMapReduce:ReduceSlotsOpen
AWS/ElastiCache:BytesWrittenOutFromMemcached
AWS/EBS:VolumeWriteOps
AWS/EBS:VolumeTotalReadTime
AWS/ElasticMapReduce:HDFSBytesWritten
AWS/EC2:DiskReadBytes
AWS/ElasticMapReduce:JobsRunning
AWS/EC2:NetworkIn
AWS/ElasticMapReduce:RunningReduceTasks
AWS/EC2:DiskWriteOps
AWS/ELB:HealthyHostCount
AWS/ElasticMapReduce:RunningMapTasks
AWS/EC2:CPUUtilization
AWS/ElasticMapReduce:CoreNodesPending
AWS/EC2:NetworkIn
AWS/ElasticMapReduce:MapSlotsOpen
AWS/ElasticMapReduce:HDFSUtilization
AWS/EBS:VolumeWriteBytes
AWS/ElasticMapReduce:RemainingMapTasks
AWS/EC2:NetworkIn
AWS/RDS:WriteThroughput
AWS/RDS:WriteIOPS
AWS/EBS:VolumeIdleTime
AWS/EBS:VolumeIdleTime
AWS/ElasticMapReduce:CoreNodesRunning
AWS/ElasticMapReduce:CoreNodesPending
AWS/EC2:DiskReadBytes
AWS/EC2:DiskWriteBytes
AWS/RDS:WriteIOPS
AWS/EC2:DiskWriteBytes
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/ElasticMapReduce:RunningMapTasks
AWS/ElasticMapReduce:RunningReduceTasks
AWS/ElasticMapReduce:IsIdle
AWS/EC2:NetworkOut
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/EC2:DiskReadBytes
AWS/ELB:HealthyHostCount
AWS/EBS:VolumeReadOps
AWS/ElasticMapReduce:LiveTaskTrackers
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/EC2:DiskReadBytes
AWS/EC2:DiskReadOps
AWS/ElasticMapReduce:JobsFailed
AWS/ElasticMapReduce:RunningReduceTasks
AWS/RDS:SwapUsage
AWS/ElasticMapReduce:RunningMapTasks
AWS/ElasticMapReduce:RemainingMapTasks
AWS/EC2:DiskWriteBytes
AWS/RDS:ReadIOPS
AWS/EC2:CPUUtilization
AWS/EC2:DiskWriteOps
AWS/EC2:NetworkOut
AWS/EC2:DiskWriteOps
AWS/ElasticMapReduce:HDFSUtilization
AWS/ELB:HTTPCode_ELB_5XX
AWS/EC2:DiskWriteOps
AWS/RDS:CPUUtilization
AWS/ElasticMapReduce:RemainingMapTasks
AWS/ElasticMapReduce:RunningReduceTasks
AWS/EC2:DiskReadBytes
AWS/EC2:DiskWriteBytes
AWS/ElasticMapReduce:RunningMapTasks
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/EC2:DiskWriteOps
AWS/EBS:VolumeWriteBytes
AWS/EBS:VolumeTotalWriteTime
AWS/ElasticMapReduce:S3BytesRead
AWS/ElasticMapReduce:RunningMapTasks
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/EC2:DiskReadBytes
AWS/ElasticMapReduce:RemainingMapTasks
AWS/EC2:DiskWriteOps
AWS/EC2:DiskWriteBytes
AWS/EBS:VolumeIdleTime
AWS/ElasticMapReduce:HDFSBytesRead
AWS/ElasticMapReduce:RunningReduceTasks
AWS/ElasticMapReduce:RunningReduceTasks
AWS/ElasticMapReduce:RunningReduceTasks
AWS/EC2:DiskReadBytes
AWS/ElasticMapReduce:MapSlotsOpen
AWS/EC2:CPUUtilization
AWS/ElasticMapReduce:TotalLoad
AWS/ELB:UnHealthyHostCount
AWS/EC2:DiskReadBytes
AWS/EBS:VolumeQueueLength
AWS/EC2:DiskWriteBytes
AWS/EC2:DiskReadBytes
AWS/EC2:CPUUtilization
AWS/RDS:FreeStorageSpace
AWS/RDS:ReadIOPS
AWS/EC2:DiskWriteOps
AWS/EC2:DiskReadOps
AWS/EC2:DiskWriteBytes
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/EBS:VolumeQueueLength
AWS/EC2:NetworkOut
AWS/ElasticMapReduce:RemainingMapTasks
AWS/EBS:VolumeReadOps
AWS/EC2:DiskReadOps
AWS/EBS:VolumeTotalWriteTime
AWS/EBS:VolumeWriteBytes
AWS/EC2:DiskReadBytes
AWS/EC2:CPUUtilization
AWS/ElasticMapReduce:RemainingMapTasksPerSlot
AWS/RDS:SwapUsage
AWS/EC2:NetworkOut
AWS/ElasticMapReduce:RemainingMapTasks
AWS/EC2:NetworkOut
AWS/EC2:DiskReadOps
AWS/EBS:VolumeReadOps
AWS/ElasticMapReduce:TotalLoad
AWS/EC2:DiskReadBytes
AWS/ElasticMapReduce:JobsRunning
AWS/ElasticMapReduce:RunningMapTasks
AWS/ElasticMapReduce:RemainingMapTasks
AWS/EC2:DiskWriteOps
AWS/ELB:HTTPCode_ELB_5XX
AWS/ElasticMapReduce:RemainingReduceTasks
AWS/EC2:DiskWriteBytes
AWS/EC2:NetworkOut
AWS/RDS:WriteThroughput
AWS/ElasticMapReduce:RunningReduceTasks
AWS/EC2:DiskWriteBytes
AWS/ElasticMapReduce:MapSlotsOpen
AWS/ElasticMapReduce:MissingBlocks
AWS/RDS:DatabaseConnections
AWS/EC2:NetworkIn
AWS/EC2:DiskReadOps
AWS/EBS:VolumeTotalWriteTime
AWS/ElasticMapReduce:RemainingMapTasks
AWS/EC2:DiskWriteBytes
AWS/ElasticMapReduce:RunningMapTasks
AWS/EC2:DiskWriteOps
AWS/ElasticMapReduce:TotalLoad
AWS/EBS:VolumeQueueLength
AWS/ElasticMapReduce:JobsFailed
AWS/EC2:DiskReadOps
AWS/EC2:NetworkOut
AWS/EC2:DiskReadOps
AWS/ELB:UnHealthyHostCount
AWS/EC2:NetworkOut
AWS/EC2:DiskReadOps
AWS/EC2:DiskReadBytes
AWS/EBS:VolumeIdleTime
AWS/EC2:DiskWriteBytes
AWS/EBS:VolumeTotalReadTime
AWS/ElastiCache:BytesUsedForCacheItems
AWS/RDS:CPUUtilization
AWS/ElasticMapReduce:RunningReduceTasks
AWS/ElasticMapReduce:RemainingMapTasks
AWS/EC2:DiskWriteBytes
AWS/ElastiCache:CmdSet
AWS/EBS:VolumeQueueLength
AWS/EC2:CPUUtilization
AWS/EC2:DiskReadOps
AWS/EC2:NetworkOut
AWS/ElastiCache:FreeableMemory
AWS/EC2:DiskReadBytes
AWS/RDS:ReadThroughput
AWS/RDS:ReadThroughput
AWS/EC2:DiskReadOps
AWS/EC2:DiskReadOps
AWS/EC2:NetworkOut
AWS/ElasticMapReduce:RemainingMapTasks
AWS/ElastiCache:CurrItems
AWS/EC2:NetworkOut
AWS/ElasticMapReduce:RunningMapTasks
AWS/EC2:CPUUtilization
AWS/EC2:NetworkOut
AWS/EBS:VolumeWriteBytes
AWS/EC2:CPUUtilization
AWS/EC2:NetworkIn
AWS/EC2:NetworkIn
AWS/EBS:VolumeIdleTime
AWS/ElasticMapReduce:RunningReduceTasks
AWS/EC2:NetworkIn
AWS/ElasticMapReduce:HDFSUtilization
AWS/ElasticMapReduce:TotalLoad
AWS/ElastiCache:DecrMisses
AWS/EBS:VolumeWriteOps
AWS/ElastiCache:DecrMisses
AWS/EC2:DiskWriteBytes
AWS/StorageGateway:WriteTime
AWS/EC2:NetworkIn
AWS/StorageGateway:WriteBytes
AWS/EC2:NetworkIn
AWS/EC2:NetworkIn
AWS/EC2:NetworkOut
AWS/ElasticMapReduce:HDFSBytesRead
AWS/ElasticMapReduce:TotalLoad
AWS/EC2:NetworkIn
AWS/EC2:CPUUtilization
AWS/RDS:ReadLatency
AWS/EBS:VolumeWriteOps
AWS/RDS:FreeableMemory
AWS/ElasticMapReduce:RunningReduceTasks
AWS/EBS:VolumeIdleTime
AWS/RDS:DatabaseConnections
AWS/EC2:DiskWriteBytes
AWS/ElasticMapReduce:RemainingMapTasks
AWS/EC2:NetworkOut
AWS/EC2:NetworkIn
AWS/EC2:DiskWriteOps
AWS/EBS:VolumeWriteOps
AWS/ElasticMapReduce:RunningMapTasks
AWS/ElasticMapReduce:JobsRunning
AWS/EC2:DiskWriteBytes
AWS/ElasticMapReduce:RemainingMapTasks
AWS/EC2:CPUUtilization
AWS/StorageGateway:WriteTime
AWS/ElasticMapReduce:CoreNodesPending
AWS/EC2:NetworkIn
AWS/EC2:NetworkOut
AWS/ElasticMapReduce:RunningReduceTasks
AWS/ElasticMapReduce:ReduceSlotsOpen
AWS/EC2:DiskWriteBytes
AWS/ElasticMapReduce:RunningReduceTasks
AWS/EBS:VolumeWriteOps
AWS/EBS:VolumeTotalWriteTime
AWS/ElasticMapReduce:LiveDataNodes
AWS/EC2:CPUUtilization
AWS/EC2:CPUUtilization
AWS/ElasticMapReduce:HDFSBytesRead
AWS/EC2:DiskReadBytes
AWS/EC2:DiskReadOps
AWS/ElasticMapReduce:RunningReduceTasks
AWS/EBS:VolumeTotalReadTime
AWS/EBS:VolumeIdleTime
AWS/EBS:VolumeReadOps
AWS/RDS:CPUUtilization
AWS/StorageGateway:WorkingStoragePercentUsed
AWS/EC2:DiskReadOps
AWS/EC2:DiskWriteBytes
AWS/EC2:DiskWriteOps
AWS/EC2:CPUUtilization
AWS/ElasticMapReduce:RemainingMapTasks
AWS/EC2:NetworkIn
AWS/EC2:DiskWriteBytes
AWS/EC2:DiskWriteOps
AWS/EBS:VolumeReadBytes
AWS/ElasticMapReduce:RemainingMapTasks
AWS/ElasticMapReduce:S3BytesWritten
AWS/RDS:FreeStorageSpace
AWS/RDS:FreeStorageSpace
AWS/EBS:VolumeWriteOps
AWS/EC2:CPUUtilization
AWS/ELB:UnHealthyHostCount
AWS/ElastiCache:NetworkBytesIn
AWS/EC2:DiskReadOps
AWS/ElasticMapReduce:RunningReduceTasks
AWS/ElasticMapReduce:MissingBlocks
AWS/ElasticMapReduce:RunningReduceTasks
AWS/ElasticMapReduce:RunningReduceTasks
AWS/EC2:DiskReadBytes
AWS/ElasticMapReduce:ReduceSlotsOpen
AWS/ElasticMapReduce:HDFSBytesWritten
AWS/EC2:DiskReadBytes
AWS/ElasticMapReduce:ReduceSlotsOpen
AWS/EC2:DiskWriteBytes
AWS/StorageGateway:WorkingStorageUsed
AWS/EC2:DiskReadOps
AWS/ElasticMapReduce:S3BytesRead
AWS/ElastiCache:DeleteHits
AWS/StorageGateway:QueuedWrites
AWS/ELB:UnHealthyHostCount
AWS/EBS:VolumeReadBytes
AWS/ElasticMapReduce:IsIdle
AWS/ElastiCache:CasMisses

本当はTree状にするとカッコいいのでしょうが(汗)