Sha256: 5e9dad73d91311e5b88652817308baab5620a5b28b200b5865e3bddeaeb6c510

Contents?: true

Size: 858 Bytes

Versions: 15

Compression:

Stored size: 858 Bytes

Contents

require 'nagios'

module Nagios
  ##
  # Background parsing of status.dat file in separate thread. Runs on
  # regular intervals slightly shorter than :ttl
  #
  class BackgroundParser

    ##
    # 
    # If :ttl is not defined set to 0 and do not run
    # background parsing.
    #
    def initialize
      interval = [::DEFAULT[:ttl],1].max || nil
      $use_inflight_status = false
      $use_inflight_objects = false
      if interval && ::DEFAULT[:start_background_parser]
        puts "[#{Time.now}] Starting background parser thread with interval #{interval} sec"
        $bg = Thread.new {
          loop {
            $use_inflight_status ? $nagios[:status].parse : $nagios[:status_inflight].parse
            $use_inflight_status = !$use_inflight_status
            sleep interval
          } #loop
        } # thread
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
nagira-0.5.0 lib/nagira/background_parse.rb
nagira-0.4.2 lib/nagira/background_parse.rb
nagira-0.4.1 lib/nagira/background_parse.rb
nagira-0.4.0 lib/nagira/background_parse.rb
nagira-0.3.3 lib/nagira/background_parse.rb
nagira-0.3.2 lib/nagira/background_parse.rb
nagira-0.3.1 lib/nagira/background_parse.rb
nagira-0.3.0 lib/nagira/background_parse.rb
nagira-0.2.12 lib/nagira/background_parse.rb
nagira-0.2.11 lib/nagira/background_parse.rb
nagira-0.2.10 lib/nagira/background_parse.rb
nagira-0.2.9 lib/nagira/background_parse.rb
nagira-0.2.8 lib/nagira/background_parse.rb
nagira-0.2.7 lib/nagira/background_parse.rb
nagira-0.2.6 lib/nagira/background_parse.rb