Sha256: ef3f4fae4163b149de45d78aea0a2512346598dfc08888f3d4b69b6156a1236d

Contents?: true

Size: 777 Bytes

Versions: 12

Compression:

Stored size: 777 Bytes

Contents

require 'opsicle/instances'

module Opsicle
  module Monitor
    module Spy
      class Instances

        include Spy::Dataspyable

        def initialize
          @instances = Opsicle::Instances.new(Opsicle::Monitor::App.client)
          refresh
        end

        def refresh
          h = []

          @instances.data.each do |instance|
            # Massage the API data for our uses
            h << {
              :ec2_instance_id => instance[:ec2_instance_id],
              :hostname => instance[:hostname],
              :status => instance[:status],
              :zone => instance[:availability_zone],
              :ip => instance[:elastic_ip] || instance[:public_ip]
            }
          end

          @data = h
        end

      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
opsicle-0.11.0 lib/opsicle/monitor/spy/instances.rb
opsicle-0.10.0 lib/opsicle/monitor/spy/instances.rb
opsicle-0.9.0 lib/opsicle/monitor/spy/instances.rb
opsicle-0.8.2 lib/opsicle/monitor/spy/instances.rb
opsicle-0.8.1 lib/opsicle/monitor/spy/instances.rb
opsicle-0.8.0 lib/opsicle/monitor/spy/instances.rb
opsicle-0.7.1 lib/opsicle/monitor/spy/instances.rb
opsicle-0.7.0 lib/opsicle/monitor/spy/instances.rb
opsicle-0.6.0 lib/opsicle/monitor/spy/instances.rb
opsicle-0.5.1 lib/opsicle/monitor/spy/instances.rb
opsicle-0.5.0 lib/opsicle/monitor/spy/instances.rb
opsicle-0.4.2 lib/opsicle/monitor/spy/instances.rb