sensu 0.11.0.beta.4 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +4 -1
- data/lib/sensu/api.rb +9 -8
- data/lib/sensu/constants.rb +1 -1
- data/lib/sensu/extensions.rb +1 -1
- data/lib/sensu/rabbitmq.rb +6 -0
- data/lib/sensu/server.rb +13 -20
- data/lib/sensu/settings.rb +3 -1
- metadata +8 -12
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            ## 0.11.0 -  | 
| 1 | 
            +
            ## 0.11.0 - 2013-10-02
         | 
| 2 2 |  | 
| 3 3 | 
             
            ### Non-backwards compatible changes
         | 
| 4 4 |  | 
| @@ -26,6 +26,9 @@ You can configure the Sensu client socket (UDP & TCP), bind & port, eg. | |
| 26 26 |  | 
| 27 27 | 
             
            Handlers & mutators can now have a timeout, in seconds.
         | 
| 28 28 |  | 
| 29 | 
            +
            You can configure the RabbitMQ channel prefetch value (advanced), eg.
         | 
| 30 | 
            +
            "rabbitmq": { "prefetch": 100 }.
         | 
| 31 | 
            +
             | 
| 29 32 | 
             
            ### Other
         | 
| 30 33 |  | 
| 31 34 | 
             
            Sensu passes a dup of event data to mutator & handler extensions to
         | 
    
        data/lib/sensu/api.rb
    CHANGED
    
    | @@ -356,15 +356,16 @@ module Sensu | |
| 356 356 | 
             
                          $logger.info('deleting client', {
         | 
| 357 357 | 
             
                            :client => client
         | 
| 358 358 | 
             
                          })
         | 
| 359 | 
            -
                          $redis.srem('clients', client_name)
         | 
| 360 | 
            -
             | 
| 361 | 
            -
             | 
| 362 | 
            -
             | 
| 363 | 
            -
             | 
| 364 | 
            -
             | 
| 365 | 
            -
             | 
| 359 | 
            +
                          $redis.srem('clients', client_name) do
         | 
| 360 | 
            +
                            $redis.del('client:' + client_name)
         | 
| 361 | 
            +
                            $redis.del('events:' + client_name)
         | 
| 362 | 
            +
                            $redis.smembers('history:' + client_name) do |checks|
         | 
| 363 | 
            +
                              checks.each do |check_name|
         | 
| 364 | 
            +
                                $redis.del('history:' + client_name + ':' + check_name)
         | 
| 365 | 
            +
                                $redis.del('execution:' + client_name + ':' + check_name)
         | 
| 366 | 
            +
                              end
         | 
| 367 | 
            +
                              $redis.del('history:' + client_name)
         | 
| 366 368 | 
             
                            end
         | 
| 367 | 
            -
                            $redis.del('history:' + client_name)
         | 
| 368 369 | 
             
                          end
         | 
| 369 370 | 
             
                        end
         | 
| 370 371 | 
             
                        issued!
         | 
    
        data/lib/sensu/constants.rb
    CHANGED
    
    
    
        data/lib/sensu/extensions.rb
    CHANGED
    
    
    
        data/lib/sensu/rabbitmq.rb
    CHANGED
    
    | @@ -77,9 +77,15 @@ module Sensu | |
| 77 77 | 
             
                    error = RabbitMQError.new('rabbitmq channel closed')
         | 
| 78 78 | 
             
                    @on_error.call(error)
         | 
| 79 79 | 
             
                  end
         | 
| 80 | 
            +
                  prefetch = 1
         | 
| 81 | 
            +
                  if options.is_a?(Hash)
         | 
| 82 | 
            +
                    prefetch = options[:prefetch] || 1
         | 
| 83 | 
            +
                  end
         | 
| 80 84 | 
             
                  @channel.on_recovery do
         | 
| 81 85 | 
             
                    @after_reconnect.call
         | 
| 86 | 
            +
                    @channel.prefetch(prefetch)
         | 
| 82 87 | 
             
                  end
         | 
| 88 | 
            +
                  @channel.prefetch(prefetch)
         | 
| 83 89 | 
             
                end
         | 
| 84 90 |  | 
| 85 91 | 
             
                def connected?
         | 
    
        data/lib/sensu/server.rb
    CHANGED
    
    | @@ -72,11 +72,9 @@ module Sensu | |
| 72 72 | 
             
                  end
         | 
| 73 73 | 
             
                  @rabbitmq.after_reconnect do
         | 
| 74 74 | 
             
                    @logger.info('reconnected to rabbitmq')
         | 
| 75 | 
            -
                    @amq.prefetch(1)
         | 
| 76 75 | 
             
                    resume
         | 
| 77 76 | 
             
                  end
         | 
| 78 77 | 
             
                  @amq = @rabbitmq.channel
         | 
| 79 | 
            -
                  @amq.prefetch(1)
         | 
| 80 78 | 
             
                end
         | 
| 81 79 |  | 
| 82 80 | 
             
                def setup_keepalives(&block)
         | 
| @@ -571,35 +569,30 @@ module Sensu | |
| 571 569 | 
             
                        unless client_json.nil?
         | 
| 572 570 | 
             
                          client = Oj.load(client_json)
         | 
| 573 571 | 
             
                          check = {
         | 
| 574 | 
            -
                            : | 
| 575 | 
            -
             | 
| 576 | 
            -
             | 
| 577 | 
            -
             | 
| 578 | 
            -
                          thresholds = {
         | 
| 579 | 
            -
                            :warning => 120,
         | 
| 580 | 
            -
                            :critical => 180
         | 
| 572 | 
            +
                            :thresholds => {
         | 
| 573 | 
            +
                              :warning => 120,
         | 
| 574 | 
            +
                              :critical => 180
         | 
| 575 | 
            +
                            }
         | 
| 581 576 | 
             
                          }
         | 
| 582 577 | 
             
                          if client.has_key?(:keepalive)
         | 
| 583 | 
            -
                             | 
| 584 | 
            -
                              check[:handlers] = Array(client[:keepalive][:handlers] || client[:keepalive][:handler])
         | 
| 585 | 
            -
                            end
         | 
| 586 | 
            -
                            if client[:keepalive].has_key?(:thresholds)
         | 
| 587 | 
            -
                              thresholds.merge!(client[:keepalive][:thresholds])
         | 
| 588 | 
            -
                            end
         | 
| 578 | 
            +
                            check = deep_merge(check, client[:keepalive])
         | 
| 589 579 | 
             
                          end
         | 
| 580 | 
            +
                          check[:name] = 'keepalive'
         | 
| 581 | 
            +
                          check[:issued] = Time.now.to_i
         | 
| 582 | 
            +
                          check[:executed] = Time.now.to_i
         | 
| 590 583 | 
             
                          time_since_last_keepalive = Time.now.to_i - client[:timestamp]
         | 
| 591 584 | 
             
                          case
         | 
| 592 | 
            -
                          when time_since_last_keepalive >= thresholds[:critical]
         | 
| 585 | 
            +
                          when time_since_last_keepalive >= check[:thresholds][:critical]
         | 
| 593 586 | 
             
                            check[:output] = 'No keep-alive sent from client in over '
         | 
| 594 | 
            -
                            check[:output] << thresholds[:critical].to_s + ' seconds'
         | 
| 587 | 
            +
                            check[:output] << check[:thresholds][:critical].to_s + ' seconds'
         | 
| 595 588 | 
             
                            check[:status] = 2
         | 
| 596 | 
            -
                          when time_since_last_keepalive >= thresholds[:warning]
         | 
| 589 | 
            +
                          when time_since_last_keepalive >= check[:thresholds][:warning]
         | 
| 597 590 | 
             
                            check[:output] = 'No keep-alive sent from client in over '
         | 
| 598 | 
            -
                            check[:output] << thresholds[:warning].to_s + ' seconds'
         | 
| 591 | 
            +
                            check[:output] << check[:thresholds][:warning].to_s + ' seconds'
         | 
| 599 592 | 
             
                            check[:status] = 1
         | 
| 600 593 | 
             
                          else
         | 
| 601 594 | 
             
                            check[:output] = 'Keep-alive sent from client less than '
         | 
| 602 | 
            -
                            check[:output] << thresholds[:warning].to_s + ' seconds ago'
         | 
| 595 | 
            +
                            check[:output] << check[:thresholds][:warning].to_s + ' seconds ago'
         | 
| 603 596 | 
             
                            check[:status] = 0
         | 
| 604 597 | 
             
                          end
         | 
| 605 598 | 
             
                          publish_result(client, check)
         | 
    
        data/lib/sensu/settings.rb
    CHANGED
    
    | @@ -439,10 +439,12 @@ module Sensu | |
| 439 439 | 
             
                      unless thresholds.is_a?(Hash)
         | 
| 440 440 | 
             
                        invalid('client keepalive thresholds must be a hash')
         | 
| 441 441 | 
             
                      end
         | 
| 442 | 
            -
                      if thresholds.has_key?(:warning) | 
| 442 | 
            +
                      if thresholds.has_key?(:warning)
         | 
| 443 443 | 
             
                        unless thresholds[:warning].is_a?(Integer)
         | 
| 444 444 | 
             
                          invalid('client keepalive warning threshold must be an integer')
         | 
| 445 445 | 
             
                        end
         | 
| 446 | 
            +
                      end
         | 
| 447 | 
            +
                      if thresholds.has_key?(:critical)
         | 
| 446 448 | 
             
                        unless thresholds[:critical].is_a?(Integer)
         | 
| 447 449 | 
             
                          invalid('client keepalive critical threshold must be an integer')
         | 
| 448 450 | 
             
                        end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,15 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: sensu
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 5 | 
            -
              prerelease:  | 
| 4 | 
            +
              hash: 51
         | 
| 5 | 
            +
              prerelease: false
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 0
         | 
| 8 8 | 
             
              - 11
         | 
| 9 9 | 
             
              - 0
         | 
| 10 | 
            -
               | 
| 11 | 
            -
              - 4
         | 
| 12 | 
            -
              version: 0.11.0.beta.4
         | 
| 10 | 
            +
              version: 0.11.0
         | 
| 13 11 | 
             
            platform: ruby
         | 
| 14 12 | 
             
            authors: 
         | 
| 15 13 | 
             
            - Sean Porter
         | 
| @@ -18,7 +16,7 @@ autorequire: | |
| 18 16 | 
             
            bindir: bin
         | 
| 19 17 | 
             
            cert_chain: []
         | 
| 20 18 |  | 
| 21 | 
            -
            date: 2013- | 
| 19 | 
            +
            date: 2013-10-02 00:00:00 -07:00
         | 
| 22 20 | 
             
            default_executable: 
         | 
| 23 21 | 
             
            dependencies: 
         | 
| 24 22 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -235,14 +233,12 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 235 233 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 236 234 | 
             
              none: false
         | 
| 237 235 | 
             
              requirements: 
         | 
| 238 | 
            -
              - - " | 
| 236 | 
            +
              - - ">="
         | 
| 239 237 | 
             
                - !ruby/object:Gem::Version 
         | 
| 240 | 
            -
                  hash:  | 
| 238 | 
            +
                  hash: 3
         | 
| 241 239 | 
             
                  segments: 
         | 
| 242 | 
            -
                  -  | 
| 243 | 
            -
                   | 
| 244 | 
            -
                  - 1
         | 
| 245 | 
            -
                  version: 1.3.1
         | 
| 240 | 
            +
                  - 0
         | 
| 241 | 
            +
                  version: "0"
         | 
| 246 242 | 
             
            requirements: []
         | 
| 247 243 |  | 
| 248 244 | 
             
            rubyforge_project: 
         |