sensu-plugins-http 6.0.1 → 6.1.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
  SHA256:
3
- metadata.gz: bc7a6c134a3d32059ef58510324d24382350c0235627202bd9550f5fd3a151d5
4
- data.tar.gz: 3c0e0cba4dca57b61d5f327f57170367fb6d6d8462e41dfd53931475849c3229
3
+ metadata.gz: 787e9ab708f3f4df38809c9ee61e09f85ceb76fb15c26b9f78376e91bb6cc9e9
4
+ data.tar.gz: 2b28a731f62a4d274019a6a6fa545266d005b953b321fd9a22a500c2a9ede37e
5
5
  SHA512:
6
- metadata.gz: fd7bb8de088e0a990f1be6d4d3d5572e14a73e9930178e7b3dc1eac50c98cd702cf7c098c2e3c691a1f1595cae7fb205cb2744c134956e812f78eece7b6088f3
7
- data.tar.gz: 9469fa0400ac11deb1eb0eb77aa3e1c28990f3347e1c2f9f113d6c4a19e3013059a1ab7eaa2767c1d620b68b1f2bc8a204fae0d1d12bb8a4ec84b583defe5a1a
6
+ metadata.gz: b293fb0d9c094e8ccb826a3c82108e099bb42d3776a1fbc6b1893ea39e2a64101166d3f74c2fc3adeaf618c7d7078f229e77ab5262cde3553733a205db238bc6
7
+ data.tar.gz: 8d62f5fd639e01c74c278910c223d145912bdfa4ecb16c4acb929d28bba9edffd65b5bb2cae878eec79feb37cee4290e5a62ddd02bf000bf5e613f3a543c5101
@@ -5,6 +5,10 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [6.1.0] - 2020-04-03
9
+ ### Added
10
+ - `metrics-http-json.rb`: Added `-H/--header` flag to pass custom HTTP headers. (@mblaettler)
11
+
8
12
 
9
13
  ## [6.0.1] - 2020-01-30
10
14
  ### Fixed
@@ -274,7 +278,8 @@ metrics-http-json.rb: Added debug option to see the processing of json data
274
278
  ### Added
275
279
  - Initial release
276
280
 
277
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-http/compare/6.0.1...HEAD
281
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-http/compare/6.1.0...HEAD
282
+ [6.1.0]: https://github.com/sensu-plugins/sensu-plugins-http/compare/6.0.1...6.1.0
278
283
  [6.0.1]: https://github.com/sensu-plugins/sensu-plugins-http/compare/6.0.0...6.0.1
279
284
  [6.0.0]: https://github.com/sensu-plugins/sensu-plugins-http/compare/5.1.1...6.0.0
280
285
  [5.1.1]: https://github.com/sensu-plugins/sensu-plugins-http/compare/5.1.0...5.1.1
@@ -60,6 +60,11 @@ class HttpJsonGraphite < Sensu::Plugin::Metric::CLI::Graphite
60
60
  short: '-m METRIC::JSONKEY',
61
61
  long: '--metric METRIC::JSONKEY'
62
62
 
63
+ option :headers,
64
+ description: 'Additional HTTP request headers to send. Example: Authorization:XYZ,User-Agent:ABC',
65
+ short: '-H HEADER1:val,HEADER2:val',
66
+ long: '--headers HEADER1:val,HEADER2:val'
67
+
63
68
  option :object,
64
69
  description: 'The JSON object containing the data',
65
70
  short: '-o OBJECT',
@@ -85,13 +90,23 @@ class HttpJsonGraphite < Sensu::Plugin::Metric::CLI::Graphite
85
90
  if config[:object]
86
91
  object = config[:object].to_s
87
92
  end
93
+
94
+ header_dict = {}
95
+ if config[:headers]
96
+ config[:headers].split(',').each do |header|
97
+ h, v = header.split(':', 2)
98
+ header_dict[h] = v.strip
99
+ end
100
+ end
101
+
88
102
  # TODO: figure out what to do here
89
103
  url = URI.encode(config[:url].to_s) # rubocop:disable Lint/UriEscapeUnescape
90
104
  begin
91
105
  r = RestClient::Request.execute(
92
106
  url: url,
93
107
  method: :get,
94
- verify_ssl: !config[:insecure]
108
+ verify_ssl: !config[:insecure],
109
+ headers: header_dict
95
110
  )
96
111
 
97
112
  puts "Http response: #{r}" if config[:debug]
@@ -3,8 +3,8 @@
3
3
  module SensuPluginsHttp
4
4
  module Version
5
5
  MAJOR = 6
6
- MINOR = 0
7
- PATCH = 1
6
+ MINOR = 1
7
+ PATCH = 0
8
8
 
9
9
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.1
4
+ version: 6.1.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: 2020-01-31 00:00:00.000000000 Z
11
+ date: 2020-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk