Sha256: 1321b394a07d6517f2af5ed368b74e85a8480b5d500099f99bc37a308a521f9e

Contents?: true

Size: 981 Bytes

Versions: 14

Compression:

Stored size: 981 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',
          verify_ssl: options[:verify_ssl] || true,
        })

        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

14 entries across 14 versions & 1 rubygems

Version Path
dashing-contrib-0.2.9 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.2.8 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.2.7 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.2.6 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.2.5 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.2.4 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.2.3 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.2.2 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.2.1 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.2.0 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.1.14 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.1.12 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.1.11 lib/dashing-contrib/jobs/nagios_list.rb
dashing-contrib-0.1.10 lib/dashing-contrib/jobs/nagios_list.rb