Class: AwsRegion::AwsCw
Overview
Methods for dealing with CloudWatch
Instance Attribute Summary collapse
-
#region ⇒ Object
Returns the value of attribute region.
Instance Method Summary collapse
-
#initialize(region, options = {}) ⇒ AwsCw
constructor
A new instance of AwsCw.
-
#put_metric(arg_csv) ⇒ Aws::PageableResponse
Put a cw metric * Note that dims is formatted as an arbitrary semicolon separated list of name:value dimensions.
Methods inherited from AwsBase
Constructor Details
#initialize(region, options = {}) ⇒ AwsCw
Returns a new instance of AwsCw.
151 152 153 |
# File 'lib/aws_region.rb', line 151 def initialize(region, ={}) @region = region end |
Instance Attribute Details
#region ⇒ Object
Returns the value of attribute region
148 149 150 |
# File 'lib/aws_region.rb', line 148 def region @region end |
Instance Method Details
#put_metric(arg_csv) ⇒ Aws::PageableResponse
Put a cw metric
-
Note that dims is formatted as an arbitrary semicolon separated list of name:value dimensions. For example:
-
“activeservers,count,10,env:prod;purp:test”
-
160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/aws_region.rb', line 160 def put_metric(arg_csv) (namespace, name, value, dims) = arg_csv.split(",") dimensions = [] dims.split(";").each do |d| (n, v) = d.split(":") dimensions << {:name => n, :value => v} end args = {:namespace => namespace} metric ={:metric_name => name, :value => value.to_f, :timestamp => Time.now, :dimensions => dimensions} args[:metric_data] = [metric] @region.cw.put_metric_data(args) end |