sensu-plugins-logs 1.1.0 → 1.1.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 +4 -4
- data/CHANGELOG.md +6 -1
- data/bin/check-log.rb +7 -13
- data/lib/sensu-plugins-logs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae62082cfd31a7aca730053b77c07251aad70314
|
4
|
+
data.tar.gz: c8f0ce0759a892b40570101af5e0702cace04d75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 339e1ab3150169f934ff312a98e6328e9b47f5babe5f40c5abe8ccf0d4479f67c5f837f87a3ca1c572eb7dbda5ff9213e432ba74a2e31c63b7237f672b0a8fe7
|
7
|
+
data.tar.gz: e8219a22ab005f16198e9864e8de50a81e50297461fd326258177551a857de944ea15c9ad8ba2c10c94d6a6d38d5f52a340f6fd6ded38f68dc4bda6ec136901c
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ 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]
|
7
|
+
## [1.1.1] - 2017-05-21
|
8
|
+
### Changed
|
9
|
+
- `check-log.rb`: Fix 'crit' and 'warn' flags being ignored in search_log (@avifried1)
|
10
|
+
|
7
11
|
## [1.1.0] - 2017-05-20
|
8
12
|
### Added
|
9
13
|
- Add `return-length` option to support custom length for returned matched lines
|
@@ -40,7 +44,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
40
44
|
### Added
|
41
45
|
- initial release
|
42
46
|
|
43
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.1.
|
47
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.1.1...HEAD
|
48
|
+
[1.1.1]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.1.0...1.1.1
|
44
49
|
[1.1.0]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.0.0...1.1.0
|
45
50
|
[0.0.4]:
|
46
51
|
[1.0.0]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/0.0.4...1.0.0
|
data/bin/check-log.rb
CHANGED
@@ -197,6 +197,7 @@ class CheckLog < Sensu::Plugin::Check::CLI
|
|
197
197
|
bytes_read = 0
|
198
198
|
n_warns = 0
|
199
199
|
n_crits = 0
|
200
|
+
n_matched = 0
|
200
201
|
accumulative_error = ''
|
201
202
|
|
202
203
|
@log.seek(@bytes_to_skip, File::SEEK_SET) if @bytes_to_skip > 0
|
@@ -215,21 +216,14 @@ class CheckLog < Sensu::Plugin::Check::CLI
|
|
215
216
|
end
|
216
217
|
if m
|
217
218
|
accumulative_error += "\n" + line.slice(0..config[:return_content_length])
|
218
|
-
|
219
|
-
if config[:crit] && m[1].to_i > config[:crit]
|
220
|
-
n_crits += 1
|
221
|
-
elsif config[:warn] && m[1].to_i > config[:warn]
|
222
|
-
n_warns += 1
|
223
|
-
end
|
224
|
-
else
|
225
|
-
if config[:only_warn] # rubocop:disable Style/IfInsideElse
|
226
|
-
n_warns += 1
|
227
|
-
else
|
228
|
-
n_crits += 1
|
229
|
-
end
|
230
|
-
end
|
219
|
+
n_matched += 1
|
231
220
|
end
|
232
221
|
end
|
222
|
+
if !config[:only_warn] && config[:crit] && n_matched >= config[:crit]
|
223
|
+
n_crits = n_matched
|
224
|
+
elsif config[:warn] && n_matched >= config[:warn]
|
225
|
+
n_warns = n_matched
|
226
|
+
end
|
233
227
|
FileUtils.mkdir_p(File.dirname(@state_file))
|
234
228
|
File.open(@state_file, 'w') do |file|
|
235
229
|
file.write(@bytes_to_skip + bytes_read)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-logs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
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-05-
|
11
|
+
date: 2017-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|