Sha256: 0a412a788bf3f820468dc1b76784618af4754fdcb81fa0e2df4701f1ae245c3c

Contents?: true

Size: 529 Bytes

Versions: 48

Compression:

Stored size: 529 Bytes

Contents

#encoding: utf-8

require 'rest_client'

module Riemann
  module Babbler
    module Plugins
      module Helpers

        # http rest
        def rest_get(url)
          begin
            Timeout::timeout(plugin.timeout) do
              begin
                RestClient.get url
              rescue
                raise "Get from url: #{url} failed"
              end
            end
          rescue Timeout::Error
            raise "Get from url: #{url}, timeout error"
          end
        end

      end
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
riemann-babbler-2.8.2 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.8.1 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.8.0 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.6.0 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.5.9 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.5.8 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.5.7 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.5.6 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.5.5 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.5.4 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.5.3 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.5.2 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.5.1 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.5.0 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.1.5 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.1.4 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.1.3.2 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.1.3.1 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.1.3 lib/riemann/babbler/plugins/helpers/rest.rb
riemann-babbler-2.1.2 lib/riemann/babbler/plugins/helpers/rest.rb