Class: KnifeSpork::Plugins::Graphite

Inherits:
Plugin
  • Object
show all
Defined in:
lib/knife-spork/plugins/graphite.rb

Instance Method Summary collapse

Methods inherited from Plugin

#enabled?, hook, hooks, #initialize, name

Constructor Details

This class inherits a constructor from KnifeSpork::Plugins::Plugin

Instance Method Details

#performObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/knife-spork/plugins/graphite.rb', line 9

def perform
  environments.each do |environment|
    begin
      message = "deploys.chef.#{environment} 1 #{Time.now.to_i}\n"
      socket = TCPSocket.open(config.server, config.port)
      socket.write(message)
    rescue Exception => e
      ui.error 'Graphite was unable to process the request.'
      ui.error e.to_s
    ensure
      socket.close unless socket.nil?
    end
  end
end