sensu-plugins-dns 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +5 -1
- data/bin/check-dns.rb +30 -16
- data/lib/sensu-plugins-dns/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +16 -2
- 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: 430dc3ea38b7b3450e2bcebebfc4e5b3c557d465
|
4
|
+
data.tar.gz: 96ce94335d5d153dd4a2a193a8d94b34bb1bbdbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d367eebc55c005193950dfdd129f7243685a9fd7ba18ec4bec7bff4b69189141f8cfdf808acf16460ba3572b074cb9eacf0425ec3a41e027a96a6c7c796cbbb3
|
7
|
+
data.tar.gz: 5ea3a911ae92b0a05acaed16568e985baba94da30e9cbcc9e52a328d2b8dc0873eb4660275d07cefc3e834fc7205fe9f708e9949d7542ab2893f7abb8e3198f0
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
4
4
|
This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
|
5
5
|
|
6
6
|
## [Unreleased][unreleased]
|
7
|
-
|
7
|
+
* nothing
|
8
|
+
|
9
|
+
## [0.0.6] - 2015-09-28
|
10
|
+
### Changed
|
11
|
+
- Migrated from ruby library resolv to dnsruby to support more dns related checks
|
8
12
|
|
9
13
|
## [0.0.5] - 2015-08-05
|
10
14
|
### Removed
|
data/bin/check-dns.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# check-dns
|
4
4
|
#
|
5
5
|
# DESCRIPTION:
|
6
|
-
# This plugin checks DNS resolution using
|
6
|
+
# This plugin checks DNS resolution using dnsruby .
|
7
7
|
# Note: if testing reverse DNS with -t PTR option,
|
8
8
|
# results will not end with trailing '.' (dot)
|
9
9
|
#
|
@@ -15,6 +15,7 @@
|
|
15
15
|
#
|
16
16
|
# DEPENDENCIES:
|
17
17
|
# gem: sensu-plugin
|
18
|
+
# gem: dnsruby
|
18
19
|
#
|
19
20
|
# USAGE:
|
20
21
|
# example commands
|
@@ -29,8 +30,7 @@
|
|
29
30
|
#
|
30
31
|
|
31
32
|
require 'sensu-plugin/check/cli'
|
32
|
-
require '
|
33
|
-
|
33
|
+
require 'dnsruby'
|
34
34
|
#
|
35
35
|
# DNS
|
36
36
|
#
|
@@ -68,12 +68,10 @@ class DNS < Sensu::Plugin::Check::CLI
|
|
68
68
|
boolean: true
|
69
69
|
|
70
70
|
def resolve_domain
|
71
|
-
resolv = config[:server].nil? ?
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
entries = resolv.getaddresses(config[:domain]).map(&:to_s)
|
76
|
-
end
|
71
|
+
resolv = config[:server].nil? ? Dnsruby::Resolver.new : Dnsruby::Resolver.new(nameserver: [config[:server]])
|
72
|
+
|
73
|
+
entries = resolv.query(config[:domain], config[:type])
|
74
|
+
|
77
75
|
puts "Entries: #{entries}" if config[:debug]
|
78
76
|
|
79
77
|
entries
|
@@ -82,18 +80,34 @@ class DNS < Sensu::Plugin::Check::CLI
|
|
82
80
|
def run
|
83
81
|
unknown 'No domain specified' if config[:domain].nil?
|
84
82
|
|
85
|
-
|
86
|
-
|
87
|
-
|
83
|
+
begin
|
84
|
+
entries = resolve_domain
|
85
|
+
rescue Dnsruby::NXDomain
|
86
|
+
output = "Could not resolve #{config[:domain]} #{config[:type]} record"
|
87
|
+
critical(output)
|
88
|
+
return
|
89
|
+
rescue => e
|
90
|
+
output = "Couldn not resolve #{config[:domain]}: #{e}"
|
91
|
+
config[:warn_only] ? warning(output) : critical(output)
|
92
|
+
return
|
93
|
+
end
|
94
|
+
puts entries.answer if config[:debug]
|
95
|
+
if entries.answer.length.zero?
|
96
|
+
output = "Could not resolve #{config[:domain]} #{config[:type]} record"
|
88
97
|
config[:warn_only] ? warning(output) : critical(output)
|
89
98
|
elsif config[:result]
|
90
|
-
if entries.
|
91
|
-
|
99
|
+
if entries.answer.count > 1
|
100
|
+
b = entries.answer.rrsets("#{config[:type]}").to_s
|
101
|
+
else
|
102
|
+
b = entries.answer.first.to_s
|
103
|
+
end
|
104
|
+
if b.include?(config[:result])
|
105
|
+
ok "Resolved #{config[:domain]} #{config[:type]} included #{config[:result]}"
|
92
106
|
else
|
93
|
-
critical "Resolved #{config[:domain]} did not include #{config[:result]}"
|
107
|
+
critical "Resolved #{config[:domain]} #{config[:type]} did not include #{config[:result]}"
|
94
108
|
end
|
95
109
|
else
|
96
|
-
ok "Resolved #{config[:domain]} #{config[:type]}
|
110
|
+
ok "Resolved #{config[:domain]} #{config[:type]}"
|
97
111
|
end
|
98
112
|
end
|
99
113
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-dns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
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-
|
33
|
+
date: 2015-10-01 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: sensu-plugin
|
@@ -46,6 +46,20 @@ dependencies:
|
|
46
46
|
- - '='
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: 1.2.0
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: dnsruby
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 1.58.0
|
56
|
+
type: :runtime
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 1.58.0
|
49
63
|
- !ruby/object:Gem::Dependency
|
50
64
|
name: bundler
|
51
65
|
requirement: !ruby/object:Gem::Requirement
|
metadata.gz.sig
CHANGED
Binary file
|