Class: JCF::Plugins::AwsRds
- Inherits:
-
Object
- Object
- JCF::Plugins::AwsRds
- Defined in:
- lib/jcf/plugins/aws_rds.rb
Instance Method Summary collapse
-
#initialize(name:) ⇒ AwsRds
constructor
A new instance of AwsRds.
- #metrics ⇒ Object
- #names ⇒ Object
- #to_s ⇒ Object
- #values ⇒ Object
Constructor Details
#initialize(name:) ⇒ AwsRds
Returns a new instance of AwsRds.
12 13 14 15 16 |
# File 'lib/jcf/plugins/aws_rds.rb', line 12 def initialize(name:) @name = name @metrics = {} check_token! end |
Instance Method Details
#metrics ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/jcf/plugins/aws_rds.rb', line 26 def metrics @metrics[:storage_used] = to_gb(storage_used(name: @name || "")) @metrics[:storage_allocated] = to_gb(storage_allocated(name: @name) || "") @metrics[:storage_free] = to_gb(storage_free(name: @name) || "") @metrics[:iops] = (iops(name: @name).to_fs(:rounded, precision: 0) || "") @metrics[:cpu] = (cpu(name: @name).to_fs(:rounded, precision: 0) || "") @metrics end |
#names ⇒ Object
18 19 20 |
# File 'lib/jcf/plugins/aws_rds.rb', line 18 def names %w[storage_used storage_allocated storage_free iops cpu] end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/jcf/plugins/aws_rds.rb', line 35 def to_s metrics.to_s end |
#values ⇒ Object
22 23 24 |
# File 'lib/jcf/plugins/aws_rds.rb', line 22 def values names.map { |name| send(name.to_sym) } end |