sensu-plugins-graylog 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: da4694237b3238a129ced488fbff3d1c436517c9
4
- data.tar.gz: cf04b79263c1e08b0523f7ff4517f325df14245f
2
+ SHA256:
3
+ metadata.gz: f1ef17b6895951710792467ad9d98343ae6ad08b693f3b18261a29a20e1b5c01
4
+ data.tar.gz: 7421c04082c3971bb740b45af4f2081c83c9dd5a48270f4da7c3b93f92533a9a
5
5
  SHA512:
6
- metadata.gz: 89ac214d73ffd88c1567b36ae53170a146ad79175cc98fa4b977c48c7e2fdc58595aa6d1b3fbf06b90b489b0c7d7da0597ae2d38b10a32c8d2cb7e20797a6384
7
- data.tar.gz: 4a73a7e2a90208990037136b3c1e3a8c89299a2d7cfdd935bf225f5027e7cc38af8b70551af87d1962fee863ad49ea491b4227b0aa7c1989d703b1065cc21d6a
6
+ metadata.gz: 14f63394c4ba8f7df73c026a0492bae39a018299e5df17650ac81b4065ea802b2f7b598c667def64d53a07477f2a7eb05e4abb11f3e144334eda3ea69862c226
7
+ data.tar.gz: f3944ac86f28dd9ae3c1bb7456b3fabb8d0455a07c2cde81309c56016ace034069f9ab8b2399405e4d43d623752a82a8d890c6f37d8934dde2dc86a0539fcb42
data/CHANGELOG.md CHANGED
@@ -1,11 +1,19 @@
1
1
  # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
- This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
4
+ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md)
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
- ## [1.2.0] 2017-07-13
8
+ ## [1.3.0] - 2018-02-16
9
+ ### Added
10
+ - Add `protocol` option to all scripts which can be passed as an argument to specify which protocol to use (@jothoma1)
11
+ - added `insecure` option to make SSL connections even when the CA certificate is not verified. Defaults to use secure connections only (@majormoses)
12
+
13
+ ### Changed
14
+ - updated Changelog locations guideline (@majormoses)
15
+
16
+ ## [1.2.0] - 2017-07-13
9
17
  ### Added
10
18
  - Ruby 2.4.1 testing
11
19
 
@@ -57,7 +65,8 @@ in your environment is encouraged.
57
65
  ### Added
58
66
  - initial release
59
67
 
60
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-graylog/compare/1.2.0...HEAD
68
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-graylog/compare/1.3.0...HEAD
69
+ [1.3.0]: https://github.com/sensu-plugins/sensu-plugins-graylog/compare/1.2.0...1.3.0
61
70
  [1.2.0]: https://github.com/sensu-plugins/sensu-plugins-graylog/compare/1.1.0...1.2.0
62
71
  [1.1.0]: https://github.com/sensu-plugins/sensu-plugins-graylog/compare/1.0.0...1.1.0
63
72
  [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-graylog/compare/0.1.0...1.0.0
@@ -37,6 +37,18 @@ require 'json'
37
37
  require 'rest-client'
38
38
 
39
39
  class CheckGraylogBuffers < Sensu::Plugin::Check::CLI
40
+ option :protocol,
41
+ description: 'Protocol for connecting to Graylog',
42
+ long: '--protocol PROTOCOL',
43
+ default: 'http'
44
+
45
+ option :insecure,
46
+ description: 'Use insecure connections by not verifying SSL certs',
47
+ short: '-k',
48
+ long: '--insecure',
49
+ boolean: true,
50
+ default: false
51
+
40
52
  option :host,
41
53
  description: 'Graylog host',
42
54
  short: '-h',
@@ -87,12 +99,18 @@ class CheckGraylogBuffers < Sensu::Plugin::Check::CLI
87
99
  else
88
100
  check_210_buffers
89
101
  end
90
- rescue => e
102
+ rescue StandardError => e
91
103
  unknown e.message
92
104
  end
93
105
 
94
106
  def call_api(path, postdata = nil)
95
- resource = RestClient::Resource.new "http://#{config[:host]}:#{config[:port]}#{config[:apipath]}#{path}", config[:username], config[:password]
107
+ resource = RestClient::Resource.new(
108
+ "#{config[:protocol]}://#{config[:host]}:#{config[:port]}#{config[:apipath]}#{path}",
109
+ user: config[:username],
110
+ password: config[:password],
111
+ verify_ssl: !config[:insecure]
112
+ )
113
+
96
114
  if !postdata
97
115
  JSON.parse(resource.get)
98
116
  else
@@ -26,6 +26,19 @@ require 'rest-client'
26
26
  require 'json'
27
27
 
28
28
  class CheckGraylogStreams < Sensu::Plugin::Check::CLI
29
+ option :protocol,
30
+ description: 'Protocol for connecting to Graylog',
31
+ long: '--protocol PROTOCOL',
32
+ default: 'http',
33
+ in: %w(http https)
34
+
35
+ option :insecure,
36
+ description: 'Use insecure connections by not verifying SSL certs',
37
+ short: '-k',
38
+ long: '--insecure',
39
+ boolean: true,
40
+ default: false
41
+
29
42
  option :username,
30
43
  short: '-u',
31
44
  long: '--username USERNAME',
@@ -58,9 +71,10 @@ class CheckGraylogStreams < Sensu::Plugin::Check::CLI
58
71
 
59
72
  def graylog_streams
60
73
  resource = RestClient::Resource.new(
61
- "http://#{config[:host]}:#{config[:port]}#{config[:apipath]}/streams",
74
+ "#{config[:protocol]}://#{config[:host]}:#{config[:port]}#{config[:apipath]}/streams",
62
75
  user: config[:username],
63
76
  password: config[:password],
77
+ verify_ssl: !config[:insecure],
64
78
  timeout: 10
65
79
  )
66
80
  JSON.parse(resource.get, symbolize_names: true)
@@ -37,6 +37,19 @@ require 'json'
37
37
  require 'rest-client'
38
38
 
39
39
  class CheckGraylog2Alive < Sensu::Plugin::Check::CLI
40
+ option :protocol,
41
+ description: 'Protocol for connecting to Graylog',
42
+ long: '--protocol PROTOCOL',
43
+ default: 'http',
44
+ in: %w(http https)
45
+
46
+ option :insecure,
47
+ description: 'Use insecure connections by not verifying SSL certs',
48
+ short: '-k',
49
+ long: '--insecure',
50
+ boolean: true,
51
+ default: false
52
+
40
53
  option :host,
41
54
  description: 'Graylog2 host',
42
55
  short: '-h',
@@ -81,6 +94,7 @@ class CheckGraylog2Alive < Sensu::Plugin::Check::CLI
81
94
  end
82
95
 
83
96
  def vhost_alive?
97
+ protocol = config[:protocol]
84
98
  host = config[:host]
85
99
  port = config[:port]
86
100
  username = config[:username]
@@ -90,7 +104,12 @@ class CheckGraylog2Alive < Sensu::Plugin::Check::CLI
90
104
  lifecycle_ok = ['override lb:alive', 'running']
91
105
 
92
106
  begin
93
- resource = RestClient::Resource.new "http://#{host}:#{port}#{apipath}/system", username, password
107
+ resource = RestClient::Resource.new(
108
+ "#{protocol}://#{host}:#{port}#{apipath}/system",
109
+ user: username,
110
+ password: password,
111
+ verify_ssl: !config[:insecure]
112
+ )
94
113
  # Attempt to parse response (just to trigger parse exception)
95
114
  response = JSON.parse(resource.get)
96
115
  status_text = "#{response['lifecycle']}/#{response['is_processing']}/#{response['lb_status']}"
@@ -38,6 +38,19 @@ require 'json'
38
38
  require 'rest-client'
39
39
 
40
40
  class MetricsGraylog < Sensu::Plugin::Metric::CLI::Graphite
41
+ option :protocol,
42
+ description: 'Protocol for connecting to Graylog',
43
+ long: '--protocol PROTOCOL',
44
+ default: 'http',
45
+ in: %w(http https)
46
+
47
+ option :insecure,
48
+ description: 'Use insecure connections by not verifying SSL certs',
49
+ short: '-k',
50
+ long: '--insecure',
51
+ boolean: true,
52
+ default: false
53
+
41
54
  option :host,
42
55
  description: 'Graylog host',
43
56
  short: '-h',
@@ -88,12 +101,17 @@ class MetricsGraylog < Sensu::Plugin::Metric::CLI::Graphite
88
101
  original_output
89
102
  end
90
103
  ok
91
- rescue => e
104
+ rescue StandardError => e
92
105
  unknown e.message
93
106
  end
94
107
 
95
108
  def acquire_stats
96
- resource = RestClient::Resource.new "http://#{config[:host]}:#{config[:port]}#{config[:apipath]}/system/metrics", config[:username], config[:password]
109
+ resource = RestClient::Resource.new(
110
+ "#{config[:protocol]}://#{config[:host]}:#{config[:port]}#{config[:apipath]}/system/metrics",
111
+ user: config[:username],
112
+ password: config[:password],
113
+ verify_ssl: !config[:insecure]
114
+ )
97
115
  JSON.parse(resource.get)
98
116
  rescue Errno::ECONNREFUSED => e
99
117
  critical e.message
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsGraylog
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 2
4
+ MINOR = 3
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-graylog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
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-13 00:00:00.000000000 Z
11
+ date: 2018-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -225,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
225
  version: '0'
226
226
  requirements: []
227
227
  rubyforge_project:
228
- rubygems_version: 2.4.5
228
+ rubygems_version: 2.7.6
229
229
  signing_key:
230
230
  specification_version: 4
231
231
  summary: Sensu plugins for graylog