Sha256: e3d24a724b55f94e64f6ca612e953a3c9f79454fed483ab6e340bae6f00d96a4

Contents?: true

Size: 913 Bytes

Versions: 7

Compression:

Stored size: 913 Bytes

Contents

module DashingContrib
  module Nagios
    module Status
      extend self

      def fetch(client, options = {})
        critical = client.service_status(default_critical_options.merge(options))
        warning  = client.service_status(default_warning_options.merge(options))
        ok       = client.service_status(default_ok_options.merge(options))
        ok.select! { |check| check['status'] == 'OK' }

        { critical: critical, warning: warning, ok: ok }
      end

      private
      def default_critical_options
        { :service_status_types => [:critical], :sort_type => :descending, :sort_option => :last_check }
      end

      def default_warning_options
        { :service_status_types => [:warning], :sort_type => :descending, :sort_option => :last_check }
      end

      def default_ok_options
        { :sort_option => :last_check, :sort_type => :descending }
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dashing-contrib-0.1.6 lib/dashing-contrib/bottles/nagios/status.rb
dashing-contrib-0.1.5 lib/dashing-contrib/bottles/nagios/status.rb
dashing-contrib-0.1.4 lib/dashing-contrib/bottles/nagios/status.rb
dashing-contrib-0.1.3 lib/dashing-contrib/bottles/nagios/status.rb
dashing-contrib-0.1.2 lib/dashing-contrib/bottles/nagios/status.rb
dashing-contrib-0.1.1 lib/dashing-contrib/bottles/nagios/status.rb
dashing-contrib-0.1.0 lib/dashing-contrib/bottles/nagios/status.rb