sensu-plugins-dnslookup 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +10 -0
- data/LICENSE +23 -0
- data/README.md +19 -0
- data/bin/check-dnslookup.rb +83 -0
- data/lib/sensu-plugins-dnslookup.rb +1 -0
- data/lib/sensu-plugins-dnslookup/version.rb +9 -0
- metadata +70 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 53d486fb901ed98101afd3bbb413d2771304d349
|
4
|
+
data.tar.gz: 5dda249c3baeb2300bc87b04ec5df5b85c55517c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1b6a9055e54b8dc171056b10f07fa215f110bfdb28bc6ce8981a20787ad88776dd887d64029347c7ba42c820870852869a19cb49ee9ad0940a97b24b95dd48c6
|
7
|
+
data.tar.gz: cd1193649eb2f5ce7e68beaca80a8e0e4264509bd49618d834856b0fb9352c2383987675db83716e182220aac973b6c473762e82d0b34b09ba862c567d0d0dde
|
data/CHANGELOG.md
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Copyright (c) 2015 Matteo Cerutti
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
data/README.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Sensu plugin for monitoring DNS resolution
|
2
|
+
|
3
|
+
A sensu plugin to monitor DNS resolution.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
The plugin accepts the following command line options:
|
8
|
+
|
9
|
+
```
|
10
|
+
Usage: check-dnslookup.rb (options)
|
11
|
+
-d, --domain <DOMAIN> Domain to look up (required)
|
12
|
+
-s, --server <SERVER> Comma separated list of name server(s) for resolution
|
13
|
+
--timeout <SECONDS> DNS lookup timeout (default: 3)
|
14
|
+
-t, --type <TYPE> Record type (default: A)
|
15
|
+
-w, --warn Warn instead of throwing a critical failure
|
16
|
+
```
|
17
|
+
|
18
|
+
## Author
|
19
|
+
Matteo Cerutti - <matteo.cerutti@hotmail.co.uk>
|
@@ -0,0 +1,83 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# check-dnslookup.rb
|
4
|
+
#
|
5
|
+
# Author: Matteo Cerutti <matteo.cerutti@hotmail.co.uk>
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'sensu-plugin/check/cli'
|
9
|
+
require 'resolv'
|
10
|
+
|
11
|
+
class CheckDnsLookUp < Sensu::Plugin::Check::CLI
|
12
|
+
@@types = ["A", "PTR", "SRV", "CNAME", "SOA", "MX", "NS", "TXT"]
|
13
|
+
|
14
|
+
option :domain,
|
15
|
+
:description => "Domain to look up",
|
16
|
+
:short => "-d <DOMAIN>",
|
17
|
+
:long => "--domain <DOMAIN>",
|
18
|
+
:required => true
|
19
|
+
|
20
|
+
option :type,
|
21
|
+
:description => "Record type (default: A)",
|
22
|
+
:short => "-t <TYPE>",
|
23
|
+
:long => "--type <TYPE>",
|
24
|
+
:in => @@types,
|
25
|
+
:proc => proc(&:upcase),
|
26
|
+
:default => "A"
|
27
|
+
|
28
|
+
option :server,
|
29
|
+
:description => "Comma separated list of name server(s) for resolution",
|
30
|
+
:short => "-s <SERVER>",
|
31
|
+
:long => "--server <SERVER>",
|
32
|
+
:proc => proc { |s| s.split(',') },
|
33
|
+
:default => []
|
34
|
+
|
35
|
+
option :timeout,
|
36
|
+
:description => "DNS lookup timeout (default: 3)",
|
37
|
+
:short => "-t <SECONDS>",
|
38
|
+
:long => "--timeout <SECONDS>",
|
39
|
+
:proc => proc(&:to_i),
|
40
|
+
:default => 3
|
41
|
+
|
42
|
+
option :warn,
|
43
|
+
:description => "Warn instead of throwing a critical failure",
|
44
|
+
:short => "-w",
|
45
|
+
:long => "--warn",
|
46
|
+
:boolean => true,
|
47
|
+
:default => false
|
48
|
+
|
49
|
+
def initialize()
|
50
|
+
super
|
51
|
+
end
|
52
|
+
|
53
|
+
def run()
|
54
|
+
query_type = Kernel.const_get("Resolv::DNS::Resource::IN::#{config[:type]}")
|
55
|
+
|
56
|
+
if config[:server].size > 0
|
57
|
+
dnsconf = {
|
58
|
+
:nameserver => config[:server],
|
59
|
+
:search => '',
|
60
|
+
:ndots => 1,
|
61
|
+
}
|
62
|
+
else
|
63
|
+
dnsconf = nil
|
64
|
+
end
|
65
|
+
|
66
|
+
dns = Resolv::DNS.new(dnsconf)
|
67
|
+
dns.timeouts = 3
|
68
|
+
|
69
|
+
begin
|
70
|
+
resp = dns.getresource(config[:domain], query_type).inspect
|
71
|
+
ok("Resolved #{config[:type]} record #{config[:domain]}")
|
72
|
+
dns.close
|
73
|
+
rescue
|
74
|
+
dns.close
|
75
|
+
message("Failed to look up #{config[:type]} record #{config[:domain]} (#{$!})")
|
76
|
+
if config[:warn]
|
77
|
+
warning
|
78
|
+
else
|
79
|
+
critical
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'sensu-plugins-dnslookup/version'
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sensu-plugins-dnslookup
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matteo Cerutti
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sensu-plugin
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.2.0
|
27
|
+
description: This plugin provides facilities for monitoring DNS resolution
|
28
|
+
email: "<matteo.cerutti@hotmail.co.uk>"
|
29
|
+
executables:
|
30
|
+
- check-dnslookup.rb
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- CHANGELOG.md
|
35
|
+
- LICENSE
|
36
|
+
- README.md
|
37
|
+
- bin/check-dnslookup.rb
|
38
|
+
- lib/sensu-plugins-dnslookup.rb
|
39
|
+
- lib/sensu-plugins-dnslookup/version.rb
|
40
|
+
homepage: https://github.com/m4ce/sensu-plugins-dnslookup
|
41
|
+
licenses:
|
42
|
+
- MIT
|
43
|
+
metadata:
|
44
|
+
maintainer: "@m4ce"
|
45
|
+
development_status: active
|
46
|
+
production_status: stable
|
47
|
+
release_draft: 'false'
|
48
|
+
release_prerelease: 'false'
|
49
|
+
post_install_message: You can use the embedded Ruby by setting EMBEDDED_RUBY=true
|
50
|
+
in /etc/default/sensu
|
51
|
+
rdoc_options: []
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: 1.9.3
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
requirements: []
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 2.4.5.1
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: Sensu plugins for monitoring whether DNS resolution is working or not
|
70
|
+
test_files: []
|