sensu-plugins-network-checks 0.0.1.alpha.5 → 0.0.1

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
  SHA1:
3
- metadata.gz: 082a59e8ccfa3a08a9c574b102aa9651923e831c
4
- data.tar.gz: e5c16cdc6b96bc9b7547b501d0bb2268ad2688b1
3
+ metadata.gz: 50406125ae72e5f45615dac795f6be112a94ad30
4
+ data.tar.gz: 9842a7811c2c0fa9dda4d8e5a20ddde30c907e75
5
5
  SHA512:
6
- metadata.gz: d039892d53acabcb4240558d605f10b34039b532ac072479a4ab35846a487c0281d319d6731e44afdc32ff1e31746f357723cd14078b6f6dcd6b0aada3f9ba00
7
- data.tar.gz: dd49bf6cb61b3b1ba37658173e92212dad215c24bc1f33486242119826b915be7759e117fb32de7695dfc72fa460ea9d8296b0a9fefcded0c5b1e7c3ac8b3b2f
6
+ metadata.gz: a8721853fe0c55fb87cbc24e0e7b28ae0579a0789212b11a925a74dfed15d3602e0d1e8e091abc6b89ad1601d1002429dbcce9854dbce9c6e5679e91eb1ba858
7
+ data.tar.gz: d94f19d93646f85209384b1f640707eb7e5ef1eae4d9e755fdcbba93ac01fc13c4184ba63a36fa242eb6becd14ac021e23462fc3e825c30bc038bf0ae8a9ecaa
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,20 +1,43 @@
1
- #### 0.0.1.alpha.1
1
+ #Change Log
2
+ This project adheres to [Semantic Versioning](http://semver.org/).
2
3
 
3
- * initial release, same as community repo
4
+ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
4
5
 
5
- #### 0.0.1.alpha.2
6
+ ## Unreleased][unreleased]
6
7
 
7
- * all tests pass
8
- * initial gem release
8
+ ## 0.0.1 - 2015-05-01
9
9
 
10
- #### 0.0.1.alpha.3
10
+ ### Added
11
+ - initial release
11
12
 
12
- * additional functionality to check-banner #6
13
+ #### 0.0.1.alpha.7
13
14
 
14
- #### 0.0.1.alpha.4
15
+ * add gem metadata
16
+ * add chef provisioner to Vagrantfile
17
+ * fix ruobcop issues
18
+ * pin all dependencies
15
19
 
16
- * added check-mtu functionality #7
20
+ #### 0.0.1.alpha.6
21
+
22
+ * added check-whois-domain-expiration #7
17
23
 
18
24
  #### 0.0.1.alpha.5
19
25
 
20
26
  * updated check-banner to allow checking for no banner
27
+
28
+ #### 0.0.1.alpha.4
29
+
30
+ * added check-mtu functionality #7
31
+
32
+ #### 0.0.1.alpha.3
33
+
34
+ * additional functionality to check-banner #6
35
+
36
+ #### 0.0.1.alpha.2
37
+
38
+ * all tests pass
39
+ * initial gem release
40
+
41
+ #### 0.0.1.alpha.1
42
+
43
+ * initial release, same as community repo
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015 devops@yieldbot.com
1
+ Copyright (c) 2015 Sensu-Plugins
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -4,20 +4,22 @@
4
4
  [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-network-checks/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-network-checks)
5
5
  [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-network-checks/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-network-checks)
6
6
  [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-network-checks.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-network-checks)
7
+ [![Codeship Status for sensu-plugins/sensu-plugins-network-checks](https://codeship.com/projects/d8090610-d234-0132-faa9-267aebe4cf02/status?branch=master)](https://codeship.com/projects/77474)
7
8
 
8
9
  ## Functionality
9
10
 
10
11
  ## Files
11
- * bin/check-banner
12
- * bin/check-multicast-groups
13
- * bin/check-netstat-tcp
14
- * bin/check-ping
15
- * bin/check-ports
16
- * bin/check-rbl
17
- * bin/metrics-interface
18
- * bin/metrics-net
19
- * bin/metrics-netif
20
- * bin/metrics-netstat-tcp
12
+ * bin/check-banner.rb
13
+ * bin/check-multicast-groups.rb
14
+ * bin/check-netstat-tcp.rb
15
+ * bin/check-ping.rb
16
+ * bin/check-ports.rb
17
+ * bin/check-rbl.rb
18
+ * bin/check-whois-domain-expiration.rb
19
+ * bin/metrics-interface.rb
20
+ * bin/metrics-net.rb
21
+ * bin/metrics-netif.rb
22
+ * bin/metrics-netstat-tcp.rb
21
23
 
22
24
  ## Usage
23
25
 
@@ -31,41 +33,7 @@
31
33
  ```
32
34
  ## Installation
33
35
 
34
- Add the public key (if you haven’t already) as a trusted certificate
36
+ [Installation and Setup](https://github.com/sensu-plugins/documentation/blob/master/user_docs/installation_instructions.md)
35
37
 
36
- ```
37
- gem cert --add <(curl -Ls https://raw.githubusercontent.com/sensu-plugins/sensu-plugins.github.io/master/certs/sensu-plugins.pem)
38
- gem install sensu-plugins-network-checks -P MediumSecurity
39
- ```
40
-
41
- You can also download the key from /certs/ within each repository.
42
-
43
- #### Rubygems
44
-
45
- `gem install sensu-plugins-network`
46
-
47
- #### Bundler
48
-
49
- Add *sensu-plugins-network* to your Gemfile and run `bundle install` or `bundle update`
50
-
51
- `gem install sensu-plugins-network-checks`
52
-
53
- #### Chef
54
-
55
- Using the Sensu **sensu_gem** LWRP
56
- ```
57
- sensu_gem 'sensu-plugins-network-checks' do
58
- options('--prerelease')
59
- version '0.0.1.alpha.2'
60
- end
61
- ```
62
-
63
- Using the Chef **gem_package** resource
64
- ```
65
- gem_package 'sensu-plugins-network-checks' do
66
- options('--prerelease')
67
- version '0.0.1.alpha.2'
68
- end
69
- ```
70
38
 
71
39
  ## Notes
@@ -35,7 +35,6 @@
35
35
  # Released under the same terms as Sensu (the MIT license); see LICENSE
36
36
  # for details.
37
37
 
38
- require 'rubygems' if RUBY_VERSION < '1.9.0'
39
38
  require 'sensu-plugin/check/cli'
40
39
  require 'socket'
41
40
  require 'timeout'
@@ -101,9 +100,9 @@ class CheckBanner < Sensu::Plugin::Check::CLI
101
100
  sock = TCPSocket.new(host, config[:port])
102
101
  sock.puts config[:write] if config[:write]
103
102
  if config[:read_till] == 'EOF'
104
- banner = sock.gets(nil)
103
+ sock.gets(nil)
105
104
  else
106
- banner = sock.gets(config[:read_till])
105
+ sock.gets(config[:read_till])
107
106
  end
108
107
  end
109
108
  rescue Errno::ECONNREFUSED
@@ -118,7 +117,7 @@ class CheckBanner < Sensu::Plugin::Check::CLI
118
117
 
119
118
  def acquire_no_banner(host)
120
119
  timeout(config[:timeout]) do
121
- sock = TCPSocket.new(host, config[:port])
120
+ TCPSocket.new(host, config[:port])
122
121
  end
123
122
  rescue Errno::ECONNREFUSED
124
123
  critical "Connection refused by #{host}:#{config[:port]}"
@@ -130,7 +129,7 @@ class CheckBanner < Sensu::Plugin::Check::CLI
130
129
  critical 'Connection closed unexpectedly'
131
130
  end
132
131
 
133
- def run
132
+ def run # rubocop:disable all
134
133
  hosts = config[:hosts].split(',')
135
134
  okarray = []
136
135
  hosts.each do |host|
@@ -142,10 +141,10 @@ class CheckBanner < Sensu::Plugin::Check::CLI
142
141
  banner = acquire_banner host
143
142
  okarray << 'ok' if banner =~ /#{config[:pattern]}/
144
143
  end
145
- if okarray.size == config[:count_match] and config[:pattern] != nil
144
+ if okarray.size == config[:count_match] && !config[:pattern].nil?
146
145
  ok "pattern #{config[:pattern]} matched" unless config[:ok_message]
147
146
  ok config[:ok_message]
148
- elsif okarray.size == config[:count_match] and config[:pattern].nil?
147
+ elsif okarray.size == config[:count_match] && config[:pattern].nil?
149
148
  ok "port #{config[:port]} open" unless config[:ok_message]
150
149
  ok config[:ok_message]
151
150
  else
@@ -35,7 +35,6 @@
35
35
  # for details.
36
36
  #
37
37
 
38
- require 'rubygems' if RUBY_VERSION < '1.9.0'
39
38
  require 'sensu-plugin/check/cli'
40
39
 
41
40
  #
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ #
4
+ # check-whois-domain-expiration
5
+ #
6
+ # DESCRIPTION:
7
+ # This plugin checks domain expiration dates using the 'whois' gem.
8
+ #
9
+ # OUTPUT:
10
+ # plain text
11
+ #
12
+ # PLATFORMS:
13
+ # Tested on Mac OS X
14
+ #
15
+ # DEPENDENCIES:
16
+ # gem: whois
17
+ #
18
+ # USAGE:
19
+ # $ ./check-whois-domain-expiration.rb -d mijit.com
20
+ # WhoisDomainExpirationCheck OK: mijit.com expires on 02-07-2016 (325 days away)
21
+ #
22
+ # LICENSE:
23
+ # Copyright 2015 michael j talarczyk <mjt@mijit.com> and contributors.
24
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
25
+ # for details.
26
+
27
+ require 'sensu-plugin/check/cli'
28
+ require 'whois'
29
+
30
+ #
31
+ # Check Whois domain expiration
32
+ #
33
+ class WhoisDomainExpirationCheck < Sensu::Plugin::Check::CLI
34
+ option :domain,
35
+ short: '-d DOMAIN',
36
+ long: '--domain DOMAIN',
37
+ required: true,
38
+ description: 'Domain to check'
39
+
40
+ option :warning,
41
+ short: '-w DAYS',
42
+ long: '--warn DAYS',
43
+ default: 30,
44
+ description: 'Warn if fewer than DAYS away'
45
+
46
+ option :critical,
47
+ short: '-c DAYS',
48
+ long: '--critical DAYS',
49
+ default: 7,
50
+ description: 'Critical if fewer than DAYS away'
51
+
52
+ option :help,
53
+ short: '-h',
54
+ long: '--help',
55
+ description: 'Show this message',
56
+ on: :tail,
57
+ boolean: true,
58
+ show_options: true,
59
+ exit: 0
60
+
61
+ def check_days(num_days,
62
+ warning_days = config[:warning].to_i,
63
+ critical_days = config[:critical].to_i)
64
+ case
65
+ when num_days <= critical_days
66
+ critical
67
+ when num_days <= warning_days
68
+ warning
69
+ else
70
+ ok
71
+ end
72
+ end
73
+
74
+ def initialize
75
+ super()
76
+ whois = Whois.whois(config[:domain])
77
+ @expires_on = DateTime.parse(whois.expires_on.to_s)
78
+ @num_days = (@expires_on - DateTime.now).to_i
79
+ end
80
+
81
+ def run
82
+ message "#{ config[:domain] } expires on #{ @expires_on.strftime('%m-%d-%Y') } (#{ @num_days } days away)"
83
+ check_days @num_days
84
+ end
85
+ end
@@ -101,7 +101,7 @@ class NetstatTCPMetrics < Sensu::Plugin::Metric::CLI::Graphite
101
101
  def run
102
102
  timestamp = Time.now.to_i
103
103
  netstat('tcp').each do |state, count|
104
- graphite_name = config[:port] ? "#{config[:scheme]}.#{config[:port]}.#{state}" :
104
+ graphite_name = config[:port] ? "#{config[:scheme]}.#{config[:port]}.#{state}" : # rubocop:disable all
105
105
  "#{config[:scheme]}.#{state}"
106
106
  output "#{graphite_name}", count, timestamp
107
107
  end
@@ -1,7 +1,14 @@
1
+ require 'sensu-plugins-network-checks/version'
2
+
3
+ # Load the defaults
4
+
1
5
  #
2
- # Set gem version
6
+ # Default class
3
7
  #
4
8
  module SensuPluginsNetworkChecks
5
- # Gem version
6
- VERSION = '0.0.1.alpha.5'
9
+ class << self
10
+ end
11
+
12
+ class << self
13
+ end
7
14
  end
@@ -0,0 +1,28 @@
1
+ require 'json'
2
+
3
+ # encoding: utf-8
4
+ module SensuPluginsNetworkChecks
5
+ # This defines the version of the gem
6
+ module Version
7
+ MAJOR = 0
8
+ MINOR = 0
9
+ PATCH = 1
10
+
11
+ VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
12
+
13
+ NAME = 'sensu-plugins-network-checks'
14
+ BANNER = "#{NAME} v%s"
15
+
16
+ module_function
17
+
18
+ def version
19
+ format(BANNER, VER_STRING)
20
+ end
21
+
22
+ def json_version
23
+ {
24
+ 'version' => VER_STRING
25
+ }.to_json
26
+ end
27
+ end
28
+ end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-network-checks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.alpha.5
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - Yieldbot, Inc. and contributors
7
+ - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
@@ -30,106 +30,106 @@ cert_chain:
30
30
  8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
31
  HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
32
  -----END CERTIFICATE-----
33
- date: 2015-03-25 00:00:00.000000000 Z
33
+ date: 2015-05-22 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: sensu-plugin
37
37
  requirement: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: '0'
41
+ version: 1.1.0
42
42
  type: :runtime
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ">="
46
+ - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: '0'
48
+ version: 1.1.0
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: dnsbl-client
51
51
  requirement: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ">="
53
+ - - '='
54
54
  - !ruby/object:Gem::Version
55
- version: '0'
55
+ version: 1.0.1
56
56
  type: :runtime
57
57
  prerelease: false
58
58
  version_requirements: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ">="
60
+ - - '='
61
61
  - !ruby/object:Gem::Version
62
- version: '0'
62
+ version: 1.0.1
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: timeout
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ">="
67
+ - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: '0'
69
+ version: 0.0.1
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ">="
74
+ - - '='
75
75
  - !ruby/object:Gem::Version
76
- version: '0'
76
+ version: 0.0.1
77
77
  - !ruby/object:Gem::Dependency
78
78
  name: json
79
79
  requirement: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ">="
81
+ - - '='
82
82
  - !ruby/object:Gem::Version
83
- version: '0'
83
+ version: 1.8.2
84
84
  type: :runtime
85
85
  prerelease: false
86
86
  version_requirements: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ">="
88
+ - - '='
89
89
  - !ruby/object:Gem::Version
90
- version: '0'
90
+ version: 1.8.2
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: net
93
93
  requirement: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ">="
95
+ - - '='
96
96
  - !ruby/object:Gem::Version
97
- version: '0'
97
+ version: 0.2.1
98
98
  type: :runtime
99
99
  prerelease: false
100
100
  version_requirements: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - ">="
102
+ - - '='
103
103
  - !ruby/object:Gem::Version
104
- version: '0'
104
+ version: 0.2.1
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: codeclimate-test-reporter
107
107
  requirement: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ">="
109
+ - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: '0'
111
+ version: '0.4'
112
112
  type: :development
113
113
  prerelease: false
114
114
  version_requirements: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - ">="
116
+ - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: '0'
118
+ version: '0.4'
119
119
  - !ruby/object:Gem::Dependency
120
120
  name: rubocop
121
121
  requirement: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - '='
123
+ - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: 0.17.0
125
+ version: '0.30'
126
126
  type: :development
127
127
  prerelease: false
128
128
  version_requirements: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - '='
130
+ - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: 0.17.0
132
+ version: '0.30'
133
133
  - !ruby/object:Gem::Dependency
134
134
  name: rspec
135
135
  requirement: !ruby/object:Gem::Requirement
@@ -228,21 +228,9 @@ dependencies:
228
228
  - - "~>"
229
229
  - !ruby/object:Gem::Version
230
230
  version: '0.10'
231
- description: ''
231
+ description: Sensu plugins for checking network hardware, connections, and data
232
232
  email: "<sensu-users@googlegroups.com>"
233
- executables:
234
- - check-banner.rb
235
- - check-mtu.rb
236
- - check-multicast-groups.rb
237
- - check-netstat-tcp.rb
238
- - check-ping.rb
239
- - check-ports.rb
240
- - check-rbl.rb
241
- - metrics-interface.rb
242
- - metrics-net.rb
243
- - metrics-netif.rb
244
- - metrics-netstat-tcp.rb
245
- - metrics-sockstat.rb
233
+ executables: []
246
234
  extensions: []
247
235
  extra_rdoc_files: []
248
236
  files:
@@ -256,17 +244,25 @@ files:
256
244
  - bin/check-ping.rb
257
245
  - bin/check-ports.rb
258
246
  - bin/check-rbl.rb
247
+ - bin/check-whois-domain-expiration.rb
259
248
  - bin/metrics-interface.rb
260
249
  - bin/metrics-net.rb
261
250
  - bin/metrics-netif.rb
262
251
  - bin/metrics-netstat-tcp.rb
263
252
  - bin/metrics-sockstat.rb
264
253
  - lib/sensu-plugins-network-checks.rb
254
+ - lib/sensu-plugins-network-checks/version.rb
265
255
  homepage: https://github.com/sensu-plugins/sensu-plugins-network-checks
266
256
  licenses:
267
257
  - MIT
268
- metadata: {}
269
- post_install_message:
258
+ metadata:
259
+ maintainer: "@rmc3"
260
+ development_status: active
261
+ production_status: unstable - testing recommended
262
+ release_draft: 'false'
263
+ release_prerelease: 'false'
264
+ post_install_message: You can use the embedded Ruby by setting EMBEDDED_RUBY=true
265
+ in /etc/default/sensu
270
266
  rdoc_options: []
271
267
  require_paths:
272
268
  - lib
@@ -277,14 +273,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
277
273
  version: 1.9.3
278
274
  required_rubygems_version: !ruby/object:Gem::Requirement
279
275
  requirements:
280
- - - ">"
276
+ - - ">="
281
277
  - !ruby/object:Gem::Version
282
- version: 1.3.1
278
+ version: '0'
283
279
  requirements: []
284
280
  rubyforge_project:
285
- rubygems_version: 2.2.2
281
+ rubygems_version: 2.4.6
286
282
  signing_key:
287
283
  specification_version: 4
288
- summary: ''
284
+ summary: Sensu plugins for checking network hardware, connections, and data
289
285
  test_files: []
290
- has_rdoc:
metadata.gz.sig CHANGED
Binary file