sensu-plugins-nrpe 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/bin/check-nrpe.rb +13 -27
- data/bin/metrics-nrpe.rb +3 -1
- data/lib/sensu-plugins-nrpe/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: 3e47916432d40967d18de41b63599144b938009e
|
4
|
+
data.tar.gz: 2694ffff657bea897da2ddd51a16d3b6540b2a1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c99b8d6f177b466493d985bd05863678a3cd0301ba6fa5dc132ef363df16ee96095a3c7af33b4a8989b5b33204561b1e638ae9ce0ed32e31ed062dbfbf2effe
|
7
|
+
data.tar.gz: bd2a1df7e32a63ae356be8a6b95831b0259e29c5c2cacd820af9b3673aff299e74ee9bae4107943c422918851208d0a6ee8085fee8ce71778a6776a97c4ba500
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,15 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
5
5
|
|
6
6
|
## Unreleased
|
7
7
|
|
8
|
+
## [0.0.2] - 2016-08-11
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
- simplify check-nrpe.rb output due to variances in different nagios plugin check results
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
- move regex comment from code to header in check-nrpe.rb and metrics-nrpe.rb
|
15
|
+
- drop obsolete comparison option
|
16
|
+
|
8
17
|
## 0.0.1 - 2016-08-03
|
9
18
|
|
10
19
|
### Added
|
data/bin/check-nrpe.rb
CHANGED
@@ -13,6 +13,9 @@
|
|
13
13
|
# check-nrpe -H host -c check_plugin -a 'plugin args'
|
14
14
|
# check-nrpe -H host -c check_plugin -a 'plugin args' -m "(P|p)attern to match\.?"
|
15
15
|
#
|
16
|
+
# NOTES:
|
17
|
+
# regex from https://github.com/naparuba/shinken/blob/master/shinken/misc/perfdata.py
|
18
|
+
#
|
16
19
|
# LICENSE:
|
17
20
|
# Copyright (c) 2016 Scott Saunders <scosist@gmail.com>
|
18
21
|
# Based on check-snmp.rb by Deepak Mohan Das <deepakmdass88@gmail.com>
|
@@ -55,11 +58,6 @@ class CheckNRPE < Sensu::Plugin::Check::CLI
|
|
55
58
|
short: '-m match',
|
56
59
|
description: 'Regex pattern to match against returned buffer'
|
57
60
|
|
58
|
-
option :comparison,
|
59
|
-
short: '-o comparison operator',
|
60
|
-
description: 'Operator used to compare data with warning/critial values. Can be set to "le" (<=), "ge" (>=).',
|
61
|
-
default: 'ge'
|
62
|
-
|
63
61
|
def run
|
64
62
|
begin
|
65
63
|
request = Nrpeclient::CheckNrpe.new({:host=> "#{config[:host]}", :port=> "#{config[:port]}", :ssl=> config[:ssl]})
|
@@ -69,11 +67,6 @@ class CheckNRPE < Sensu::Plugin::Check::CLI
|
|
69
67
|
rescue => e
|
70
68
|
unknown "An unknown error occured: #{e.inspect}"
|
71
69
|
end
|
72
|
-
operators = { 'le' => :<=, 'ge' => :>= }
|
73
|
-
symbol = operators[config[:comparison]]
|
74
|
-
criticals = []
|
75
|
-
warnings = []
|
76
|
-
okays = []
|
77
70
|
|
78
71
|
if config[:match]
|
79
72
|
if response.buffer.to_s =~ /#{config[:match]}/
|
@@ -82,24 +75,17 @@ class CheckNRPE < Sensu::Plugin::Check::CLI
|
|
82
75
|
critical "Buffer: #{response.buffer} failed to match Pattern: #{config[:match]}"
|
83
76
|
end
|
84
77
|
else
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
end
|
96
|
-
unless criticals.empty?
|
97
|
-
critical criticals.join(' ')
|
98
|
-
end
|
99
|
-
unless warnings.empty?
|
100
|
-
warning warnings.join(' ')
|
78
|
+
response_captures = response.buffer.scan(/[A-Z ]*?([A-Z]+)\s?[:-]{1}\s(.*)/)
|
79
|
+
response_status = response_captures[0][0].downcase
|
80
|
+
response_data = response_captures[0][1]
|
81
|
+
case response_status
|
82
|
+
when "critical"
|
83
|
+
critical response_data
|
84
|
+
when "warning"
|
85
|
+
warning response_data
|
86
|
+
else
|
87
|
+
ok response_data
|
101
88
|
end
|
102
|
-
ok okays.join(' ')
|
103
89
|
end
|
104
90
|
end
|
105
91
|
end
|
data/bin/metrics-nrpe.rb
CHANGED
@@ -11,6 +11,9 @@
|
|
11
11
|
# USAGE:
|
12
12
|
# check-nrpe -H host -c check_plugin -a 'plugin args' -p prefix -s suffix
|
13
13
|
#
|
14
|
+
# NOTES:
|
15
|
+
# regex from https://github.com/naparuba/shinken/blob/master/shinken/misc/perfdata.py
|
16
|
+
#
|
14
17
|
# LICENSE:
|
15
18
|
# Copyright (c) 2016 Scott Saunders <scosist@gmail.com>
|
16
19
|
# Based on metrics-snmp.rb by Double Negative Limited
|
@@ -74,7 +77,6 @@ class NRPEGraphite < Sensu::Plugin::Metric::CLI::Graphite
|
|
74
77
|
end
|
75
78
|
config[:host] = config[:host].gsub('.', '_') if config[:graphite]
|
76
79
|
perfdata = response.buffer.split('|')[1].scan(/([^=]+=\S+)/)
|
77
|
-
# regex from https://github.com/naparuba/shinken/blob/master/shinken/misc/perfdata.py
|
78
80
|
perfdata.each do |pd|
|
79
81
|
metric = /^([^=]+)=([\d\.\-\+eE]+)([\w\/%]*);?([\d\.\-\+eE:~@]+)?;?([\d\.\-\+eE:~@]+)?;?([\d\.\-\+eE]+)?;?([\d\.\-\+eE]+)?;?\s*/.match(pd[0]) # rubocop:disable LineLength
|
80
82
|
if config[:prefix]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-nrpe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
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: 2016-08-
|
11
|
+
date: 2016-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|