sensu-plugins-http 0.1.1 → 0.1.2
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
- checksums.yaml.gz.sig +1 -1
- data.tar.gz.sig +1 -1
- data/CHANGELOG.md +13 -0
- data/README.md +2 -1
- data/bin/check-http-json.rb +1 -1
- data/bin/check-http.rb +1 -1
- data/bin/check-last-modified.rb +95 -0
- data/lib/sensu-plugins-http/version.rb +1 -1
- metadata +32 -30
- metadata.gz.sig +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: f74cf923574f7d54c3d5e4107d83f559a542462f
         | 
| 4 | 
            +
              data.tar.gz: 9b7d3cd3fe681f5111e64d9b7687b0820aee6b77
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 61bd97f89e22508e3105db509d307811049a714185d498be6883e9a0fc1ce26d8bc2c8c1d2eb5a0e9ef2ca06799fc6fc591e13bb66b214270a517a39c9032abd
         | 
| 7 | 
            +
              data.tar.gz: b7f3853e07aaf80b37ed4e4652e3fc4220791ad5e00f82eb31c461f0c5dd01a6d1838ceb3512dd583b523f9e16f972846cb559026f515c78eb0891451e78499f
         | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            !HO@�N��[K�q	��5^C�T�*/>��'�'~�8��Ea��hG;�:�e}��7�v��J����C{XT�c����؍r*��!��@u�~���ȧ$k	9��"��c?`�A@�g��A�4"w�ݓ��ٍ��M���Hr�c�	a��̢��3);ϟ���ۅ�wLPǍ[�mf�A4�0^��,�g�9�J}��Z��C�~K8���H}>�	$Sr�oʂݯUڌ�}j�W>WK/D=�e�B��FY�-�`
         | 
    
        data.tar.gz.sig
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            �0���>Ɽ@<ؼ
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -3,6 +3,19 @@ This project adheres to [Semantic Versioning](http://semver.org/). | |
| 3 3 |  | 
| 4 4 | 
             
            This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
         | 
| 5 5 |  | 
| 6 | 
            +
            ## Unreleased
         | 
| 7 | 
            +
            - nothing
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ## 0.2.0 - 2015-07-30
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            ### Changed
         | 
| 12 | 
            +
            - updated Rubocop to `0.32.1`
         | 
| 13 | 
            +
            - put deps in alpha order
         | 
| 14 | 
            +
            - update documentation links
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            ### Added
         | 
| 17 | 
            +
            - Added a check for last modified time in HTTP headers
         | 
| 18 | 
            +
             | 
| 6 19 | 
             
            ## [0.1.1] - 2015-07-14
         | 
| 7 20 | 
             
            ### Changed
         | 
| 8 21 | 
             
            - updated sensu-plugin gem to 1.2.0
         | 
    
        data/README.md
    CHANGED
    
    | @@ -13,12 +13,13 @@ | |
| 13 13 | 
             
             * bin/check-http-json.rb
         | 
| 14 14 | 
             
             * bin/check-http.rb
         | 
| 15 15 | 
             
             * bin/check-https-cert.rb
         | 
| 16 | 
            +
             * bin/check-last-modified.rb
         | 
| 16 17 | 
             
             * bin/metrics-curl.rb
         | 
| 17 18 |  | 
| 18 19 | 
             
            ## Usage
         | 
| 19 20 |  | 
| 20 21 | 
             
            ## Installation
         | 
| 21 22 |  | 
| 22 | 
            -
            [Installation and Setup]( | 
| 23 | 
            +
            [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
         | 
| 23 24 |  | 
| 24 25 | 
             
            ## Notes
         | 
    
        data/bin/check-http-json.rb
    CHANGED
    
    | @@ -64,7 +64,7 @@ class CheckJson < Sensu::Plugin::Check::CLI | |
| 64 64 | 
             
                  config[:ssl] = uri.scheme == 'https'
         | 
| 65 65 | 
             
                else
         | 
| 66 66 | 
             
                  # #YELLOW
         | 
| 67 | 
            -
                  unless config[:host] && config[:path] | 
| 67 | 
            +
                  unless config[:host] && config[:path]
         | 
| 68 68 | 
             
                    unknown 'No URL specified'
         | 
| 69 69 | 
             
                  end
         | 
| 70 70 | 
             
                  config[:port] ||= config[:ssl] ? 443 : 80
         | 
    
        data/bin/check-http.rb
    CHANGED
    
    | @@ -173,7 +173,7 @@ class CheckHttp < Sensu::Plugin::Check::CLI | |
| 173 173 | 
             
                  config[:ssl] = uri.scheme == 'https'
         | 
| 174 174 | 
             
                else
         | 
| 175 175 | 
             
                  # #YELLOW
         | 
| 176 | 
            -
                  unless config[:host] && config[:request_uri] | 
| 176 | 
            +
                  unless config[:host] && config[:request_uri]
         | 
| 177 177 | 
             
                    unknown 'No URL specified'
         | 
| 178 178 | 
             
                  end
         | 
| 179 179 | 
             
                  config[:port] ||= config[:ssl] ? 443 : 80
         | 
| @@ -0,0 +1,95 @@ | |
| 1 | 
            +
            #! /usr/bin/env ruby
         | 
| 2 | 
            +
            #
         | 
| 3 | 
            +
            #   check-fleet-units
         | 
| 4 | 
            +
            #
         | 
| 5 | 
            +
            # DESCRIPTION:
         | 
| 6 | 
            +
            #
         | 
| 7 | 
            +
            # OUTPUT:
         | 
| 8 | 
            +
            #   plain text
         | 
| 9 | 
            +
            #
         | 
| 10 | 
            +
            # PLATFORMS:
         | 
| 11 | 
            +
            #   Linux
         | 
| 12 | 
            +
            #
         | 
| 13 | 
            +
            # DEPENDENCIES:
         | 
| 14 | 
            +
            #   gem: sensu-plugin
         | 
| 15 | 
            +
            #
         | 
| 16 | 
            +
            # USAGE:
         | 
| 17 | 
            +
            #
         | 
| 18 | 
            +
            # NOTES:
         | 
| 19 | 
            +
            #
         | 
| 20 | 
            +
            # LICENSE:
         | 
| 21 | 
            +
            #   Barry Martin <nyxcharon@gmail.com>
         | 
| 22 | 
            +
            #   Released under the same terms as Sensu (the MIT license); see LICENSE
         | 
| 23 | 
            +
            #   for details.
         | 
| 24 | 
            +
            #
         | 
| 25 | 
            +
            require 'sensu-plugin/check/cli'
         | 
| 26 | 
            +
            require 'net/https'
         | 
| 27 | 
            +
            require 'time'
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            #
         | 
| 30 | 
            +
            # Checks the last modified time of a file to verify it has been updated within a
         | 
| 31 | 
            +
            # specified threshold.
         | 
| 32 | 
            +
            #
         | 
| 33 | 
            +
            class CheckLastModified < Sensu::Plugin::Check::CLI
         | 
| 34 | 
            +
              option :url,
         | 
| 35 | 
            +
                     short: '-u URL',
         | 
| 36 | 
            +
                     long: '--url URL',
         | 
| 37 | 
            +
                     description: 'The URL of the file to be checked'
         | 
| 38 | 
            +
             | 
| 39 | 
            +
              option :user,
         | 
| 40 | 
            +
                     short: '-U USER',
         | 
| 41 | 
            +
                     long: '--username USER',
         | 
| 42 | 
            +
                     description: 'A username to connect as'
         | 
| 43 | 
            +
             | 
| 44 | 
            +
              option :password,
         | 
| 45 | 
            +
                     short: '-a PASS',
         | 
| 46 | 
            +
                     long: '--password PASS',
         | 
| 47 | 
            +
                     description: 'A password to use for the username'
         | 
| 48 | 
            +
             | 
| 49 | 
            +
              option :threshold,
         | 
| 50 | 
            +
                     short: '-t TIME',
         | 
| 51 | 
            +
                     long: '--time TIME',
         | 
| 52 | 
            +
                     description: 'The time in seconds the file should be updated by'
         | 
| 53 | 
            +
             | 
| 54 | 
            +
              def run
         | 
| 55 | 
            +
                cli = CheckLastModified.new
         | 
| 56 | 
            +
                cli.parse_options
         | 
| 57 | 
            +
                url = cli.config[:url]
         | 
| 58 | 
            +
                threshold = cli.config[:threshold]
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                # Validate arguments
         | 
| 61 | 
            +
                unless url
         | 
| 62 | 
            +
                  unknown 'No URL specified'
         | 
| 63 | 
            +
                end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                unless threshold
         | 
| 66 | 
            +
                  unknown 'No threshold specified'
         | 
| 67 | 
            +
                end
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                # Build a request from user options and then request it
         | 
| 70 | 
            +
                uri = URI(url)
         | 
| 71 | 
            +
                http = Net::HTTP.new(uri.host, uri.port)
         | 
| 72 | 
            +
                request = Net::HTTP::Head.new(uri.request_uri)
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                if cli.config[:user] && cli.config[:password]
         | 
| 75 | 
            +
                  http.use_ssl = true
         | 
| 76 | 
            +
                  request.basic_auth(cli.config[:user], cli.config[:password])
         | 
| 77 | 
            +
                end
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                response = http.request(request)
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                if response.header['last-modified'].nil?
         | 
| 82 | 
            +
                  critical 'Http Error'
         | 
| 83 | 
            +
                end
         | 
| 84 | 
            +
             | 
| 85 | 
            +
                # Get timestamp of file and local timestamp and compare (Both in UTC)
         | 
| 86 | 
            +
                file_stamp = Time.parse(response.header['last-modified']).getgm
         | 
| 87 | 
            +
                local_stamp = Time.now.getgm
         | 
| 88 | 
            +
             | 
| 89 | 
            +
                if (local_stamp - file_stamp).to_i <= threshold.to_i
         | 
| 90 | 
            +
                  ok 'Last modified time OK'
         | 
| 91 | 
            +
                else
         | 
| 92 | 
            +
                  critical 'Last modified time greater than threshold'
         | 
| 93 | 
            +
                end
         | 
| 94 | 
            +
              end
         | 
| 95 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: sensu-plugins-http
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Sensu-Plugins and contributors
         | 
| @@ -30,7 +30,7 @@ cert_chain: | |
| 30 30 | 
             
              8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
         | 
| 31 31 | 
             
              HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
         | 
| 32 32 | 
             
              -----END CERTIFICATE-----
         | 
| 33 | 
            -
            date: 2015-07- | 
| 33 | 
            +
            date: 2015-07-30 00:00:00.000000000 Z
         | 
| 34 34 | 
             
            dependencies:
         | 
| 35 35 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 36 36 | 
             
              name: sensu-plugin
         | 
| @@ -47,61 +47,61 @@ dependencies: | |
| 47 47 | 
             
                  - !ruby/object:Gem::Version
         | 
| 48 48 | 
             
                    version: 1.2.0
         | 
| 49 49 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 50 | 
            -
              name:  | 
| 50 | 
            +
              name: bundler
         | 
| 51 51 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 52 52 | 
             
                requirements:
         | 
| 53 53 | 
             
                - - "~>"
         | 
| 54 54 | 
             
                  - !ruby/object:Gem::Version
         | 
| 55 | 
            -
                    version: ' | 
| 55 | 
            +
                    version: '1.7'
         | 
| 56 56 | 
             
              type: :development
         | 
| 57 57 | 
             
              prerelease: false
         | 
| 58 58 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 59 59 | 
             
                requirements:
         | 
| 60 60 | 
             
                - - "~>"
         | 
| 61 61 | 
             
                  - !ruby/object:Gem::Version
         | 
| 62 | 
            -
                    version: ' | 
| 62 | 
            +
                    version: '1.7'
         | 
| 63 63 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 64 | 
            -
              name:  | 
| 64 | 
            +
              name: codeclimate-test-reporter
         | 
| 65 65 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 66 66 | 
             
                requirements:
         | 
| 67 | 
            -
                - -  | 
| 67 | 
            +
                - - "~>"
         | 
| 68 68 | 
             
                  - !ruby/object:Gem::Version
         | 
| 69 | 
            -
                    version: '0. | 
| 69 | 
            +
                    version: '0.4'
         | 
| 70 70 | 
             
              type: :development
         | 
| 71 71 | 
             
              prerelease: false
         | 
| 72 72 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 73 73 | 
             
                requirements:
         | 
| 74 | 
            -
                - -  | 
| 74 | 
            +
                - - "~>"
         | 
| 75 75 | 
             
                  - !ruby/object:Gem::Version
         | 
| 76 | 
            -
                    version: '0. | 
| 76 | 
            +
                    version: '0.4'
         | 
| 77 77 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 78 | 
            -
              name:  | 
| 78 | 
            +
              name: github-markup
         | 
| 79 79 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 80 80 | 
             
                requirements:
         | 
| 81 81 | 
             
                - - "~>"
         | 
| 82 82 | 
             
                  - !ruby/object:Gem::Version
         | 
| 83 | 
            -
                    version: '3 | 
| 83 | 
            +
                    version: '1.3'
         | 
| 84 84 | 
             
              type: :development
         | 
| 85 85 | 
             
              prerelease: false
         | 
| 86 86 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 87 87 | 
             
                requirements:
         | 
| 88 88 | 
             
                - - "~>"
         | 
| 89 89 | 
             
                  - !ruby/object:Gem::Version
         | 
| 90 | 
            -
                    version: '3 | 
| 90 | 
            +
                    version: '1.3'
         | 
| 91 91 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 92 | 
            -
              name:  | 
| 92 | 
            +
              name: pry
         | 
| 93 93 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 94 94 | 
             
                requirements:
         | 
| 95 95 | 
             
                - - "~>"
         | 
| 96 96 | 
             
                  - !ruby/object:Gem::Version
         | 
| 97 | 
            -
                    version: ' | 
| 97 | 
            +
                    version: '0.10'
         | 
| 98 98 | 
             
              type: :development
         | 
| 99 99 | 
             
              prerelease: false
         | 
| 100 100 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 101 101 | 
             
                requirements:
         | 
| 102 102 | 
             
                - - "~>"
         | 
| 103 103 | 
             
                  - !ruby/object:Gem::Version
         | 
| 104 | 
            -
                    version: ' | 
| 104 | 
            +
                    version: '0.10'
         | 
| 105 105 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 106 106 | 
             
              name: rake
         | 
| 107 107 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -117,65 +117,66 @@ dependencies: | |
| 117 117 | 
             
                  - !ruby/object:Gem::Version
         | 
| 118 118 | 
             
                    version: '10.0'
         | 
| 119 119 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 120 | 
            -
              name:  | 
| 120 | 
            +
              name: redcarpet
         | 
| 121 121 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 122 122 | 
             
                requirements:
         | 
| 123 123 | 
             
                - - "~>"
         | 
| 124 124 | 
             
                  - !ruby/object:Gem::Version
         | 
| 125 | 
            -
                    version: ' | 
| 125 | 
            +
                    version: '3.2'
         | 
| 126 126 | 
             
              type: :development
         | 
| 127 127 | 
             
              prerelease: false
         | 
| 128 128 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 129 129 | 
             
                requirements:
         | 
| 130 130 | 
             
                - - "~>"
         | 
| 131 131 | 
             
                  - !ruby/object:Gem::Version
         | 
| 132 | 
            -
                    version: ' | 
| 132 | 
            +
                    version: '3.2'
         | 
| 133 133 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 134 | 
            -
              name:  | 
| 134 | 
            +
              name: rspec
         | 
| 135 135 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 136 136 | 
             
                requirements:
         | 
| 137 137 | 
             
                - - "~>"
         | 
| 138 138 | 
             
                  - !ruby/object:Gem::Version
         | 
| 139 | 
            -
                    version: '3. | 
| 139 | 
            +
                    version: '3.1'
         | 
| 140 140 | 
             
              type: :development
         | 
| 141 141 | 
             
              prerelease: false
         | 
| 142 142 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 143 143 | 
             
                requirements:
         | 
| 144 144 | 
             
                - - "~>"
         | 
| 145 145 | 
             
                  - !ruby/object:Gem::Version
         | 
| 146 | 
            -
                    version: '3. | 
| 146 | 
            +
                    version: '3.1'
         | 
| 147 147 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 148 | 
            -
              name:  | 
| 148 | 
            +
              name: rubocop
         | 
| 149 149 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 150 150 | 
             
                requirements:
         | 
| 151 | 
            -
                - -  | 
| 151 | 
            +
                - - '='
         | 
| 152 152 | 
             
                  - !ruby/object:Gem::Version
         | 
| 153 | 
            -
                    version:  | 
| 153 | 
            +
                    version: 0.32.1
         | 
| 154 154 | 
             
              type: :development
         | 
| 155 155 | 
             
              prerelease: false
         | 
| 156 156 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 157 157 | 
             
                requirements:
         | 
| 158 | 
            -
                - -  | 
| 158 | 
            +
                - - '='
         | 
| 159 159 | 
             
                  - !ruby/object:Gem::Version
         | 
| 160 | 
            -
                    version:  | 
| 160 | 
            +
                    version: 0.32.1
         | 
| 161 161 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 162 | 
            -
              name:  | 
| 162 | 
            +
              name: yard
         | 
| 163 163 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 164 164 | 
             
                requirements:
         | 
| 165 165 | 
             
                - - "~>"
         | 
| 166 166 | 
             
                  - !ruby/object:Gem::Version
         | 
| 167 | 
            -
                    version: '0. | 
| 167 | 
            +
                    version: '0.8'
         | 
| 168 168 | 
             
              type: :development
         | 
| 169 169 | 
             
              prerelease: false
         | 
| 170 170 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 171 171 | 
             
                requirements:
         | 
| 172 172 | 
             
                - - "~>"
         | 
| 173 173 | 
             
                  - !ruby/object:Gem::Version
         | 
| 174 | 
            -
                    version: '0. | 
| 174 | 
            +
                    version: '0.8'
         | 
| 175 175 | 
             
            description: Sensu plugins for various http monitors and metrics
         | 
| 176 176 | 
             
            email: "<sensu-users@googlegroups.com>"
         | 
| 177 177 | 
             
            executables:
         | 
| 178 178 | 
             
            - metrics-curl.rb
         | 
| 179 | 
            +
            - check-last-modified.rb
         | 
| 179 180 | 
             
            - check-https-cert.rb
         | 
| 180 181 | 
             
            - check-http.rb
         | 
| 181 182 | 
             
            - check-http-json.rb
         | 
| @@ -188,6 +189,7 @@ files: | |
| 188 189 | 
             
            - bin/check-http-json.rb
         | 
| 189 190 | 
             
            - bin/check-http.rb
         | 
| 190 191 | 
             
            - bin/check-https-cert.rb
         | 
| 192 | 
            +
            - bin/check-last-modified.rb
         | 
| 191 193 | 
             
            - bin/metrics-curl.rb
         | 
| 192 194 | 
             
            - lib/sensu-plugins-http.rb
         | 
| 193 195 | 
             
            - lib/sensu-plugins-http/version.rb
         | 
    
        metadata.gz.sig
    CHANGED
    
    | Binary file |