Sha256: 0cc5d378a1d6673cec729a08261571eb1e2b6d65eedac4d78860e65aa673e298

Contents?: true

Size: 874 Bytes

Versions: 3

Compression:

Stored size: 874 Bytes

Contents

#!/usr/bin/env ruby

# 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

3 entries across 3 versions & 1 rubygems

Version Path
riemann-munin-0.1.2 bin/riemann-munin
riemann-munin-0.1.1 bin/riemann-munin
riemann-munin-0.1.0 bin/riemann-munin