Sha256: 29e5497cb301d99dca22262bc09c833cfb74adf6818ac3d2cf98d183ebaea376

Contents?: true

Size: 860 Bytes

Versions: 2

Compression:

Stored size: 860 Bytes

Contents

require 'sensu-plugin/metric/cli'
require 'socket'
require 'sensu-plugins-rabbitmq/rabbitmq'

module Sensu
  module Plugin
    module RabbitMQ
      class Metrics < Sensu::Plugin::Metric::CLI::Graphite
        include Sensu::Plugin::RabbitMQ::Common

        option :scheme,
               description: 'Metric naming scheme',
               long: '--scheme SCHEME',
               default: "#{Socket.gethostname}.rabbitmq"

        def dotted_keys(hash, prefix = '', keys = [])
          hash.each do |k, v|
            if v.is_a? Hash
              keys = dotted_keys(v, prefix + k + '.', keys)
            else
              keys << prefix + k
            end
          end
          keys
        end

        # To avoid complaints from mother class at the end of tests (at_exit handler)
        def run
          ok
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sensu-plugins-rabbitmq-3.6.0 lib/sensu-plugins-rabbitmq/metrics.rb
sensu-plugins-rabbitmq-3.5.0 lib/sensu-plugins-rabbitmq/metrics.rb