sensu-plugins-filesystem-checks 0.0.2 → 0.0.3

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: f7168b58ccd58dbf5cd1a0264549267ed96967e7
4
- data.tar.gz: aba986613eb5de4e4ec15ba2110588b0dd38c577
3
+ metadata.gz: b8b2d4536660ff48b5bfee4924bd9667e7b20618
4
+ data.tar.gz: 89370d418c72978f110fbf7744385c49b62c79dc
5
5
  SHA512:
6
- metadata.gz: fc11ac18af3bd129d3fd45a89917d68e4c97f82ab2d683c00717893f5983f1e6e181900243f8bbec263aeaf50e9f38341dd4c838efbe9bb9e38664e5e714183e
7
- data.tar.gz: de38189b7e043a625ee6f297e1118efa6fb1559f7e3039f2cf962ec374ea699e704d6c6172a629227e11962fb3917836d61f66a128f57462821d392360317c0e
6
+ metadata.gz: 545c0abd600e0d0eea6635d185a45e0c472159e32ccb6d2bb0229f39fd3e5110bdf8190760495ebd5b6962570138cbd44c56f6e4ca7193f7ba1e01f34ddd6f7d
7
+ data.tar.gz: ed5d910ef7976af8bd6b43f41469865cf7a0b6bd368171c56055caa0ecf98a4e4e449808569e211504b5e0ef06c148b05d577630d0ba52db75515401de4d3bc9
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -5,18 +5,25 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## Unreleased][unreleased]
7
7
 
8
- ### Added
9
- - initial release
10
-
11
- ## 0.0.1 - 2015-04-30
8
+ ## [0.0.3] - 2015-07-14
9
+ ### Changed
10
+ - updated sensu-plugin gem to 1.2.0
12
11
 
13
12
  ### Added
14
- - initial release
13
+ - can now use multi volgroups with autodiscovery
15
14
 
16
- ## [0.0.2] - 2015-06-02
15
+ ## [0.0.3] - [2015-07-07]
16
+ ### Added
17
+ - the ability to feed a file containing a hash into check-checksums.rb
17
18
 
19
+ ## [0.0.2] - [2015-06-02]
18
20
  ### Fixed
19
21
  - added binstubs
20
22
 
21
23
  ### Changed
22
- - removed cruft from /lib
24
+ - removed cruft from /lib
25
+
26
+ ## 0.0.1 - [2015-04-30]
27
+ ### Added
28
+ - initial release
29
+
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Sensu-Plugins-filesystem-checks
2
2
 
3
- [![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-filesystem-checks.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-filesystem-checks)
3
+ [ ![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-filesystem-checks.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-filesystem-checks)
4
4
  [![Gem Version](https://badge.fury.io/rb/sensu-plugins-filesystem-checks.svg)](http://badge.fury.io/rb/sensu-plugins-filesystem-checks)
5
5
  [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-filesystem-checks/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-filesystem-checks)
6
6
  [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-filesystem-checks/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-filesystem-checks)
@@ -40,6 +40,12 @@ class Checksum < Sensu::Plugin::Check::CLI
40
40
  short: '-h SHA2HASH',
41
41
  long: '--hash SHA2HASH'
42
42
 
43
+ option :hashfile,
44
+ description: 'The file containing the hash these files must hash as.',
45
+ # i.e. sha256sum filename | awk '{print $1}' > filename.sha256sum
46
+ short: '-H SHA2HASHFILE',
47
+ long: '--hashfile SHA2HASHFILE'
48
+
43
49
  option :warn_only,
44
50
  description: "Warn instead of critical if they don't match",
45
51
  short: '-w',
@@ -49,17 +55,21 @@ class Checksum < Sensu::Plugin::Check::CLI
49
55
  def run
50
56
  files = config[:files].split(',')
51
57
 
52
- if files.length == 1 && !config[:hash]
58
+ if files.length == 1 && !config[:hash] && !config[:hashfile]
53
59
  unknown 'We have nothing to compare this file with.'
54
60
  end
55
61
 
56
- hash = config[:hash] || Digest::SHA2.file(files.first).hexdigest
62
+ if config[:hashfile]
63
+ hash = IO.read(config[:hashfile]).chomp
64
+ else
65
+ hash = config[:hash] || Digest::SHA2.file(files.first).hexdigest
66
+ end
57
67
 
58
68
  errors = []
59
69
 
60
70
  files.each do |file|
61
71
  if File.exist?(file)
62
- file_hash = Digest::SHA2.file(file).hexdigest
72
+ file_hash = Digest::SHA2.file(file).hexdigest.chomp
63
73
  errors << "#{file} does not match" if file_hash != hash
64
74
  else
65
75
  errors << "#{file} does not exist"
@@ -66,10 +66,23 @@ class CheckFSWritable < Sensu::Plugin::Check::CLI
66
66
  end
67
67
  end
68
68
 
69
+ # Get the volgroups
70
+ #
71
+ def acquire_vol_groups
72
+ `vgdisplay|grep 'VG Name'|awk '{print $3}'`
73
+ end
74
+
69
75
  # Get the mount points from the self namespace
70
76
  #
71
77
  def acquire_mnt_pts
72
- `grep VolGroup /proc/self/mounts | awk '{print $2, $4}' | awk -F, '{print $1}' | awk '{print $1, $2}'`
78
+ mnt_pts = []
79
+ vol_groups = acquire_vol_groups.split("\n")
80
+ vol_groups.each do |vol_group|
81
+ `grep #{vol_group} /proc/self/mounts | awk '{print $2, $4}' | awk -F, '{print $1}' | awk '{print $1, $2}'`.split("\n").each do |mnt|
82
+ mnt_pts << mnt
83
+ end
84
+ end
85
+ mnt_pts
73
86
  end
74
87
 
75
88
  # Does proc list the mount point as rw
@@ -102,9 +115,7 @@ class CheckFSWritable < Sensu::Plugin::Check::CLI
102
115
  # namespace in proc
103
116
  #
104
117
  def auto_discover
105
- # #YELLOW
106
- # this will only work for a single namespace as of now
107
- mount_info = acquire_mnt_pts.split("\n")
118
+ mount_info = acquire_mnt_pts
108
119
  warning 'No mount points found' if mount_info.length == 0
109
120
  # #YELLOW
110
121
  # I want to map this at some point to make it pretty and eaiser to read for large filesystems
@@ -113,6 +124,7 @@ class CheckFSWritable < Sensu::Plugin::Check::CLI
113
124
  rw_test?(mount_info)
114
125
  puts "The critical mount points according to proc are: #{ @crit_pt_proc }" if config[:debug]
115
126
  puts "The critical mount points according to actual testing are: #{ @crit_pt_test }" if config[:debug]
127
+ true
116
128
  end
117
129
 
118
130
  # Create a tempfile as each mount point and attempt to write a line to it
@@ -2,7 +2,7 @@ module SensuPluginsFilesystemChecks
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 2
5
+ PATCH = 3
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-filesystem-checks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
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-06-03 00:00:00.000000000 Z
33
+ date: 2015-07-14 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: sensu-plugin
@@ -38,14 +38,14 @@ dependencies:
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 1.1.0
41
+ version: 1.2.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: 1.1.0
48
+ version: 1.2.0
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: codeclimate-test-reporter
51
51
  requirement: !ruby/object:Gem::Requirement
@@ -64,14 +64,14 @@ dependencies:
64
64
  name: rubocop
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - '='
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0.30'
70
70
  type: :development
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - "~>"
74
+ - - '='
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0.30'
77
77
  - !ruby/object:Gem::Dependency
metadata.gz.sig CHANGED
Binary file