Sha256: 11b2c07a7d1266bc7e6d584dbf9c811641d63fd8e6bf8fd6b6308f9da1567e1e

Contents?: true

Size: 899 Bytes

Versions: 1

Compression:

Stored size: 899 Bytes

Contents

#!/usr/bin/env ruby
Process.setproctitle($0)

# Gathers munin statistics and submits them to Riemann.

require 'riemann/tools'

class Riemann::Tools::Munin
  include Riemann::Tools
  require 'munin-ruby'

  def initialize
    @munin = ::Munin::Node.new
  end

  def tick
    services = opts[:services] || @munin.list
    services.each do |service|
      @munin.fetch(service).each do |service, parts|
        parts.each do |part, metric|
          report(
            :service => "#{service} #{part}",
            :metric => metric.to_f,
            :state => 'ok',
            :tags => ['munin']
          )
        end
      end
    end
  end

  opt :munin_host, "Munin hostname", :default => 'localhost'
  opt :munin_port, "Munin port", :default => 4949
  opt :services, "Munin services to translate (if not specified, all services are relayed)", :type => :strings
end

Riemann::Tools::Munin.run

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
riemann-tools-1.0.0 tools/riemann-munin/bin/riemann-munin