Class: GraphiteInterface
- Inherits:
-
Object
- Object
- GraphiteInterface
- Defined in:
- lib/capistrano/graphite.rb
Overview
Build the request to post
Instance Method Summary collapse
Instance Method Details
#post_event(action) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/capistrano/graphite.rb', line 11 def post_event(action) uri = URI.parse("#{fetch(:graphite_url)}") req = Net::HTTP::Post.new(uri.path) req.basic_auth(uri.user, uri.password) if uri.user req.body = "{\"what\": \"#{action} #{fetch(:application)} in " \ "#{fetch(:stage)}\", \"tags\": \"#{fetch(:application)}," \ "#{fetch(:stage)},#{release_timestamp},#{action}\", \"data\": " \ "\"#{fetch(:local_user)}\"}" Net::HTTP.start(uri.host, uri.port) do |http| http.request(req) end end |