sensu-plugins-postgres 1.2.0 → 1.3.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 +10 -1
- data/bin/check-postgres-connections.rb +6 -4
- data/lib/sensu-plugins-postgres/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: a1323464e435535d66a0b1576376858022278a8d
         | 
| 4 | 
            +
              data.tar.gz: 4019c094ae4a807a0160cfc9125094eec1ceccc9
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 85cf122222ee4acbc37ac6743e600d5af3a76c0ff81c3f9fc570883d82d9bfb0ec85cd13c2da68afdf73c3d79fea39a07385b799f86dda6487825978bbc5ed29
         | 
| 7 | 
            +
              data.tar.gz: cc3e9ee519fdf64b8cfec6080cd5c502edc176c14cd93be807ea95a6dd6c411ad7cad17681eb4f0ae1d013bd07a78570e65d903f732dfe1722391c9f16f6090c
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -4,6 +4,14 @@ 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 | 
            +
             | 
| 8 | 
            +
            ## [1.3.0] - 2017-07-25
         | 
| 9 | 
            +
            ### Fixed
         | 
| 10 | 
            +
            - Take into account reserved superuser connections in check-postgres-connections.rb (@Evesy)
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            ### Added
         | 
| 13 | 
            +
            - Ruby 2.4.1 testing
         | 
| 14 | 
            +
             | 
| 7 15 | 
             
            ## [1.2.0] - 2017-07-12
         | 
| 8 16 | 
             
            ### Added
         | 
| 9 17 | 
             
            - metric-postgres-statsdb.rb: Adds new metric `numbackends`. (@phumpal)
         | 
| @@ -98,7 +106,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang | |
| 98 106 | 
             
            ### Added
         | 
| 99 107 | 
             
            - initial release
         | 
| 100 108 |  | 
| 101 | 
            -
            [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1. | 
| 109 | 
            +
            [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.3.0...HEAD
         | 
| 110 | 
            +
            [1.3.0]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.2.0...1.3.0
         | 
| 102 111 | 
             
            [1.2.0]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.1.2...1.2.0
         | 
| 103 112 | 
             
            [1.1.2]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.1.1...1.1.2
         | 
| 104 113 | 
             
            [1.1.1]: https://github.com/sensu-plugins/sensu-plugins-postgres/compare/1.1.0...1.1.1
         | 
| @@ -100,6 +100,8 @@ class CheckPostgresConnections < Sensu::Plugin::Check::CLI | |
| 100 100 | 
             
                                   port: config[:port],
         | 
| 101 101 | 
             
                                   connect_timeout: config[:timeout])
         | 
| 102 102 | 
             
                  max_conns = con.exec('SHOW max_connections').getvalue(0, 0).to_i
         | 
| 103 | 
            +
                  superuser_conns = con.exec('SHOW superuser_reserved_connections').getvalue(0, 0).to_i
         | 
| 104 | 
            +
                  available_conns = max_conns - superuser_conns
         | 
| 103 105 | 
             
                  current_conns = con.exec('SELECT count(*) from pg_stat_activity').getvalue(0, 0).to_i
         | 
| 104 106 | 
             
                rescue PG::Error => e
         | 
| 105 107 | 
             
                  unknown "Unable to query PostgreSQL: #{e.message}"
         | 
| @@ -108,22 +110,22 @@ class CheckPostgresConnections < Sensu::Plugin::Check::CLI | |
| 108 110 | 
             
                percent = (current_conns.to_f / max_conns.to_f * 100).to_i
         | 
| 109 111 |  | 
| 110 112 | 
             
                if config[:use_percentage]
         | 
| 111 | 
            -
                  message = "PostgreSQL connections at #{percent}%, #{current_conns} out of #{ | 
| 113 | 
            +
                  message = "PostgreSQL connections at #{percent}%, #{current_conns} out of #{available_conns} connections"
         | 
| 112 114 | 
             
                  if percent >= config[:critical]
         | 
| 113 115 | 
             
                    critical message
         | 
| 114 116 | 
             
                  elsif percent >= config[:warning]
         | 
| 115 117 | 
             
                    warning message
         | 
| 116 118 | 
             
                  else
         | 
| 117 | 
            -
                    ok "PostgreSQL connections under threshold: #{percent}%, #{current_conns} out of #{ | 
| 119 | 
            +
                    ok "PostgreSQL connections under threshold: #{percent}%, #{current_conns} out of #{available_conns} connections"
         | 
| 118 120 | 
             
                  end
         | 
| 119 121 | 
             
                else
         | 
| 120 | 
            -
                  message = "PostgreSQL connections at #{current_conns} out of #{ | 
| 122 | 
            +
                  message = "PostgreSQL connections at #{current_conns} out of #{available_conns} connections"
         | 
| 121 123 | 
             
                  if current_conns >= config[:critical]
         | 
| 122 124 | 
             
                    critical message
         | 
| 123 125 | 
             
                  elsif current_conns >= config[:warning]
         | 
| 124 126 | 
             
                    warning message
         | 
| 125 127 | 
             
                  else
         | 
| 126 | 
            -
                    ok "PostgreSQL connections under threshold: #{current_conns} out of #{ | 
| 128 | 
            +
                    ok "PostgreSQL connections under threshold: #{current_conns} out of #{available_conns} connections"
         | 
| 127 129 | 
             
                  end
         | 
| 128 130 | 
             
                end
         | 
| 129 131 | 
             
              end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: sensu-plugins-postgres
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.3.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-07- | 
| 11 | 
            +
            date: 2017-07-26 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: sensu-plugin
         |