Sha256: 37650c3fbf6f607029854d20b49933158892144c6699cc430c9974f0cab84e5e

Contents?: true

Size: 928 Bytes

Versions: 10

Compression:

Stored size: 928 Bytes

Contents

require 'dashing-contrib/bottles/nagios'

module DashingContrib
  module Jobs
    module NagiosList
      extend DashingContrib::RunnableJob


      # Returns format
      # {
      #   critical:[],
      #   warning:[],
      #   ok:[]
      # }
      def self.metrics(options)
        client = DashingContrib::Nagios::Client.new({
          username: options[:username],
          endpoint: options[:endpoint],
          password: options[:password],
          version: options[:version] || 3,
          time_format: options[:time_format] || 'iso8601'
        })

        client.status(options[:nagios_filter] || {})
      end

      def self.validate_state(metrics, options = {})
        return DashingContrib::RunnableJob::CRITICAL unless metrics[:critical].size.zero?
        return DashingContrib::RunnableJob::WARNING unless metrics[:warning].size.zero?
        DashingContrib::RunnableJob::OK
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dashing-contrib-0.1.9 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.1.8 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.1.7 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.1.6 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.1.5 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.1.4 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.1.3 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.1.2 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.1.1 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.1.0 lib/dashing-contrib/jobs/nagios_list.rb