sensu-plugins-http 0.1.2 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f74cf923574f7d54c3d5e4107d83f559a542462f
4
- data.tar.gz: 9b7d3cd3fe681f5111e64d9b7687b0820aee6b77
3
+ metadata.gz: 4a2fddf58bbc4f5e5bb4ee8cb87fe585adc4bf91
4
+ data.tar.gz: ae1a525f5078688b79bc1779961467387eed9a8e
5
5
  SHA512:
6
- metadata.gz: 61bd97f89e22508e3105db509d307811049a714185d498be6883e9a0fc1ce26d8bc2c8c1d2eb5a0e9ef2ca06799fc6fc591e13bb66b214270a517a39c9032abd
7
- data.tar.gz: b7f3853e07aaf80b37ed4e4652e3fc4220791ad5e00f82eb31c461f0c5dd01a6d1838ceb3512dd583b523f9e16f972846cb559026f515c78eb0891451e78499f
6
+ metadata.gz: 98ac5d741959215edc5a1d074f7d7d466e42c5128c6f3b536bb112c592440233ab5bfb80ac40099fee191536cf04f8f4581d2cf4f2f6ea17595cfe0235acc271
7
+ data.tar.gz: 245a69230dcd50d7c1b566bf9a6349b456c20236b660f569891b3ac38e09a9e8a81bb0dbed8fd5aa9bc1343e707bd97b79e6496f08849f1c5ab9ed253899884c
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- 0���>Ɽ@<ؼ
1
+ F�%$�7��ހ�@����n����.U�?M3�����]W��bN8��}lN�&��_p�]�ь#^.)����-wM��E�h�YL����I�@
2
+ �7��3���ҫ~�br�JR}�4��yS�6�"I���v�,h�uX�oHWa֣X �Lv���cH�WƐ�� �&`f3�͝��ۘÐ�D�2�@Z�E���A�!m d�F�c��M5���M4���ՙk΂����G肞�s���XM� ���ѽ �D
data/CHANGELOG.md CHANGED
@@ -6,7 +6,11 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
6
6
  ## Unreleased
7
7
  - nothing
8
8
 
9
- ## 0.2.0 - 2015-07-30
9
+ ## 0.2.0 - 2015-11-17
10
+
11
+ ### Fixed
12
+ - check-http.rb will no longer fail if the plugin timeout is longer than the net/http default timeout
13
+ - check-http-json.rb will no longer fail when comparing strings
10
14
 
11
15
  ### Changed
12
16
  - updated Rubocop to `0.32.1`
@@ -15,6 +19,9 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
15
19
 
16
20
  ### Added
17
21
  - Added a check for last modified time in HTTP headers
22
+ - POST mode for check-http-json.rb
23
+ - Output a message when check-https-cert.rb cannot establish a connection
24
+ - insecure option for check-https-cert.rb to skip SSL cert check
18
25
 
19
26
  ## [0.1.1] - 2015-07-14
20
27
  ### Changed
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Sensu-Plugins-http
2
2
 
3
- [ ![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-http.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-http)
3
+ [![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-http.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-http)
4
4
  [![Gem Version](https://badge.fury.io/rb/sensu-plugins-http.svg)](http://badge.fury.io/rb/sensu-plugins-http)
5
5
  [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-http/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-http)
6
6
  [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-http/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-http)
@@ -43,6 +43,8 @@ class CheckJson < Sensu::Plugin::Check::CLI
43
43
  option :path, short: '-p PATH'
44
44
  option :query, short: '-q QUERY'
45
45
  option :port, short: '-P PORT', proc: proc(&:to_i)
46
+ option :method, short: '-m GET|POST'
47
+ option :postbody, short: '-b /file/with/post/body'
46
48
  option :header, short: '-H HEADER', long: '--header HEADER'
47
49
  option :ssl, short: '-s', boolean: true, default: false
48
50
  option :insecure, short: '-k', boolean: true, default: false
@@ -88,7 +90,7 @@ class CheckJson < Sensu::Plugin::Check::CLI
88
90
  return false
89
91
  end
90
92
 
91
- def acquire_resource # rubocop:disable all
93
+ def acquire_resource
92
94
  http = Net::HTTP.new(config[:host], config[:port])
93
95
 
94
96
  if config[:ssl]
@@ -102,7 +104,15 @@ class CheckJson < Sensu::Plugin::Check::CLI
102
104
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE if config[:insecure]
103
105
  end
104
106
 
105
- req = Net::HTTP::Get.new([config[:path], config[:query]].compact.join('?'))
107
+ if config[:method] == 'POST'
108
+ req = Net::HTTP::Post.new([config[:path], config[:query]].compact.join('?'))
109
+ else
110
+ req = Net::HTTP::Get.new([config[:path], config[:query]].compact.join('?'))
111
+ end
112
+ if config[:postbody]
113
+ post_body = IO.readlines(config[:postbody])
114
+ req.body = post_body.join
115
+ end
106
116
  if !config[:user].nil? && !config[:password].nil?
107
117
  req.basic_auth config[:user], config[:password]
108
118
  end
@@ -128,7 +138,7 @@ class CheckJson < Sensu::Plugin::Check::CLI
128
138
  tree[key]
129
139
  end
130
140
 
131
- fail "unexpected value for key: '#{config[:value]}' != '#{leaf}'" unless leaf == config[:value]
141
+ fail "unexpected value for key: '#{config[:value]}' != '#{leaf}'" unless leaf.to_s == config[:value].to_s
132
142
 
133
143
  ok "key has expected value: '#{config[:key]}' = '#{config[:value]}'"
134
144
  rescue => e
data/bin/check-http.rb CHANGED
@@ -190,7 +190,7 @@ class CheckHttp < Sensu::Plugin::Check::CLI
190
190
  end
191
191
  end
192
192
 
193
- def acquire_resource # rubocop:disable all
193
+ def acquire_resource
194
194
  http = nil
195
195
 
196
196
  if config[:no_proxy]
@@ -201,6 +201,9 @@ class CheckHttp < Sensu::Plugin::Check::CLI
201
201
  else
202
202
  http = Net::HTTP.new(config[:host], config[:port])
203
203
  end
204
+ http.read_timeout = config[:timeout]
205
+ http.open_timeout = config[:timeout]
206
+ http.ssl_timeout = config[:timeout]
204
207
 
205
208
  warn_cert_expire = nil
206
209
  if config[:ssl]
@@ -14,7 +14,7 @@
14
14
  #
15
15
  # DEPENDENCIES:
16
16
  # gem: sensu-plugin
17
- # gem: nrt-https
17
+ # gem: net-https
18
18
  #
19
19
  # USAGE:
20
20
  # #YELLOW
@@ -52,11 +52,21 @@ class CheckHttpCert < Sensu::Plugin::Check::CLI
52
52
  proc: proc(&:to_i),
53
53
  description: 'Critical EXPIRE days before cert expires'
54
54
 
55
+ option :insecure,
56
+ short: '-k',
57
+ boolean: true,
58
+ description: 'Enabling insecure connections',
59
+ default: false
60
+
55
61
  def run
56
62
  uri = URI.parse(config[:url])
57
63
  http = Net::HTTP.new(uri.host, uri.port)
58
64
  http.use_ssl = true
59
- http.verify_mode = OpenSSL::SSL::VERIFY_PEER
65
+ if config[:insecure]
66
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
67
+ else
68
+ http.verify_mode = OpenSSL::SSL::VERIFY_PEER
69
+ end
60
70
 
61
71
  http.start do |h|
62
72
  @cert = h.peer_cert
@@ -74,7 +84,6 @@ class CheckHttpCert < Sensu::Plugin::Check::CLI
74
84
  end
75
85
 
76
86
  rescue
77
- message "Could not connect to #{config[:url]}"
78
- exit 1
87
+ critical "Could not connect to #{config[:url]}"
79
88
  end
80
89
  end
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsHttp
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 1
5
- PATCH = 2
4
+ MINOR = 2
5
+ PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  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.2
4
+ version: 0.2.0
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-30 00:00:00.000000000 Z
33
+ date: 2015-11-17 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: sensu-plugin
@@ -172,7 +172,11 @@ dependencies:
172
172
  - - "~>"
173
173
  - !ruby/object:Gem::Version
174
174
  version: '0.8'
175
- description: Sensu plugins for various http monitors and metrics
175
+ description: |-
176
+ This plugin provides native HTTP instrumentation
177
+ for monitoring and metrics collection, including:
178
+ response code, JSON response, HTTP last modified,
179
+ SSL expiry, and metrics via `curl`.
176
180
  email: "<sensu-users@googlegroups.com>"
177
181
  executables:
178
182
  - metrics-curl.rb
@@ -219,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
223
  version: '0'
220
224
  requirements: []
221
225
  rubyforge_project:
222
- rubygems_version: 2.4.6
226
+ rubygems_version: 2.4.8
223
227
  signing_key:
224
228
  specification_version: 4
225
229
  summary: Sensu plugins for various http monitors and metrics
metadata.gz.sig CHANGED
Binary file