8
8
)
9
9
10
10
var metricsMap map [string ][]string
11
+ var dimensionsMap map [string ][]string
11
12
12
13
func init () {
13
14
metricsMap = map [string ][]string {
@@ -22,52 +23,48 @@ func init() {
22
23
"BytesUsedForCacheItems" , "BytesReadIntoMemcached" , "BytesWrittenOutFromMemcached" , "CasBadval" , "CasHits" , "CasMisses" , "CmdFlush" , "CmdGet" , "CmdSet" , "CurrConnections" , "CurrItems" , "DecrHits" , "DecrMisses" , "DeleteHits" , "DeleteMisses" , "Evictions" , "GetHits" , "GetMisses" , "IncrHits" , "IncrMisses" , "Reclaimed" ,
23
24
"CurrConnections" , "Evictions" , "Reclaimed" , "NewConnections" , "BytesUsedForCache" , "CacheHits" , "CacheMisses" , "ReplicationLag" , "GetTypeCmds" , "SetTypeCmds" , "KeyBasedCmds" , "StringBasedCmds" , "HashBasedCmds" , "ListBasedCmds" , "SetBasedCmds" , "SortedSetBasedCmds" , "CurrItems" ,
24
25
},
25
- "AWS/EBS" : []string {"VolumeReadBytes" , "VolumeWriteBytes" , "VolumeReadOps" , "VolumeWriteOps" , "VolumeTotalReadTime" , "VolumeTotalWriteTime" , "VolumeIdleTime" , "VolumeQueueLength" , "VolumeThroughputPercentage" , "VolumeConsumedReadWriteOps" },
26
- "AWS/ELB" : []string {"HealthyHostCount" , "UnHealthyHostCount" , "RequestCount" , "Latency" , "HTTPCode_ELB_4XX" , "HTTPCode_ELB_5XX" , "HTTPCode_Backend_2XX" , "HTTPCode_Backend_3XX" , "HTTPCode_Backend_4XX" , "HTTPCode_Backend_5XX" , "BackendConnectionErrors" , "SurgeQueueLength" , "SpilloverCount" },
26
+ "AWS/EBS" : []string {"VolumeReadBytes" , "VolumeWriteBytes" , "VolumeReadOps" , "VolumeWriteOps" , "VolumeTotalReadTime" , "VolumeTotalWriteTime" , "VolumeIdleTime" , "VolumeQueueLength" , "VolumeThroughputPercentage" , "VolumeConsumedReadWriteOps" },
27
+ "AWS/ELB" : []string {"HealthyHostCount" , "UnHealthyHostCount" , "RequestCount" , "Latency" , "HTTPCode_ELB_4XX" , "HTTPCode_ELB_5XX" , "HTTPCode_Backend_2XX" , "HTTPCode_Backend_3XX" , "HTTPCode_Backend_4XX" , "HTTPCode_Backend_5XX" , "BackendConnectionErrors" , "SurgeQueueLength" , "SpilloverCount" },
28
+ "AWS/ElasticMapReduce" : []string {"CoreNodesPending" , "CoreNodesRunning" , "HBaseBackupFailed" , "HBaseMostRecentBackupDuration" , "HBaseTimeSinceLastSuccessfulBackup" , "HDFSBytesRead" , "HDFSBytesWritten" , "HDFSUtilization" , "IsIdle" , "JobsFailed" , "JobsRunning" , "LiveDataNodes" , "LiveTaskTrackers" , "MapSlotsOpen" , "MissingBlocks" , "ReduceSlotsOpen" , "RemainingMapTasks" , "RemainingMapTasksPerSlot" , "RemainingReduceTasks" , "RunningMapTasks" , "RunningReduceTasks" , "S3BytesRead" , "S3BytesWritten" , "TaskNodesPending" , "TaskNodesRunning" , "TotalLoad" },
29
+ "AWS/Kinesis" : []string {"PutRecord.Bytes" , "PutRecord.Latency" , "PutRecord.Success" , "PutRecords.Bytes" , "PutRecords.Latency" , "PutRecords.Records" , "PutRecords.Success" , "IncomingBytes" , "IncomingRecords" , "GetRecords.Bytes" , "GetRecords.IteratorAgeMilliseconds" , "GetRecords.Latency" , "GetRecords.Success" },
30
+ "AWS/ML" : []string {"PredictCount" , "PredictFailureCount" },
31
+ "AWS/OpsWorks" : []string {"cpu_idle" , "cpu_nice" , "cpu_system" , "cpu_user" , "cpu_waitio" , "load_1" , "load_5" , "load_15" , "memory_buffers" , "memory_cached" , "memory_free" , "memory_swap" , "memory_total" , "memory_used" , "procs" },
32
+ "AWS/Redshift" : []string {"CPUUtilization" , "DatabaseConnections" , "HealthStatus" , "MaintenanceMode" , "NetworkReceiveThroughput" , "NetworkTransmitThroughput" , "PercentageDiskSpaceUsed" , "ReadIOPS" , "ReadLatency" , "ReadThroughput" , "WriteIOPS" , "WriteLatency" , "WriteThroughput" },
33
+ "AWS/RDS" : []string {"BinLogDiskUsage" , "CPUUtilization" , "DatabaseConnections" , "DiskQueueDepth" , "FreeableMemory" , "FreeStorageSpace" , "ReplicaLag" , "SwapUsage" , "ReadIOPS" , "WriteIOPS" , "ReadLatency" , "WriteLatency" , "ReadThroughput" , "WriteThroughput" , "NetworkReceiveThroughput" , "NetworkTransmitThroughput" },
34
+ "AWS/Route53" : []string {"HealthCheckStatus" , "HealthCheckPercentageHealthy" },
35
+ "AWS/SNS" : []string {"NumberOfMessagesPublished" , "PublishSize" , "NumberOfNotificationsDelivered" , "NumberOfNotificationsFailed" },
36
+ "AWS/SQS" : []string {"NumberOfMessagesSent" , "SentMessageSize" , "NumberOfMessagesReceived" , "NumberOfEmptyReceives" , "NumberOfMessagesDeleted" , "ApproximateNumberOfMessagesDelayed" , "ApproximateNumberOfMessagesVisible" , "ApproximateNumberOfMessagesNotVisible" },
37
+ "AWS/S3" : []string {"BucketSizeBytes" , "NumberOfObjects" },
38
+ "AWS/SWF" : []string {"DecisionTaskScheduleToStartTime" , "DecisionTaskStartToCloseTime" , "DecisionTasksCompleted" , "StartedDecisionTasksTimedOutOnClose" , "WorkflowStartToCloseTime" , "WorkflowsCanceled" , "WorkflowsCompleted" , "WorkflowsContinuedAsNew" , "WorkflowsFailed" , "WorkflowsTerminated" , "WorkflowsTimedOut" },
39
+ "AWS/StorageGateway" : []string {"CacheHitPercent" , "CachePercentUsed" , "CachePercentDirty" , "CloudBytesDownloaded" , "CloudDownloadLatency" , "CloudBytesUploaded" , "UploadBufferFree" , "UploadBufferPercentUsed" , "UploadBufferUsed" , "QueuedWrites" , "ReadBytes" , "ReadTime" , "TotalCacheSize" , "WriteBytes" , "WriteTime" , "WorkingStorageFree" , "WorkingStoragePercentUsed" , "WorkingStorageUsed" , "CacheHitPercent" , "CachePercentUsed" , "CachePercentDirty" , "ReadBytes" , "ReadTime" , "WriteBytes" , "WriteTime" , "QueuedWrites" },
40
+ "AWS/WorkSpaces" : []string {"Available" , "Unhealthy" , "ConnectionAttempt" , "ConnectionSuccess" , "ConnectionFailure" , "SessionLaunchTime" , "InSessionLatency" , "SessionDisconnect" },
41
+ }
42
+ dimensionsMap = map [string ][]string {
43
+ "AWS/AutoScaling" : []string {"AutoScalingGroupName" },
44
+ "AWS/Billing" : []string {"ServiceName" , "LinkedAccount" , "Currency" },
45
+ "AWS/CloudFront" : []string {"DistributionId" , "Region" },
46
+ "AWS/CloudSearch" : []string {},
47
+ "AWS/DynamoDB" : []string {"TableName" , "GlobalSecondaryIndexName" , "Operation" },
48
+ "AWS/ElastiCache" : []string {"CacheClusterId" , "CacheNodeId" },
49
+ "AWS/EBS" : []string {"VolumeId" },
50
+ "AWS/EC2" : []string {"AutoScalingGroupName" , "ImageId" , "InstanceId" , "InstanceType" },
51
+ "AWS/ELB" : []string {"LoadBalancerName" , "AvailabilityZone" },
52
+ "AWS/ElasticMapReduce" : []string {"ClusterId" , "JobId" },
53
+ "AWS/Kinesis" : []string {"StreamName" },
54
+ "AWS/ML" : []string {"MLModelId" , "RequestMode" },
55
+ "AWS/OpsWorks" : []string {"StackId" , "LayerId" , "InstanceId" },
56
+ "AWS/Redshift" : []string {"NodeID" , "ClusterIdentifier" },
57
+ "AWS/RDS" : []string {"DBInstanceIdentifier" , "DatabaseClass" , "EngineName" },
58
+ "AWS/Route53" : []string {"HealthCheckId" },
59
+ "AWS/SNS" : []string {"Application" , "Platform" , "TopicName" },
60
+ "AWS/SQS" : []string {"QueueName" },
61
+ "AWS/S3" : []string {"BucketName" , "StorageType" },
62
+ "AWS/SWF" : []string {"Domain" , "ActivityTypeName" , "ActivityTypeVersion" },
63
+ "AWS/StorageGateway" : []string {"GatewayId" , "GatewayName" , "VolumeId" },
64
+ "AWS/WorkSpaces" : []string {"DirectoryId" , "WorkspaceId" },
27
65
}
28
66
}
29
67
30
- // "AWS/ElasticMapReduce": [
31
- // "CoreNodesPending", "CoreNodesRunning", "HBaseBackupFailed", "HBaseMostRecentBackupDuration", "HBaseTimeSinceLastSuccessfulBackup", "HDFSBytesRead", "HDFSBytesWritten", "HDFSUtilization", "IsIdle", "JobsFailed", "JobsRunning", "LiveDataNodes", "LiveTaskTrackers", "MapSlotsOpen", "MissingBlocks", "ReduceSlotsOpen", "RemainingMapTasks", "RemainingMapTasksPerSlot", "RemainingReduceTasks", "RunningMapTasks", "RunningReduceTasks", "S3BytesRead", "S3BytesWritten", "TaskNodesPending", "TaskNodesRunning", "TotalLoad"
32
- // ],
33
- // "AWS/Kinesis": [
34
- // "PutRecord.Bytes", "PutRecord.Latency", "PutRecord.Success", "PutRecords.Bytes", "PutRecords.Latency", "PutRecords.Records", "PutRecords.Success", "IncomingBytes", "IncomingRecords", "GetRecords.Bytes", "GetRecords.IteratorAgeMilliseconds", "GetRecords.Latency", "GetRecords.Success"
35
- // ],
36
- // "AWS/ML": [
37
- // "PredictCount", "PredictFailureCount"
38
- // ],
39
- // "AWS/OpsWorks": [
40
- // "cpu_idle", "cpu_nice", "cpu_system", "cpu_user", "cpu_waitio", "load_1", "load_5", "load_15", "memory_buffers", "memory_cached", "memory_free", "memory_swap", "memory_total", "memory_used", "procs"
41
- // ],
42
- // "AWS/Redshift": [
43
- // "CPUUtilization", "DatabaseConnections", "HealthStatus", "MaintenanceMode", "NetworkReceiveThroughput", "NetworkTransmitThroughput", "PercentageDiskSpaceUsed", "ReadIOPS", "ReadLatency", "ReadThroughput", "WriteIOPS", "WriteLatency", "WriteThroughput"
44
- // ],
45
- // "AWS/RDS": [
46
- // "BinLogDiskUsage", "CPUUtilization", "DatabaseConnections", "DiskQueueDepth", "FreeableMemory", "FreeStorageSpace", "ReplicaLag", "SwapUsage", "ReadIOPS", "WriteIOPS", "ReadLatency", "WriteLatency", "ReadThroughput", "WriteThroughput", "NetworkReceiveThroughput", "NetworkTransmitThroughput"
47
- // ],
48
- // "AWS/Route53": [
49
- // "HealthCheckStatus", "HealthCheckPercentageHealthy"
50
- // ],
51
- // "AWS/SNS": [
52
- // "NumberOfMessagesPublished", "PublishSize", "NumberOfNotificationsDelivered", "NumberOfNotificationsFailed"
53
- // ],
54
- // "AWS/SQS": [
55
- // "NumberOfMessagesSent", "SentMessageSize", "NumberOfMessagesReceived", "NumberOfEmptyReceives", "NumberOfMessagesDeleted", "ApproximateNumberOfMessagesDelayed", "ApproximateNumberOfMessagesVisible", "ApproximateNumberOfMessagesNotVisible"
56
- // ],
57
- // "AWS/S3": [
58
- // "BucketSizeBytes", "NumberOfObjects"
59
- // ],
60
- // "AWS/SWF": [
61
- // "DecisionTaskScheduleToStartTime", "DecisionTaskStartToCloseTime", "DecisionTasksCompleted", "StartedDecisionTasksTimedOutOnClose", "WorkflowStartToCloseTime", "WorkflowsCanceled", "WorkflowsCompleted", "WorkflowsContinuedAsNew", "WorkflowsFailed", "WorkflowsTerminated", "WorkflowsTimedOut"
62
- // ],
63
- // "AWS/StorageGateway": [
64
- // "CacheHitPercent", "CachePercentUsed", "CachePercentDirty", "CloudBytesDownloaded", "CloudDownloadLatency", "CloudBytesUploaded", "UploadBufferFree", "UploadBufferPercentUsed", "UploadBufferUsed", "QueuedWrites", "ReadBytes", "ReadTime", "TotalCacheSize", "WriteBytes", "WriteTime", "WorkingStorageFree", "WorkingStoragePercentUsed", "WorkingStorageUsed", "CacheHitPercent", "CachePercentUsed", "CachePercentDirty", "ReadBytes", "ReadTime", "WriteBytes", "WriteTime", "QueuedWrites"
65
- // ],
66
- // "AWS/WorkSpaces": [
67
- // "Available", "Unhealthy", "ConnectionAttempt", "ConnectionSuccess", "ConnectionFailure", "SessionLaunchTime", "InSessionLatency", "SessionDisconnect"
68
- // ],
69
- // };
70
-
71
68
func handleGetRegions (req * cwRequest , c * middleware.Context ) {
72
69
regions := []string {
73
70
"us-west-2" , "us-west-1" , "eu-west-1" , "eu-central-1" , "ap-southeast-1" ,
@@ -113,3 +110,26 @@ func handleGetMetrics(req *cwRequest, c *middleware.Context) {
113
110
114
111
c .JSON (200 , result )
115
112
}
113
+
114
+ func handleGetDimensions (req * cwRequest , c * middleware.Context ) {
115
+ reqParam := & struct {
116
+ Parameters struct {
117
+ Namespace string `json:"namespace"`
118
+ } `json:"parameters"`
119
+ }{}
120
+
121
+ json .Unmarshal (req .Body , reqParam )
122
+
123
+ dimensionValues , exists := dimensionsMap [reqParam .Parameters .Namespace ]
124
+ if ! exists {
125
+ c .JsonApiErr (404 , "Unable to find dimension " + reqParam .Parameters .Namespace , nil )
126
+ return
127
+ }
128
+
129
+ result := []interface {}{}
130
+ for _ , name := range dimensionValues {
131
+ result = append (result , util.DynMap {"text" : name , "value" : name })
132
+ }
133
+
134
+ c .JSON (200 , result )
135
+ }
0 commit comments