sensu-plugins-dns 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c4a1a4584123303d29aa528f66076f41cf91b9ea1158e4dcb1ccb2cb83692c6
4
- data.tar.gz: bdef1db7617e2bef6e563118c5dde7fdd35a9491f36b48a2012e85d4cbcd4be0
3
+ metadata.gz: 53a429e24b6cdf656b6e77bf0029e665d140c74efef5cf62dd9cbd36745c5dfb
4
+ data.tar.gz: a84326254d63f448522ea399c1f1ea511424db4b20ba3fc237a760aeeead905c
5
5
  SHA512:
6
- metadata.gz: 5a2f3339c209eb1980f2261cc7674f40160b3d54cf72e83e3edd03d5c19f1d15ecfa7ad3e924d28613149baba83b3f1323ebd64a944ad65b66b6474c6f8a4ff9
7
- data.tar.gz: f8088ee883af1e38e7d89c6fedc4fa0c89ee87b2931d14e96a2a156f542e46d856f947a4220d1f3816af1e195ac1f588578a1e28788515d534817fcf9e2c665a
6
+ metadata.gz: 8bab8fa874b28fab41648b1ab3c19fd0f7876e944abbc9a1d50840f57ba91fdaf07bb27497d3fccbca185b06ac4e50d97c25f465135f1fb7f60a222061f6e20a
7
+ data.tar.gz: 156d4f4a21c48cb9fa08add6b340f8162ff654fe8fcf8d981d10267dbbecc24d048893a6617a52dfa43df7ec209ff6137630478d2d95b238efa34a73ff346dd0
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.4.0] - 2018-03-21
9
+ ### Added
10
+ - check-dns.rb: Added ability to use many name servers (@yuri-zubov)
11
+
8
12
  ## [1.3.0] - 2017-11-04
9
13
  ### Added
10
14
  - Support for multiple resolvable ips (comma separated). (@adamdecaf)
@@ -76,7 +80,8 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
76
80
  ### Changed
77
81
  - removed cruft from /lib
78
82
 
79
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-dns/compare/1.2.1...HEAD
83
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-dns/compare/1.4.0...HEAD
84
+ [1.4.0]: https://github.com/sensu-plugins/sensu-plugins-dns/compare/1.3.0...1.4.0
80
85
  [1.3.0]: https://github.com/sensu-plugins/sensu-plugins-dns/compare/1.2.1...1.3.0
81
86
  [1.2.1]: https://github.com/sensu-plugins/sensu-plugins-dns/compare/1.2.0...1/1.2.1
82
87
  [1.2.0]: https://github.com/sensu-plugins/sensu-plugins-dns/compare/1.1.0...1/1.2
data/bin/check-dns.rb CHANGED
@@ -54,7 +54,7 @@ class DNS < Sensu::Plugin::Check::CLI
54
54
  default: 'IN'
55
55
 
56
56
  option :server,
57
- description: 'Server to use for resolution',
57
+ description: 'A comma-separated list of servers to use for resolution',
58
58
  short: '-s SERVER',
59
59
  long: '--server SERVER'
60
60
 
@@ -118,9 +118,10 @@ class DNS < Sensu::Plugin::Check::CLI
118
118
  proc: proc(&:to_i),
119
119
  default: 5
120
120
 
121
- def resolve_domain
121
+ def resolve_domain(server)
122
122
  dnsruby_config = {}
123
- dnsruby_config[:nameserver] = [config[:server]] unless config[:server].nil?
123
+
124
+ dnsruby_config[:nameserver] = server unless server.nil?
124
125
  dnsruby_config[:port] = config[:port] unless config[:port].nil?
125
126
  dnsruby_config[:use_tcp] = config[:use_tcp] unless config[:use_tcp].nil?
126
127
  resolv = Dnsruby::Resolver.new(dnsruby_config)
@@ -229,10 +230,19 @@ class DNS < Sensu::Plugin::Check::CLI
229
230
  unknown 'No domain specified' if config[:domain].nil?
230
231
  unknown 'Count must be 1 or more' if config[:request_count] < 1
231
232
 
232
- entries = resolve_domain
233
- errors, success = check_results(entries)
233
+ success = []
234
+ errors = []
235
+
236
+ ns = config[:server].nil? ? [nil] : config[:server].split(',')
237
+ ns.each do |server|
238
+ entries = resolve_domain(server)
239
+ e, s = check_results(entries)
240
+
241
+ success += s
242
+ errors += e
243
+ end
234
244
 
235
- percent = success.count.to_f / config[:request_count] * 100
245
+ percent = success.count.to_f / (config[:request_count] * ns.count) * 100
236
246
  if percent < config[:threshold]
237
247
  output = "#{percent.to_i}% of tests succeeded: #{errors.uniq.join(', ')}"
238
248
  config[:warn_only] ? warning(output) : critical(output)
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsDNS
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 3
4
+ MINOR = 4
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-dns
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.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-11-04 00:00:00.000000000 Z
11
+ date: 2018-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -237,8 +237,8 @@ description: |-
237
237
  for monitoring, including: record resolution
238
238
  email: "<sensu-users@googlegroups.com>"
239
239
  executables:
240
- - check-dns.rb
241
240
  - metrics-dns.rb
241
+ - check-dns.rb
242
242
  extensions: []
243
243
  extra_rdoc_files: []
244
244
  files:
@@ -275,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
275
275
  version: '0'
276
276
  requirements: []
277
277
  rubyforge_project:
278
- rubygems_version: 2.7.1
278
+ rubygems_version: 2.7.6
279
279
  signing_key:
280
280
  specification_version: 4
281
281
  summary: Sensu plugins for dns