Sha256: 7e0c5aeec2af8146ac97ec27a7d5412bee7a3feb7cb9013c14d89e20699eef37

Contents?: true

Size: 698 Bytes

Versions: 24

Compression:

Stored size: 698 Bytes

Contents

#encoding: utf-8

module Riemann
  module Babbler
    module Plugins
      module Helpers

        RIEMANN_RESERVED_FIELDS = [
          :time,
          :state,
          :service,
          :host,
          :description,
          :metric,
          :tags,
          :ttl
        ]

        def event_from_hash(hash=nil)
          if hash
            new_hash = Hash.new
            RIEMANN_RESERVED_FIELDS.each do |key|
              new_hash[key] = hash[key] || hash[key.to_s]
            end
            new_hash
          else
            Hash.new
          end
        end

        def event_from_json(str)
          event_from_hash(JSON.parse(str))
        end

      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
riemann-babbler-2.8.5 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.8.4 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.8.3 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.8.2 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.8.1 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.8.0 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.6.0 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.5.9 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.5.8 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.5.7 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.5.6 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.5.5 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.5.4 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.5.3 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.5.2 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.5.1 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.5.0 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.1.5 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.1.4 lib/riemann/babbler/plugins/helpers/event.rb
riemann-babbler-2.1.3.2 lib/riemann/babbler/plugins/helpers/event.rb