Sha256: a2fc7bb18cf2ad266867488924081a5ad655c12e27c8ae7ba3968f3299ee4206

Contents?: true

Size: 966 Bytes

Versions: 40

Compression:

Stored size: 966 Bytes

Contents

class Riemann::Babbler::Plugin::ErrorsReporter < Riemann::Babbler::Plugin

  def init
    plugin.set_default(:service, 'riemann client')
    @report_ok = false
  end

  def collect
    status   = Array.new
    messages = Array.new

    opts.errors.to_hash.each do |plugin_name, plugin_status|
      next if plugin_status[:reported]
      messages << "#{plugin_name} count_errors: #{plugin_status[:count]}, \
        last: #{plugin_status[:last_error_at]}"
      opts.errors.send(plugin_name).reported = true
    end

    if messages.empty?
      status << { :service => plugin.service, :state => 'ok', :description => "All plugins ok" } unless @report_ok
      @report_ok = true
    else
      @report_ok = false
      status << {
          :service     => plugin.service,
          :state       => 'critical',
          :metric      => messages.count,
          :description => "Problem with plugins:\n #{messages.join("\n")}"
      }
    end
    status
  end

end

Version data entries

40 entries across 40 versions & 1 rubygems

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