sensu-plugins-rabbitmq 2.3.0 → 3.0.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -3
- data/bin/check-rabbitmq-alive.rb +15 -2
- data/bin/check-rabbitmq-amqp-alive.rb +15 -2
- data/bin/check-rabbitmq-cluster-health.rb +15 -2
- data/bin/check-rabbitmq-consumers.rb +20 -4
- data/bin/check-rabbitmq-messages.rb +20 -4
- data/bin/check-rabbitmq-network-partitions.rb +18 -2
- data/bin/check-rabbitmq-node-health.rb +15 -0
- data/bin/check-rabbitmq-node-usage.rb +18 -2
- data/bin/check-rabbitmq-queue-drain-time.rb +20 -4
- data/bin/check-rabbitmq-queue.rb +20 -4
- data/bin/check-rabbitmq-stomp-alive.rb +18 -2
- data/bin/metrics-rabbitmq-overview.rb +20 -4
- data/bin/metrics-rabbitmq-queue.rb +20 -4
- data/lib/sensu-plugins-rabbitmq/version.rb +2 -2
- metadata +16 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 4136a3c48a94763e3ab822775e4d21a832b10887
         | 
| 4 | 
            +
              data.tar.gz: eab91431b9a3e361e955f23ed3c383d7832344fb
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: e8b04c93a18c80b25bf0ea1f1025d7f1d0ca24facd5802a71f758afa1d1dbfe00b8a8a471fbcb6115c1e4a261c052c77566dd3f09343064abf3c682ee3b32756
         | 
| 7 | 
            +
              data.tar.gz: da132f2cc3c15f1f22dc1280d9192f6f800aa50f612c503de942d60321e0d7375996092b2d00ac2429c62fd0a514323586b7a7908b1db1a7bcdc188bae693359
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -4,11 +4,18 @@ This project adheres to [Semantic Versioning](http://semver.org/). | |
| 4 4 | 
             
            This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
         | 
| 5 5 |  | 
| 6 6 | 
             
            ## [Unreleased]
         | 
| 7 | 
            -
             | 
| 7 | 
            +
            ## [3.0.0] - 2017-05-10
         | 
| 8 | 
            +
            ### Breaking change
         | 
| 9 | 
            +
             - Previously some checks used --user to specify username, now all scripts use --username
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            ### Added
         | 
| 12 | 
            +
             - --ini option for all checks to specify username and password in a config file (@bootswithdefer)
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            ## [2.3.0] - 2017-05-09
         | 
| 8 15 | 
             
            ### Added
         | 
| 9 16 | 
             
            - check-rabbitmq-node-usage.rb: added new check to look at rmq node resource useage. (@DvaBearqLoza)
         | 
| 10 17 |  | 
| 11 | 
            -
             | 
| 18 | 
            +
            ## [2.2.0] - 2017-05-08
         | 
| 12 19 | 
             
            ### Added
         | 
| 13 20 | 
             
             - check-rabbitmq-queue.rb: Added --below feature to specify if value below threshold should generate alert (@alexpekurovsky)
         | 
| 14 21 |  | 
| @@ -122,7 +129,8 @@ NOTE: this release changes the option flags in check-rabbitmq-node-health.rb to | |
| 122 129 | 
             
            - Remove copy paste errors in the Readme
         | 
| 123 130 | 
             
            - Removed Rubygems require Ruby 1.8.7 backwards compatibility from all plugins
         | 
| 124 131 |  | 
| 125 | 
            -
            [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/ | 
| 132 | 
            +
            [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/3.0.0...HEAD
         | 
| 133 | 
            +
            [3.0.0]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/2.3.0...3.0.0
         | 
| 126 134 | 
             
            [2.3.0]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/2.2.0...2.3.0
         | 
| 127 135 | 
             
            [2.2.0]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/2.1.0...2.2.0
         | 
| 128 136 | 
             
            [2.1.0]: https://github.com/sensu-plugins/sensu-plugins-rabbitmq/compare/2.0.0...2.1.0
         | 
    
        data/bin/check-rabbitmq-alive.rb
    CHANGED
    
    | @@ -24,6 +24,7 @@ | |
| 24 24 | 
             
            require 'sensu-plugin/check/cli'
         | 
| 25 25 | 
             
            require 'json'
         | 
| 26 26 | 
             
            require 'rest_client'
         | 
| 27 | 
            +
            require 'inifile'
         | 
| 27 28 |  | 
| 28 29 | 
             
            # main plugin class
         | 
| 29 30 | 
             
            class CheckRabbitMQAlive < Sensu::Plugin::Check::CLI
         | 
| @@ -69,6 +70,11 @@ class CheckRabbitMQAlive < Sensu::Plugin::Check::CLI | |
| 69 70 | 
             
                     boolean: true,
         | 
| 70 71 | 
             
                     default: false
         | 
| 71 72 |  | 
| 73 | 
            +
              option :ini,
         | 
| 74 | 
            +
                     description: 'Configuration ini file',
         | 
| 75 | 
            +
                     short: '-i',
         | 
| 76 | 
            +
                     long: '--ini VALUE'
         | 
| 77 | 
            +
             | 
| 72 78 | 
             
              def run
         | 
| 73 79 | 
             
                res = vhost_alive?
         | 
| 74 80 |  | 
| @@ -84,11 +90,18 @@ class CheckRabbitMQAlive < Sensu::Plugin::Check::CLI | |
| 84 90 | 
             
              def vhost_alive?
         | 
| 85 91 | 
             
                host       = config[:host]
         | 
| 86 92 | 
             
                port       = config[:port]
         | 
| 87 | 
            -
                username   = config[:username]
         | 
| 88 | 
            -
                password   = config[:password]
         | 
| 89 93 | 
             
                vhost      = config[:vhost]
         | 
| 90 94 | 
             
                ssl        = config[:ssl]
         | 
| 91 95 | 
             
                verify_ssl = config[:verify_ssl_off]
         | 
| 96 | 
            +
                if config[:ini]
         | 
| 97 | 
            +
                  ini = IniFile.load(config[:ini])
         | 
| 98 | 
            +
                  section = ini['auth']
         | 
| 99 | 
            +
                  username = section['username']
         | 
| 100 | 
            +
                  password = section['password']
         | 
| 101 | 
            +
                else
         | 
| 102 | 
            +
                  username = config[:username]
         | 
| 103 | 
            +
                  password = config[:password]
         | 
| 104 | 
            +
                end
         | 
| 92 105 |  | 
| 93 106 | 
             
                begin
         | 
| 94 107 | 
             
                  resource = RestClient::Resource.new(
         | 
| @@ -22,6 +22,7 @@ | |
| 22 22 |  | 
| 23 23 | 
             
            require 'sensu-plugin/check/cli'
         | 
| 24 24 | 
             
            require 'bunny'
         | 
| 25 | 
            +
            require 'inifile'
         | 
| 25 26 |  | 
| 26 27 | 
             
            # main plugin class
         | 
| 27 28 | 
             
            class CheckRabbitAMQPAlive < Sensu::Plugin::Check::CLI
         | 
| @@ -77,6 +78,11 @@ class CheckRabbitAMQPAlive < Sensu::Plugin::Check::CLI | |
| 77 78 | 
             
                     boolean: true,
         | 
| 78 79 | 
             
                     default: true
         | 
| 79 80 |  | 
| 81 | 
            +
              option :ini,
         | 
| 82 | 
            +
                     description: 'Configuration ini file',
         | 
| 83 | 
            +
                     short: '-i',
         | 
| 84 | 
            +
                     long: '--ini VALUE'
         | 
| 85 | 
            +
             | 
| 80 86 | 
             
              def run
         | 
| 81 87 | 
             
                res = vhost_alive?
         | 
| 82 88 |  | 
| @@ -92,13 +98,20 @@ class CheckRabbitAMQPAlive < Sensu::Plugin::Check::CLI | |
| 92 98 | 
             
              def vhost_alive?
         | 
| 93 99 | 
             
                host           = config[:host]
         | 
| 94 100 | 
             
                port           = config[:port]
         | 
| 95 | 
            -
                username       = config[:username]
         | 
| 96 | 
            -
                password       = config[:password]
         | 
| 97 101 | 
             
                vhost          = config[:vhost]
         | 
| 98 102 | 
             
                ssl            = config[:ssl]
         | 
| 99 103 | 
             
                tls_cert       = config[:tls_cert]
         | 
| 100 104 | 
             
                tls_key        = config[:tls_key]
         | 
| 101 105 | 
             
                no_verify_peer = config[:no_verify_peer]
         | 
| 106 | 
            +
                if config[:ini]
         | 
| 107 | 
            +
                  ini = IniFile.load(config[:ini])
         | 
| 108 | 
            +
                  section = ini['auth']
         | 
| 109 | 
            +
                  username = section['username']
         | 
| 110 | 
            +
                  password = section['password']
         | 
| 111 | 
            +
                else
         | 
| 112 | 
            +
                  username = config[:username]
         | 
| 113 | 
            +
                  password = config[:password]
         | 
| 114 | 
            +
                end
         | 
| 102 115 |  | 
| 103 116 | 
             
                begin
         | 
| 104 117 | 
             
                  conn = Bunny.new("amqp#{ssl ? 's' : ''}://#{username}:#{password}@#{host}:#{port}/#{vhost}",
         | 
| @@ -28,6 +28,7 @@ | |
| 28 28 | 
             
            require 'sensu-plugin/check/cli'
         | 
| 29 29 | 
             
            require 'json'
         | 
| 30 30 | 
             
            require 'rest_client'
         | 
| 31 | 
            +
            require 'inifile'
         | 
| 31 32 |  | 
| 32 33 | 
             
            # main plugin class
         | 
| 33 34 | 
             
            class CheckRabbitMQCluster < Sensu::Plugin::Check::CLI
         | 
| @@ -78,6 +79,11 @@ class CheckRabbitMQCluster < Sensu::Plugin::Check::CLI | |
| 78 79 | 
             
                     long: '--ssl_ca_file CA_PATH',
         | 
| 79 80 | 
             
                     default: ''
         | 
| 80 81 |  | 
| 82 | 
            +
              option :ini,
         | 
| 83 | 
            +
                     description: 'Configuration ini file',
         | 
| 84 | 
            +
                     short: '-i',
         | 
| 85 | 
            +
                     long: '--ini VALUE'
         | 
| 86 | 
            +
             | 
| 81 87 | 
             
              def run
         | 
| 82 88 | 
             
                res = cluster_healthy?
         | 
| 83 89 |  | 
| @@ -108,12 +114,19 @@ class CheckRabbitMQCluster < Sensu::Plugin::Check::CLI | |
| 108 114 | 
             
              def cluster_healthy?
         | 
| 109 115 | 
             
                host        = config[:host]
         | 
| 110 116 | 
             
                port        = config[:port]
         | 
| 111 | 
            -
                username    = config[:username]
         | 
| 112 | 
            -
                password    = config[:password]
         | 
| 113 117 | 
             
                ssl         = config[:ssl]
         | 
| 114 118 | 
             
                verify_ssl  = config[:verify_ssl_off]
         | 
| 115 119 | 
             
                nodes       = config[:nodes].split(',')
         | 
| 116 120 | 
             
                ssl_ca_file = config[:ssl_ca_file]
         | 
| 121 | 
            +
                if config[:ini]
         | 
| 122 | 
            +
                  ini = IniFile.load(config[:ini])
         | 
| 123 | 
            +
                  section = ini['auth']
         | 
| 124 | 
            +
                  username = section['username']
         | 
| 125 | 
            +
                  password = section['password']
         | 
| 126 | 
            +
                else
         | 
| 127 | 
            +
                  username = config[:username]
         | 
| 128 | 
            +
                  password = config[:password]
         | 
| 129 | 
            +
                end
         | 
| 117 130 |  | 
| 118 131 | 
             
                begin
         | 
| 119 132 | 
             
                  url_prefix = ssl ? 'https' : 'http'
         | 
| @@ -24,6 +24,7 @@ | |
| 24 24 |  | 
| 25 25 | 
             
            require 'sensu-plugin/check/cli'
         | 
| 26 26 | 
             
            require 'carrot-top'
         | 
| 27 | 
            +
            require 'inifile'
         | 
| 27 28 |  | 
| 28 29 | 
             
            # main plugin class
         | 
| 29 30 | 
             
            class CheckRabbitMQConsumers < Sensu::Plugin::Check::CLI
         | 
| @@ -44,9 +45,9 @@ class CheckRabbitMQConsumers < Sensu::Plugin::Check::CLI | |
| 44 45 | 
             
                     boolean: true,
         | 
| 45 46 | 
             
                     default: false
         | 
| 46 47 |  | 
| 47 | 
            -
              option : | 
| 48 | 
            +
              option :username,
         | 
| 48 49 | 
             
                     description: 'RabbitMQ management API user',
         | 
| 49 | 
            -
                     long: '-- | 
| 50 | 
            +
                     long: '--username USER',
         | 
| 50 51 | 
             
                     default: 'guest'
         | 
| 51 52 |  | 
| 52 53 | 
             
              option :password,
         | 
| @@ -78,13 +79,28 @@ class CheckRabbitMQConsumers < Sensu::Plugin::Check::CLI | |
| 78 79 | 
             
                     proc: proc(&:to_i),
         | 
| 79 80 | 
             
                     default: 2
         | 
| 80 81 |  | 
| 82 | 
            +
              option :ini,
         | 
| 83 | 
            +
                     description: 'Configuration ini file',
         | 
| 84 | 
            +
                     short: '-i',
         | 
| 85 | 
            +
                     long: '--ini VALUE'
         | 
| 86 | 
            +
             | 
| 81 87 | 
             
              def rabbit
         | 
| 82 88 | 
             
                begin
         | 
| 89 | 
            +
                  if config[:ini]
         | 
| 90 | 
            +
                    ini = IniFile.load(config[:ini])
         | 
| 91 | 
            +
                    section = ini['auth']
         | 
| 92 | 
            +
                    username = section['username']
         | 
| 93 | 
            +
                    password = section['password']
         | 
| 94 | 
            +
                  else
         | 
| 95 | 
            +
                    username = config[:username]
         | 
| 96 | 
            +
                    password = config[:password]
         | 
| 97 | 
            +
                  end
         | 
| 98 | 
            +
             | 
| 83 99 | 
             
                  connection = CarrotTop.new(
         | 
| 84 100 | 
             
                    host: config[:host],
         | 
| 85 101 | 
             
                    port: config[:port],
         | 
| 86 | 
            -
                    user:  | 
| 87 | 
            -
                    password:  | 
| 102 | 
            +
                    user: username,
         | 
| 103 | 
            +
                    password: password,
         | 
| 88 104 | 
             
                    ssl: config[:ssl]
         | 
| 89 105 | 
             
                  )
         | 
| 90 106 | 
             
                rescue
         | 
| @@ -25,6 +25,7 @@ | |
| 25 25 | 
             
            require 'sensu-plugin/check/cli'
         | 
| 26 26 | 
             
            require 'socket'
         | 
| 27 27 | 
             
            require 'carrot-top'
         | 
| 28 | 
            +
            require 'inifile'
         | 
| 28 29 |  | 
| 29 30 | 
             
            # main plugin class
         | 
| 30 31 | 
             
            class CheckRabbitMQMessages < Sensu::Plugin::Check::CLI
         | 
| @@ -39,9 +40,9 @@ class CheckRabbitMQMessages < Sensu::Plugin::Check::CLI | |
| 39 40 | 
             
                     proc: proc(&:to_i),
         | 
| 40 41 | 
             
                     default: 15_672
         | 
| 41 42 |  | 
| 42 | 
            -
              option : | 
| 43 | 
            +
              option :username,
         | 
| 43 44 | 
             
                     description: 'RabbitMQ management API user',
         | 
| 44 | 
            -
                     long: '-- | 
| 45 | 
            +
                     long: '--username USER',
         | 
| 45 46 | 
             
                     default: 'guest'
         | 
| 46 47 |  | 
| 47 48 | 
             
              option :password,
         | 
| @@ -79,6 +80,11 @@ class CheckRabbitMQMessages < Sensu::Plugin::Check::CLI | |
| 79 80 | 
             
                     proc: proc { |q| q.split(',') },
         | 
| 80 81 | 
             
                     default: []
         | 
| 81 82 |  | 
| 83 | 
            +
              option :ini,
         | 
| 84 | 
            +
                     description: 'Configuration ini file',
         | 
| 85 | 
            +
                     short: '-i',
         | 
| 86 | 
            +
                     long: '--ini VALUE'
         | 
| 87 | 
            +
             | 
| 82 88 | 
             
              def generate_message(status_hash)
         | 
| 83 89 | 
             
                message = []
         | 
| 84 90 | 
             
                status_hash.each_pair do |k, v|
         | 
| @@ -89,11 +95,21 @@ class CheckRabbitMQMessages < Sensu::Plugin::Check::CLI | |
| 89 95 |  | 
| 90 96 | 
             
              def acquire_rabbitmq_info
         | 
| 91 97 | 
             
                begin
         | 
| 98 | 
            +
                  if config[:ini]
         | 
| 99 | 
            +
                    ini = IniFile.load(config[:ini])
         | 
| 100 | 
            +
                    section = ini['auth']
         | 
| 101 | 
            +
                    username = section['username']
         | 
| 102 | 
            +
                    password = section['password']
         | 
| 103 | 
            +
                  else
         | 
| 104 | 
            +
                    username = config[:username]
         | 
| 105 | 
            +
                    password = config[:password]
         | 
| 106 | 
            +
                  end
         | 
| 107 | 
            +
             | 
| 92 108 | 
             
                  rabbitmq_info = CarrotTop.new(
         | 
| 93 109 | 
             
                    host: config[:host],
         | 
| 94 110 | 
             
                    port: config[:port],
         | 
| 95 | 
            -
                    user:  | 
| 96 | 
            -
                    password:  | 
| 111 | 
            +
                    user: username,
         | 
| 112 | 
            +
                    password: password,
         | 
| 97 113 | 
             
                    ssl: config[:ssl]
         | 
| 98 114 | 
             
                  )
         | 
| 99 115 | 
             
                rescue
         | 
| @@ -24,6 +24,7 @@ | |
| 24 24 |  | 
| 25 25 | 
             
            require 'sensu-plugin/check/cli'
         | 
| 26 26 | 
             
            require 'carrot-top'
         | 
| 27 | 
            +
            require 'inifile'
         | 
| 27 28 |  | 
| 28 29 | 
             
            # main plugin class
         | 
| 29 30 | 
             
            class CheckRabbitMQPartitions < Sensu::Plugin::Check::CLI
         | 
| @@ -57,6 +58,11 @@ class CheckRabbitMQPartitions < Sensu::Plugin::Check::CLI | |
| 57 58 | 
             
                     boolean: true,
         | 
| 58 59 | 
             
                     default: false
         | 
| 59 60 |  | 
| 61 | 
            +
              option :ini,
         | 
| 62 | 
            +
                     description: 'Configuration ini file',
         | 
| 63 | 
            +
                     short: '-i',
         | 
| 64 | 
            +
                     long: '--ini VALUE'
         | 
| 65 | 
            +
             | 
| 60 66 | 
             
              def run
         | 
| 61 67 | 
             
                critical 'network partition detected' if partition?
         | 
| 62 68 | 
             
                ok 'no network partition detected'
         | 
| @@ -71,11 +77,21 @@ class CheckRabbitMQPartitions < Sensu::Plugin::Check::CLI | |
| 71 77 | 
             
              end
         | 
| 72 78 |  | 
| 73 79 | 
             
              def rabbitmq_management
         | 
| 80 | 
            +
                if config[:ini]
         | 
| 81 | 
            +
                  ini = IniFile.load(config[:ini])
         | 
| 82 | 
            +
                  section = ini['auth']
         | 
| 83 | 
            +
                  username = section['username']
         | 
| 84 | 
            +
                  password = section['password']
         | 
| 85 | 
            +
                else
         | 
| 86 | 
            +
                  username = config[:username]
         | 
| 87 | 
            +
                  password = config[:password]
         | 
| 88 | 
            +
                end
         | 
| 89 | 
            +
             | 
| 74 90 | 
             
                CarrotTop.new(
         | 
| 75 91 | 
             
                  host: config[:host],
         | 
| 76 92 | 
             
                  port: config[:port],
         | 
| 77 | 
            -
                  user:  | 
| 78 | 
            -
                  password:  | 
| 93 | 
            +
                  user: username,
         | 
| 94 | 
            +
                  password: password,
         | 
| 79 95 | 
             
                  ssl: config[:ssl]
         | 
| 80 96 | 
             
                )
         | 
| 81 97 | 
             
              end
         | 
| @@ -28,6 +28,7 @@ | |
| 28 28 | 
             
            require 'sensu-plugin/check/cli'
         | 
| 29 29 | 
             
            require 'json'
         | 
| 30 30 | 
             
            require 'rest_client'
         | 
| 31 | 
            +
            require 'inifile'
         | 
| 31 32 |  | 
| 32 33 | 
             
            # main plugin class
         | 
| 33 34 | 
             
            class CheckRabbitMQNodeHealth < Sensu::Plugin::Check::CLI
         | 
| @@ -115,6 +116,11 @@ class CheckRabbitMQNodeHealth < Sensu::Plugin::Check::CLI | |
| 115 116 | 
             
                     long: '--alarms BOOLEAN',
         | 
| 116 117 | 
             
                     default: 'true'
         | 
| 117 118 |  | 
| 119 | 
            +
              option :ini,
         | 
| 120 | 
            +
                     description: 'Configuration ini file',
         | 
| 121 | 
            +
                     short: '-i',
         | 
| 122 | 
            +
                     long: '--ini VALUE'
         | 
| 123 | 
            +
             | 
| 118 124 | 
             
              def run
         | 
| 119 125 | 
             
                res = node_healthy?
         | 
| 120 126 |  | 
| @@ -136,6 +142,15 @@ class CheckRabbitMQNodeHealth < Sensu::Plugin::Check::CLI | |
| 136 142 | 
             
                password   = config[:password]
         | 
| 137 143 | 
             
                ssl        = config[:ssl]
         | 
| 138 144 | 
             
                verify_ssl = config[:verify_ssl_off]
         | 
| 145 | 
            +
                if config[:ini]
         | 
| 146 | 
            +
                  ini = IniFile.load(config[:ini])
         | 
| 147 | 
            +
                  section = ini['auth']
         | 
| 148 | 
            +
                  username = section['username']
         | 
| 149 | 
            +
                  password = section['password']
         | 
| 150 | 
            +
                else
         | 
| 151 | 
            +
                  username = config[:username]
         | 
| 152 | 
            +
                  password = config[:password]
         | 
| 153 | 
            +
                end
         | 
| 139 154 |  | 
| 140 155 | 
             
                begin
         | 
| 141 156 | 
             
                  url_prefix = ssl ? 'https' : 'http'
         | 
| @@ -34,6 +34,7 @@ | |
| 34 34 |  | 
| 35 35 | 
             
            require 'sensu-plugin/check/cli'
         | 
| 36 36 | 
             
            require 'carrot-top'
         | 
| 37 | 
            +
            require 'inifile'
         | 
| 37 38 |  | 
| 38 39 | 
             
            # Main plugin class
         | 
| 39 40 | 
             
            class CheckRabbitMQNodeUsage < Sensu::Plugin::Check::CLI
         | 
| @@ -143,6 +144,11 @@ class CheckRabbitMQNodeUsage < Sensu::Plugin::Check::CLI | |
| 143 144 | 
             
                     proc: proc(&:to_f),
         | 
| 144 145 | 
             
                     default: 90
         | 
| 145 146 |  | 
| 147 | 
            +
              option :ini,
         | 
| 148 | 
            +
                     description: 'Configuration ini file',
         | 
| 149 | 
            +
                     short: '-i',
         | 
| 150 | 
            +
                     long: '--ini VALUE'
         | 
| 151 | 
            +
             | 
| 146 152 | 
             
              def run
         | 
| 147 153 | 
             
                res = node_healthy?
         | 
| 148 154 |  | 
| @@ -293,11 +299,21 @@ class CheckRabbitMQNodeUsage < Sensu::Plugin::Check::CLI | |
| 293 299 | 
             
              end
         | 
| 294 300 |  | 
| 295 301 | 
             
              def rabbitmq_management
         | 
| 302 | 
            +
                if config[:ini]
         | 
| 303 | 
            +
                  ini = IniFile.load(config[:ini])
         | 
| 304 | 
            +
                  section = ini['auth']
         | 
| 305 | 
            +
                  username = section['username']
         | 
| 306 | 
            +
                  password = section['password']
         | 
| 307 | 
            +
                else
         | 
| 308 | 
            +
                  username = config[:username]
         | 
| 309 | 
            +
                  password = config[:password]
         | 
| 310 | 
            +
                end
         | 
| 311 | 
            +
             | 
| 296 312 | 
             
                CarrotTop.new(
         | 
| 297 313 | 
             
                  host: config[:host],
         | 
| 298 314 | 
             
                  port: config[:port],
         | 
| 299 | 
            -
                  user:  | 
| 300 | 
            -
                  password:  | 
| 315 | 
            +
                  user: username,
         | 
| 316 | 
            +
                  password: password,
         | 
| 301 317 | 
             
                  ssl: config[:ssl]
         | 
| 302 318 | 
             
                )
         | 
| 303 319 | 
             
              end
         | 
| @@ -29,6 +29,7 @@ | |
| 29 29 | 
             
            require 'sensu-plugin/check/cli'
         | 
| 30 30 | 
             
            require 'socket'
         | 
| 31 31 | 
             
            require 'carrot-top'
         | 
| 32 | 
            +
            require 'inifile'
         | 
| 32 33 |  | 
| 33 34 | 
             
            # main plugin class
         | 
| 34 35 | 
             
            class CheckRabbitMQQueueDrainTime < Sensu::Plugin::Check::CLI
         | 
| @@ -48,9 +49,9 @@ class CheckRabbitMQQueueDrainTime < Sensu::Plugin::Check::CLI | |
| 48 49 | 
             
                     short: '-v',
         | 
| 49 50 | 
             
                     long: '--vhost VHOST'
         | 
| 50 51 |  | 
| 51 | 
            -
              option : | 
| 52 | 
            +
              option :username,
         | 
| 52 53 | 
             
                     description: 'RabbitMQ management API user',
         | 
| 53 | 
            -
                     long: '-- | 
| 54 | 
            +
                     long: '--username USER',
         | 
| 54 55 | 
             
                     default: 'guest'
         | 
| 55 56 |  | 
| 56 57 | 
             
              option :password,
         | 
| @@ -81,13 +82,28 @@ class CheckRabbitMQQueueDrainTime < Sensu::Plugin::Check::CLI | |
| 81 82 | 
             
                     description: 'CRITICAL time that messages will process at current rate',
         | 
| 82 83 | 
             
                     default: 360
         | 
| 83 84 |  | 
| 85 | 
            +
              option :ini,
         | 
| 86 | 
            +
                     description: 'Configuration ini file',
         | 
| 87 | 
            +
                     short: '-i',
         | 
| 88 | 
            +
                     long: '--ini VALUE'
         | 
| 89 | 
            +
             | 
| 84 90 | 
             
              def acquire_rabbitmq_queues
         | 
| 85 91 | 
             
                begin
         | 
| 92 | 
            +
                  if config[:ini]
         | 
| 93 | 
            +
                    ini = IniFile.load(config[:ini])
         | 
| 94 | 
            +
                    section = ini['auth']
         | 
| 95 | 
            +
                    username = section['username']
         | 
| 96 | 
            +
                    password = section['password']
         | 
| 97 | 
            +
                  else
         | 
| 98 | 
            +
                    username = config[:username]
         | 
| 99 | 
            +
                    password = config[:password]
         | 
| 100 | 
            +
                  end
         | 
| 101 | 
            +
             | 
| 86 102 | 
             
                  rabbitmq_info = CarrotTop.new(
         | 
| 87 103 | 
             
                    host: config[:host],
         | 
| 88 104 | 
             
                    port: config[:port],
         | 
| 89 | 
            -
                    user:  | 
| 90 | 
            -
                    password:  | 
| 105 | 
            +
                    user: username,
         | 
| 106 | 
            +
                    password: password,
         | 
| 91 107 | 
             
                    ssl: config[:ssl]
         | 
| 92 108 | 
             
                  )
         | 
| 93 109 | 
             
                rescue
         | 
    
        data/bin/check-rabbitmq-queue.rb
    CHANGED
    
    | @@ -24,6 +24,7 @@ | |
| 24 24 | 
             
            require 'sensu-plugin/check/cli'
         | 
| 25 25 | 
             
            require 'socket'
         | 
| 26 26 | 
             
            require 'carrot-top'
         | 
| 27 | 
            +
            require 'inifile'
         | 
| 27 28 |  | 
| 28 29 | 
             
            # main plugin class
         | 
| 29 30 | 
             
            class CheckRabbitMQMessages < Sensu::Plugin::Check::CLI
         | 
| @@ -50,9 +51,9 @@ class CheckRabbitMQMessages < Sensu::Plugin::Check::CLI | |
| 50 51 | 
             
                     boolean: true,
         | 
| 51 52 | 
             
                     default: false
         | 
| 52 53 |  | 
| 53 | 
            -
              option : | 
| 54 | 
            +
              option :username,
         | 
| 54 55 | 
             
                     description: 'RabbitMQ management API user',
         | 
| 55 | 
            -
                     long: '-- | 
| 56 | 
            +
                     long: '--username USER',
         | 
| 56 57 | 
             
                     default: 'guest'
         | 
| 57 58 |  | 
| 58 59 | 
             
              option :password,
         | 
| @@ -102,13 +103,28 @@ class CheckRabbitMQMessages < Sensu::Plugin::Check::CLI | |
| 102 103 | 
             
                     boolean: true,
         | 
| 103 104 | 
             
                     default: false
         | 
| 104 105 |  | 
| 106 | 
            +
              option :ini,
         | 
| 107 | 
            +
                     description: 'Configuration ini file',
         | 
| 108 | 
            +
                     short: '-i',
         | 
| 109 | 
            +
                     long: '--ini VALUE'
         | 
| 110 | 
            +
             | 
| 105 111 | 
             
              def acquire_rabbitmq_info
         | 
| 106 112 | 
             
                begin
         | 
| 113 | 
            +
                  if config[:ini]
         | 
| 114 | 
            +
                    ini = IniFile.load(config[:ini])
         | 
| 115 | 
            +
                    section = ini['auth']
         | 
| 116 | 
            +
                    username = section['username']
         | 
| 117 | 
            +
                    password = section['password']
         | 
| 118 | 
            +
                  else
         | 
| 119 | 
            +
                    username = config[:username]
         | 
| 120 | 
            +
                    password = config[:password]
         | 
| 121 | 
            +
                  end
         | 
| 122 | 
            +
             | 
| 107 123 | 
             
                  rabbitmq_info = CarrotTop.new(
         | 
| 108 124 | 
             
                    host: config[:host],
         | 
| 109 125 | 
             
                    port: config[:port],
         | 
| 110 | 
            -
                    user:  | 
| 111 | 
            -
                    password:  | 
| 126 | 
            +
                    user: username,
         | 
| 127 | 
            +
                    password: password,
         | 
| 112 128 | 
             
                    ssl: config[:ssl]
         | 
| 113 129 | 
             
                  )
         | 
| 114 130 | 
             
                rescue
         | 
| @@ -26,6 +26,7 @@ | |
| 26 26 |  | 
| 27 27 | 
             
            require 'sensu-plugin/check/cli'
         | 
| 28 28 | 
             
            require 'stomp'
         | 
| 29 | 
            +
            require 'inifile'
         | 
| 29 30 |  | 
| 30 31 | 
             
            # main plugin class
         | 
| 31 32 | 
             
            class CheckRabbitStomp < Sensu::Plugin::Check::CLI
         | 
| @@ -65,6 +66,11 @@ class CheckRabbitStomp < Sensu::Plugin::Check::CLI | |
| 65 66 | 
             
                     long: '--queue QUEUE',
         | 
| 66 67 | 
             
                     default: 'aliveness-test'
         | 
| 67 68 |  | 
| 69 | 
            +
              option :ini,
         | 
| 70 | 
            +
                     description: 'Configuration ini file',
         | 
| 71 | 
            +
                     short: '-i',
         | 
| 72 | 
            +
                     long: '--ini VALUE'
         | 
| 73 | 
            +
             | 
| 68 74 | 
             
              def run
         | 
| 69 75 | 
             
                res = vhost_alive?
         | 
| 70 76 |  | 
| @@ -78,11 +84,21 @@ class CheckRabbitStomp < Sensu::Plugin::Check::CLI | |
| 78 84 | 
             
              end
         | 
| 79 85 |  | 
| 80 86 | 
             
              def vhost_alive?
         | 
| 87 | 
            +
                if config[:ini]
         | 
| 88 | 
            +
                  ini = IniFile.load(config[:ini])
         | 
| 89 | 
            +
                  section = ini['auth']
         | 
| 90 | 
            +
                  username = section['username']
         | 
| 91 | 
            +
                  password = section['password']
         | 
| 92 | 
            +
                else
         | 
| 93 | 
            +
                  username = config[:username]
         | 
| 94 | 
            +
                  password = config[:password]
         | 
| 95 | 
            +
                end
         | 
| 96 | 
            +
             | 
| 81 97 | 
             
                hash = {
         | 
| 82 98 | 
             
                  hosts: [
         | 
| 83 99 | 
             
                    {
         | 
| 84 | 
            -
                      login:  | 
| 85 | 
            -
                      passcode:  | 
| 100 | 
            +
                      login: username,
         | 
| 101 | 
            +
                      passcode: password,
         | 
| 86 102 | 
             
                      host: config[:host],
         | 
| 87 103 | 
             
                      port: config[:port],
         | 
| 88 104 | 
             
                      ssl: config[:ssl]
         | 
| @@ -39,6 +39,7 @@ | |
| 39 39 | 
             
            require 'sensu-plugin/metric/cli'
         | 
| 40 40 | 
             
            require 'socket'
         | 
| 41 41 | 
             
            require 'carrot-top'
         | 
| 42 | 
            +
            require 'inifile'
         | 
| 42 43 |  | 
| 43 44 | 
             
            # main plugin class
         | 
| 44 45 | 
             
            class RabbitMQMetrics < Sensu::Plugin::Metric::CLI::Graphite
         | 
| @@ -53,9 +54,9 @@ class RabbitMQMetrics < Sensu::Plugin::Metric::CLI::Graphite | |
| 53 54 | 
             
                     proc: proc(&:to_i),
         | 
| 54 55 | 
             
                     default: 15_672
         | 
| 55 56 |  | 
| 56 | 
            -
              option : | 
| 57 | 
            +
              option :username,
         | 
| 57 58 | 
             
                     description: 'RabbitMQ management API user',
         | 
| 58 | 
            -
                     long: '-- | 
| 59 | 
            +
                     long: '--username USER',
         | 
| 59 60 | 
             
                     default: 'guest'
         | 
| 60 61 |  | 
| 61 62 | 
             
              option :password,
         | 
| @@ -74,13 +75,28 @@ class RabbitMQMetrics < Sensu::Plugin::Metric::CLI::Graphite | |
| 74 75 | 
             
                     boolean: true,
         | 
| 75 76 | 
             
                     default: false
         | 
| 76 77 |  | 
| 78 | 
            +
              option :ini,
         | 
| 79 | 
            +
                     description: 'Configuration ini file',
         | 
| 80 | 
            +
                     short: '-i',
         | 
| 81 | 
            +
                     long: '--ini VALUE'
         | 
| 82 | 
            +
             | 
| 77 83 | 
             
              def acquire_rabbitmq_info
         | 
| 78 84 | 
             
                begin
         | 
| 85 | 
            +
                  if config[:ini]
         | 
| 86 | 
            +
                    ini = IniFile.load(config[:ini])
         | 
| 87 | 
            +
                    section = ini['auth']
         | 
| 88 | 
            +
                    username = section['username']
         | 
| 89 | 
            +
                    password = section['password']
         | 
| 90 | 
            +
                  else
         | 
| 91 | 
            +
                    username = config[:username]
         | 
| 92 | 
            +
                    password = config[:password]
         | 
| 93 | 
            +
                  end
         | 
| 94 | 
            +
             | 
| 79 95 | 
             
                  rabbitmq_info = CarrotTop.new(
         | 
| 80 96 | 
             
                    host: config[:host],
         | 
| 81 97 | 
             
                    port: config[:port],
         | 
| 82 | 
            -
                    user:  | 
| 83 | 
            -
                    password:  | 
| 98 | 
            +
                    user: username,
         | 
| 99 | 
            +
                    password: password,
         | 
| 84 100 | 
             
                    ssl: config[:ssl]
         | 
| 85 101 | 
             
                  )
         | 
| 86 102 | 
             
                rescue
         | 
| @@ -29,6 +29,7 @@ | |
| 29 29 | 
             
            require 'sensu-plugin/metric/cli'
         | 
| 30 30 | 
             
            require 'socket'
         | 
| 31 31 | 
             
            require 'carrot-top'
         | 
| 32 | 
            +
            require 'inifile'
         | 
| 32 33 |  | 
| 33 34 | 
             
            # main plugin class
         | 
| 34 35 | 
             
            class RabbitMQMetrics < Sensu::Plugin::Metric::CLI::Graphite
         | 
| @@ -48,9 +49,9 @@ class RabbitMQMetrics < Sensu::Plugin::Metric::CLI::Graphite | |
| 48 49 | 
             
                     short: '-v',
         | 
| 49 50 | 
             
                     long: '--vhost VHOST'
         | 
| 50 51 |  | 
| 51 | 
            -
              option : | 
| 52 | 
            +
              option :username,
         | 
| 52 53 | 
             
                     description: 'RabbitMQ management API user',
         | 
| 53 | 
            -
                     long: '-- | 
| 54 | 
            +
                     long: '--username USER',
         | 
| 54 55 | 
             
                     default: 'guest'
         | 
| 55 56 |  | 
| 56 57 | 
             
              option :password,
         | 
| @@ -73,13 +74,28 @@ class RabbitMQMetrics < Sensu::Plugin::Metric::CLI::Graphite | |
| 73 74 | 
             
                     boolean: true,
         | 
| 74 75 | 
             
                     default: false
         | 
| 75 76 |  | 
| 77 | 
            +
              option :ini,
         | 
| 78 | 
            +
                     description: 'Configuration ini file',
         | 
| 79 | 
            +
                     short: '-i',
         | 
| 80 | 
            +
                     long: '--ini VALUE'
         | 
| 81 | 
            +
             | 
| 76 82 | 
             
              def acquire_rabbitmq_queues
         | 
| 77 83 | 
             
                begin
         | 
| 84 | 
            +
                  if config[:ini]
         | 
| 85 | 
            +
                    ini = IniFile.load(config[:ini])
         | 
| 86 | 
            +
                    section = ini['auth']
         | 
| 87 | 
            +
                    username = section['username']
         | 
| 88 | 
            +
                    password = section['password']
         | 
| 89 | 
            +
                  else
         | 
| 90 | 
            +
                    username = config[:username]
         | 
| 91 | 
            +
                    password = config[:password]
         | 
| 92 | 
            +
                  end
         | 
| 93 | 
            +
             | 
| 78 94 | 
             
                  rabbitmq_info = CarrotTop.new(
         | 
| 79 95 | 
             
                    host: config[:host],
         | 
| 80 96 | 
             
                    port: config[:port],
         | 
| 81 | 
            -
                    user:  | 
| 82 | 
            -
                    password:  | 
| 97 | 
            +
                    user: username,
         | 
| 98 | 
            +
                    password: password,
         | 
| 83 99 | 
             
                    ssl: config[:ssl]
         | 
| 84 100 | 
             
                  )
         | 
| 85 101 | 
             
                rescue
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: sensu-plugins-rabbitmq
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 3.0.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Sensu-Plugins and contributors
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017-05- | 
| 11 | 
            +
            date: 2017-05-10 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: sensu-plugin
         | 
| @@ -94,6 +94,20 @@ dependencies: | |
| 94 94 | 
             
                - - '='
         | 
| 95 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 96 96 | 
             
                    version: 2.0.1
         | 
| 97 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 98 | 
            +
              name: inifile
         | 
| 99 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 100 | 
            +
                requirements:
         | 
| 101 | 
            +
                - - '='
         | 
| 102 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 103 | 
            +
                    version: 3.0.0
         | 
| 104 | 
            +
              type: :runtime
         | 
| 105 | 
            +
              prerelease: false
         | 
| 106 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 107 | 
            +
                requirements:
         | 
| 108 | 
            +
                - - '='
         | 
| 109 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 110 | 
            +
                    version: 3.0.0
         | 
| 97 111 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 98 112 | 
             
              name: bundler
         | 
| 99 113 | 
             
              requirement: !ruby/object:Gem::Requirement
         |