bin/metrics-elasticache.rb in sensu-plugins-aws-2.1.1 vs bin/metrics-elasticache.rb in sensu-plugins-aws-2.2.0

- old
+ new

@@ -96,10 +96,25 @@ "elasticache.#{config[:cacheclusterid]}" else config[:scheme] end + dimensions = if config[:cachenodeid] + [{ + 'name' => 'CacheClusterId', + 'value' => config[:cacheclusterid] + }, { + 'name' => 'CacheNodeId', + 'value' => config[:cachenodeid] + }] + else + [{ + 'name' => 'CacheClusterId', + 'value' => config[:cacheclusterid] + }] + end + statistic_type = { 'redis' => { 'CPUUtilization' => 'Percent', 'SwapUsage' => 'Bytes', 'FreeableMemory' => 'Bytes', @@ -166,12 +181,10 @@ # define all options options = { 'namespace' => 'AWS/ElastiCache', 'metric_name' => config[:metric], - 'dimensions' => [ - { 'name' => 'CacheClusterId', 'value' => config[:cacheclusterid] } - ], + 'dimensions' => dimensions, 'start_time' => st.iso8601, 'end_time' => et.iso8601, 'period' => 60, 'statistics' => ['Average'] }