sensu-plugins-reboot-required 0.1.2 → 0.2.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
  SHA1:
3
- metadata.gz: 50c51e4da77d2731886b78217ff69eac08619ee7
4
- data.tar.gz: 72239013716fd7c64abaa2061b8225d3795eeff5
3
+ metadata.gz: 17f1cf299f42d89f69c3edc6a19306ee3f30ea29
4
+ data.tar.gz: ce576f1f93465e331e120be7df1006e4d1794a00
5
5
  SHA512:
6
- metadata.gz: 3bf06a3fd8031f011f192e1d978bb254f067f7e781096d44acf3f1f015a4484971813f185def6cd00d6e97f1914f7f08c0ab91382910585f50f9568788e4f7cc
7
- data.tar.gz: bd06638f45fec540edd6cad9e954e69681665465137357de2165cb26061b479fd8f97def83721d1505c12ebda0b54aff57119d466c758e32ba7fe6960faa9642
6
+ metadata.gz: 155a6e2d948b93f47fa665926171277a35e9ae3d61ae0e82c6daab3628ebfa29b3668f5744ada2e8edd3bf53050455440ab1130985fc7e52d242a8af066a19c7
7
+ data.tar.gz: 44337caea6abcb9528106fe60db68638c91f7197578eece943208a6efc2e62ec8738c4a8dcfbfefd9af1ca43bee224cc23669203fb1d063a319eadf04c42c80e
data/README.md CHANGED
@@ -3,8 +3,8 @@
3
3
  ## Functionality
4
4
 
5
5
  ## Files
6
- * bin/check-reboot-required.rb
7
-
6
+ * bin/check-reboot-required-debian.rb
7
+ * bin/check-reboot-required-redhat.rb
8
8
 
9
9
  ## Usage
10
10
 
@@ -1,5 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
2
  # encoding: UTF-8
3
+
3
4
  #
4
5
  # check-reboot-required
5
6
  #
@@ -0,0 +1,53 @@
1
+ #! /usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ # check-reboot-required
5
+ #
6
+ # DESCRIPTION:
7
+ # Check if a reboot was required by a package upgrade on a RedHat-based OS.
8
+ #
9
+ # OUTPUT:
10
+ # plain text
11
+ #
12
+ # PLATFORMS:
13
+ # Linux
14
+ #
15
+ # DEPENDENCIES:
16
+ # gem: sensu-plugin
17
+ #
18
+ # USAGE:
19
+ #
20
+ # NOTES:
21
+ #
22
+
23
+ require 'sensu-plugin/check/cli'
24
+ require 'open3'
25
+
26
+ class CheckRebootRequired < Sensu::Plugin::Check::CLI
27
+ option :ignore_packages,
28
+ short: '-i',
29
+ long: '--ignore-packages pkg1[,pkg2,...,pkgN]',
30
+ description: 'Packages requesting reboot to ignore',
31
+ default: ''
32
+
33
+ def package_ignored?(pkg)
34
+ @ignored_package_patterns ||= config[:ignore_packages].split(',')
35
+ @ignored_package_patterns.any? { |pattern| File.fnmatch(pattern, pkg) }
36
+ end
37
+
38
+ def run
39
+ stdout, status = Open3.capture2('needs-restarting --reboothint')
40
+ ok if status.success?
41
+
42
+ packages = stdout.lines
43
+ .drop(1)
44
+ .take_while { |line| !line.chomp.empty? }
45
+ .map { |pkg_desc| pkg_desc.split(' -> ').first.strip }
46
+ .sort
47
+ .uniq
48
+ .reject(&method(:package_ignored?))
49
+
50
+ ok if packages.empty?
51
+ warning("reboot required by packages: #{packages.join(', ')}")
52
+ end
53
+ end
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsRebootRequired
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 1
5
- PATCH = 2
4
+ MINOR = 2
5
+ PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-reboot-required
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.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-16 00:00:00.000000000 Z
11
+ date: 2018-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -128,39 +128,41 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 0.40.0
131
+ version: 0.49.0
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 0.40.0
138
+ version: 0.49.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: yard
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0.8'
145
+ version: 0.9.0
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '0.8'
152
+ version: 0.9.0
153
153
  description: This plugin provides monitoring for VMware integrated OpenStack.
154
154
  email: "<sensu-users@googlegroups.com>"
155
155
  executables:
156
- - check-reboot-required.rb
156
+ - check-reboot-required-debian.rb
157
+ - check-reboot-required-redhat.rb
157
158
  extensions: []
158
159
  extra_rdoc_files: []
159
160
  files:
160
161
  - CHANGELOG.md
161
162
  - LICENSE
162
163
  - README.md
163
- - bin/check-reboot-required.rb
164
+ - bin/check-reboot-required-debian.rb
165
+ - bin/check-reboot-required-redhat.rb
164
166
  - lib/sensu-plugins-reboot-required.rb
165
167
  - lib/sensu-plugins-reboot-required/version.rb
166
168
  homepage: https://github.com/jovrum/sensu-plugins-reboot-required