riemann-tools 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +22 -0
- data/Rakefile +9 -2
- data/bin/riemann-md +8 -0
- data/bin/riemann-wrapper +40 -2
- data/bin/riemann-zpool +8 -0
- data/lib/riemann/tools/md.rb +35 -0
- data/lib/riemann/tools/mdstat_parser.tab.rb +340 -0
- data/lib/riemann/tools/version.rb +1 -1
- data/lib/riemann/tools/zpool.rb +29 -0
- data/riemann-tools.gemspec +8 -2
- metadata +13 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5a792bfad2f53aed8b440a4077dfe9cb062fa93634ca2a89d6a1ee0d95b9d58
|
4
|
+
data.tar.gz: 3a66ce44d7ce2c1c092e2730d7648fb2175dc3c145d227a1800dc67d1d9aec8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70e5dd74454d5306a10ced4e20428b900e8ef94d8b1c245db5d10be2460342e1b8b9de10de789091a87c06b2e9131dfb427824353ac25ca1435d84b0b15dd99a
|
7
|
+
data.tar.gz: 38c2b16254f90c75badf6f0d44cd99d7b5cf880dbabe4e985248d58a90f2c34ac87cd4da470b915d459a53bae7bcfd0628464c917893a4cdac6d578987d85af3
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v1.3.0](https://github.com/riemann/riemann-tools/tree/v1.3.0) (2022-08-29)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/riemann/riemann-tools/compare/v1.2.0...v1.3.0)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Add support for configuration file to riemann-wrapper [\#235](https://github.com/riemann/riemann-tools/pull/235) ([smortex](https://github.com/smortex))
|
10
|
+
- Add `riemann-md` to monitor Linux RAID/md health [\#232](https://github.com/riemann/riemann-tools/pull/232) ([smortex](https://github.com/smortex))
|
11
|
+
- Add `riemann-zpool` to monitor zpool health [\#231](https://github.com/riemann/riemann-tools/pull/231) ([smortex](https://github.com/smortex))
|
12
|
+
|
13
|
+
**Fixed bugs:**
|
14
|
+
|
15
|
+
- Fix race condition in riemann-wrapper [\#233](https://github.com/riemann/riemann-tools/pull/233) ([smortex](https://github.com/smortex))
|
16
|
+
|
17
|
+
**Closed issues:**
|
18
|
+
|
19
|
+
- There is some kind of race condition in riemann-wrapper [\#230](https://github.com/riemann/riemann-tools/issues/230)
|
20
|
+
|
21
|
+
**Merged pull requests:**
|
22
|
+
|
23
|
+
- Stop riemann-wrapper if a tool raise an error [\#234](https://github.com/riemann/riemann-tools/pull/234) ([smortex](https://github.com/smortex))
|
24
|
+
|
3
25
|
## [v1.2.0](https://github.com/riemann/riemann-tools/tree/v1.2.0) (2022-08-17)
|
4
26
|
|
5
27
|
[Full Changelog](https://github.com/riemann/riemann-tools/compare/v1.1.1...v1.2.0)
|
data/Rakefile
CHANGED
@@ -22,8 +22,15 @@ end
|
|
22
22
|
|
23
23
|
task build: :gen_parser
|
24
24
|
|
25
|
-
desc 'Generate
|
26
|
-
task gen_parser:
|
25
|
+
desc 'Generate parsers'
|
26
|
+
task gen_parser: [
|
27
|
+
'lib/riemann/tools/mdstat_parser.tab.rb',
|
28
|
+
'lib/riemann/tools/uptime_parser.tab.rb',
|
29
|
+
]
|
30
|
+
|
31
|
+
file 'lib/riemann/tools/mdstat_parser.tab.rb' => 'lib/riemann/tools/mdstat_parser.y' do
|
32
|
+
sh 'racc -S lib/riemann/tools/mdstat_parser.y'
|
33
|
+
end
|
27
34
|
|
28
35
|
file 'lib/riemann/tools/uptime_parser.tab.rb' => 'lib/riemann/tools/uptime_parser.y' do
|
29
36
|
sh 'racc -S lib/riemann/tools/uptime_parser.y'
|
data/bin/riemann-md
ADDED
data/bin/riemann-wrapper
CHANGED
@@ -27,9 +27,10 @@ def read_flags(argv)
|
|
27
27
|
res
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
def usage
|
31
31
|
warn <<~USAGE
|
32
32
|
usage: riemann-wrapper [common options] -- tool1 [tool1 options] [-- tool2 [tool2 options] ...]
|
33
|
+
riemann-wrapper /path/to/configuration/file.yml
|
33
34
|
|
34
35
|
Run multiple Riemann tools in a single process. A single connection to
|
35
36
|
riemann is maintained and shared for all tools, the connection flags should
|
@@ -47,16 +48,53 @@ if ARGV.empty?
|
|
47
48
|
fd --tag=fd -- \\
|
48
49
|
health --tag=health -- \\
|
49
50
|
ntp --tag=ntp
|
51
|
+
|
52
|
+
3. Same as above example, but using a configuration file (more verbose but
|
53
|
+
easier to handle when running riemann-wrapper manually of managing it
|
54
|
+
with a Configuration Management system):
|
55
|
+
|
56
|
+
cat > config.yml << EOT
|
57
|
+
---
|
58
|
+
options: --host riemann.example.com --tcp
|
59
|
+
tools:
|
60
|
+
- name: fd
|
61
|
+
options: --tag=fd
|
62
|
+
- name: health
|
63
|
+
options: --tag=health
|
64
|
+
- name: ntp
|
65
|
+
options: --tag=ntp
|
66
|
+
EOT
|
67
|
+
riemann-wrapper config.yml
|
50
68
|
USAGE
|
51
69
|
exit 1
|
52
70
|
end
|
53
71
|
|
72
|
+
usage if ARGV.empty?
|
73
|
+
|
74
|
+
if ARGV.size == 1
|
75
|
+
unless File.readable?(ARGV[0])
|
76
|
+
warn "Cannot open file for reading: #{ARGV[0]}"
|
77
|
+
usage
|
78
|
+
end
|
79
|
+
|
80
|
+
require 'yaml'
|
81
|
+
config = YAML.safe_load(File.read(ARGV[0]))
|
82
|
+
|
83
|
+
commandline = config['options']
|
84
|
+
config['tools'].each { |tool| commandline << " -- #{tool['name']} #{tool['options']}" }
|
85
|
+
|
86
|
+
ARGV.replace(commandline.split)
|
87
|
+
end
|
88
|
+
|
54
89
|
argv = ARGV.dup
|
55
90
|
|
56
91
|
common_argv = read_flags(argv)
|
57
92
|
|
58
93
|
threads = []
|
59
94
|
|
95
|
+
# Terminate the whole process is some thread fail
|
96
|
+
Thread.abort_on_exception = true
|
97
|
+
|
60
98
|
while argv.any?
|
61
99
|
tool = argv.shift
|
62
100
|
tool_argv = read_flags(argv)
|
@@ -69,7 +107,7 @@ while argv.any?
|
|
69
107
|
# Force evaluation of options. This rely on ARGV and needs to be done before
|
70
108
|
# we launch multiple threads which compete to read information from there.
|
71
109
|
instance.options
|
72
|
-
threads << Thread.new
|
110
|
+
threads << Thread.new(instance, &:run)
|
73
111
|
end
|
74
112
|
|
75
113
|
threads.each(&:join)
|
data/bin/riemann-zpool
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'riemann/tools'
|
4
|
+
require 'riemann/tools/mdstat_parser.tab'
|
5
|
+
|
6
|
+
module Riemann
|
7
|
+
module Tools
|
8
|
+
class Md
|
9
|
+
include Riemann::Tools
|
10
|
+
|
11
|
+
def mdstat_parser
|
12
|
+
@mdstat_parser ||= MdstatParser.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def tick
|
16
|
+
status = File.read('/proc/mdstat')
|
17
|
+
res = mdstat_parser.parse(status)
|
18
|
+
|
19
|
+
state = res.values.all? { |value| value =~ /\AU+\z/ } ? 'ok' : 'critical'
|
20
|
+
|
21
|
+
report(
|
22
|
+
service: 'mdstat',
|
23
|
+
message: status,
|
24
|
+
state: state,
|
25
|
+
)
|
26
|
+
rescue Errno::ENOENT => e
|
27
|
+
report(
|
28
|
+
service: 'mdstat',
|
29
|
+
message: e.message,
|
30
|
+
state: 'critical',
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,340 @@
|
|
1
|
+
#
|
2
|
+
# DO NOT MODIFY!!!!
|
3
|
+
# This file is automatically generated by Racc 1.6.0
|
4
|
+
# from Racc grammar file "".
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'racc/parser.rb'
|
8
|
+
|
9
|
+
|
10
|
+
require 'strscan'
|
11
|
+
|
12
|
+
module Riemann
|
13
|
+
module Tools
|
14
|
+
class MdstatParser < Racc::Parser
|
15
|
+
|
16
|
+
module_eval(<<'...end mdstat_parser.y/module_eval...', 'mdstat_parser.y', 42)
|
17
|
+
|
18
|
+
def parse(text)
|
19
|
+
s = StringScanner.new(text)
|
20
|
+
@tokens = []
|
21
|
+
|
22
|
+
until s.eos? do
|
23
|
+
case
|
24
|
+
when s.scan(/\n/) then # ignore
|
25
|
+
when s.scan(/\s+/) then # ignore
|
26
|
+
|
27
|
+
when s.scan(/\[=*>.*\]/) then @tokens << [:PROGRESS, s.matched]
|
28
|
+
when s.scan(/%/) then @tokens << ['%', s.matched]
|
29
|
+
when s.scan(/,/) then @tokens << [',', s.matched]
|
30
|
+
when s.scan(/:/) then @tokens << [':', s.matched]
|
31
|
+
when s.scan(/</) then @tokens << ['<', s.matched]
|
32
|
+
when s.scan(/=/) then @tokens << ['=', s.matched]
|
33
|
+
when s.scan(/>/) then @tokens << ['>', s.matched]
|
34
|
+
when s.scan(/\(/) then @tokens << ['(', s.matched]
|
35
|
+
when s.scan(/\)/) then @tokens << [')', s.matched]
|
36
|
+
when s.scan(/\./) then @tokens << ['.', s.matched]
|
37
|
+
when s.scan(/\//) then @tokens << ['/', s.matched]
|
38
|
+
when s.scan(/\[/) then @tokens << ['[', s.matched]
|
39
|
+
when s.scan(/]/) then @tokens << [']', s.matched]
|
40
|
+
when s.scan(/algorithm/) then @tokens << [:ALGORITHM, s.matched]
|
41
|
+
when s.scan(/bitmap/) then @tokens << [:BITMAP, s.matched]
|
42
|
+
when s.scan(/blocks/) then @tokens << [:BLOCKS, s.matched]
|
43
|
+
when s.scan(/chunk/) then @tokens << [:CHUNK, s.matched]
|
44
|
+
when s.scan(/finish/) then @tokens << [:FINISH, s.matched]
|
45
|
+
when s.scan(/level/) then @tokens << [:LEVEL, s.matched]
|
46
|
+
when s.scan(/min/) then @tokens << [:MIN, s.matched]
|
47
|
+
when s.scan(/pages/) then @tokens << [:PAGES, s.matched]
|
48
|
+
when s.scan(/(raid([014-6]|10)|linear|multipath|faulty)\b/) then @tokens << [:PERSONALITY, s.matched]
|
49
|
+
when s.scan(/Personalities/) then @tokens << [:PERSONALITIES, s.matched]
|
50
|
+
when s.scan(/recovery/) then @tokens << [:RECOVERY, s.matched]
|
51
|
+
when s.scan(/speed/) then @tokens << [:SPEED, s.matched]
|
52
|
+
when s.scan(/super/) then @tokens << [:SUPER, s.matched]
|
53
|
+
when s.scan(/unused devices/) then @tokens << [:UNUSED_DEVICES, s.matched]
|
54
|
+
when s.scan(/K\/sec/) then @tokens << [:SPEED_UNIT, s.matched.to_i]
|
55
|
+
when s.scan(/KB/) then @tokens << [:BYTE_UNIT, s.matched.to_i]
|
56
|
+
when s.scan(/k/) then @tokens << [:UNIT, s.matched.to_i]
|
57
|
+
when s.scan(/\d+\.\d+/) then @tokens << [:FLOAT, s.matched.to_i]
|
58
|
+
when s.scan(/\d+/) then @tokens << [:INTEGER, s.matched.to_i]
|
59
|
+
when s.scan(/F\b/) then @tokens << [:FAILED, s.matched.to_i]
|
60
|
+
when s.scan(/\w+/) then @tokens << [:IDENTIFIER, s.matched]
|
61
|
+
else
|
62
|
+
raise s.rest
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
do_parse
|
67
|
+
end
|
68
|
+
|
69
|
+
def next_token
|
70
|
+
@tokens.shift
|
71
|
+
end
|
72
|
+
...end mdstat_parser.y/module_eval...
|
73
|
+
##### State transition tables begin ###
|
74
|
+
|
75
|
+
racc_action_table = [
|
76
|
+
10, 13, 14, 10, 29, 3, 4, 6, 7, 15,
|
77
|
+
16, 17, 18, 11, 19, 20, 21, 22, 23, 24,
|
78
|
+
10, 27, 28, 31, 32, 33, 35, 37, 38, 39,
|
79
|
+
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
|
80
|
+
50, 51, 52, 53, 54, 56, 58, 59, 60, 61,
|
81
|
+
62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
|
82
|
+
72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
|
83
|
+
82, 83, 84, 85, 86, 87, 88 ]
|
84
|
+
|
85
|
+
racc_action_check = [
|
86
|
+
5, 10, 10, 25, 25, 0, 1, 3, 4, 11,
|
87
|
+
12, 13, 14, 5, 15, 16, 17, 18, 19, 20,
|
88
|
+
21, 22, 23, 27, 29, 31, 32, 34, 35, 36,
|
89
|
+
37, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
90
|
+
48, 49, 50, 51, 52, 53, 55, 56, 58, 59,
|
91
|
+
60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
|
92
|
+
70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
|
93
|
+
80, 81, 82, 84, 85, 86, 87 ]
|
94
|
+
|
95
|
+
racc_action_pointer = [
|
96
|
+
-10, 6, nil, -17, 8, -10, nil, nil, nil, nil,
|
97
|
+
-23, -15, -15, 1, 1, -19, -1, 0, -9, 8,
|
98
|
+
-7, 10, -7, -12, nil, -7, nil, 16, nil, 20,
|
99
|
+
nil, -4, 5, nil, 15, 19, 4, 19, nil, 20,
|
100
|
+
2, 6, 23, 24, 14, 11, 32, 14, 10, 31,
|
101
|
+
40, 17, 33, 42, nil, 29, 23, nil, 30, 38,
|
102
|
+
19, 24, 43, 42, 22, 41, 28, 32, 47, 48,
|
103
|
+
33, 56, 51, 37, 35, 35, 58, 56, 37, 64,
|
104
|
+
61, 65, 59, nil, 54, 43, 64, 56, nil ]
|
105
|
+
|
106
|
+
racc_action_default = [
|
107
|
+
-21, -21, -6, -21, -21, -21, -4, 89, -1, -5,
|
108
|
+
-21, -21, -2, -21, -21, -21, -21, -21, -21, -21,
|
109
|
+
-21, -21, -11, -21, -3, -21, -9, -21, -20, -21,
|
110
|
+
-8, -21, -13, -10, -15, -21, -21, -21, -12, -21,
|
111
|
+
-21, -21, -21, -21, -21, -21, -21, -21, -21, -21,
|
112
|
+
-21, -21, -21, -17, -14, -19, -21, -7, -21, -21,
|
113
|
+
-21, -21, -21, -21, -21, -21, -21, -21, -21, -21,
|
114
|
+
-21, -21, -21, -21, -21, -21, -21, -21, -21, -21,
|
115
|
+
-21, -21, -21, -16, -21, -21, -21, -21, -18 ]
|
116
|
+
|
117
|
+
racc_goto_table = [
|
118
|
+
9, 1, 2, 5, 8, 12, 25, 34, 36, 55,
|
119
|
+
57, nil, nil, nil, nil, nil, 26, nil, nil, nil,
|
120
|
+
30 ]
|
121
|
+
|
122
|
+
racc_goto_check = [
|
123
|
+
6, 1, 2, 3, 4, 5, 7, 8, 9, 10,
|
124
|
+
11, nil, nil, nil, nil, nil, 6, nil, nil, nil,
|
125
|
+
6 ]
|
126
|
+
|
127
|
+
racc_goto_pointer = [
|
128
|
+
nil, 1, 2, 1, -1, -1, -5, -15, -25, -26,
|
129
|
+
-44, -45 ]
|
130
|
+
|
131
|
+
racc_goto_default = [
|
132
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
133
|
+
nil, nil ]
|
134
|
+
|
135
|
+
racc_reduce_table = [
|
136
|
+
0, 0, :racc_error,
|
137
|
+
3, 36, :_reduce_1,
|
138
|
+
3, 37, :_reduce_none,
|
139
|
+
4, 40, :_reduce_none,
|
140
|
+
0, 40, :_reduce_none,
|
141
|
+
2, 38, :_reduce_5,
|
142
|
+
0, 38, :_reduce_6,
|
143
|
+
19, 41, :_reduce_7,
|
144
|
+
2, 42, :_reduce_none,
|
145
|
+
1, 42, :_reduce_none,
|
146
|
+
7, 41, :_reduce_none,
|
147
|
+
4, 41, :_reduce_none,
|
148
|
+
2, 43, :_reduce_none,
|
149
|
+
0, 43, :_reduce_none,
|
150
|
+
9, 44, :_reduce_none,
|
151
|
+
0, 44, :_reduce_none,
|
152
|
+
14, 45, :_reduce_none,
|
153
|
+
0, 45, :_reduce_none,
|
154
|
+
18, 46, :_reduce_none,
|
155
|
+
0, 46, :_reduce_none,
|
156
|
+
5, 39, :_reduce_none ]
|
157
|
+
|
158
|
+
racc_reduce_n = 21
|
159
|
+
|
160
|
+
racc_shift_n = 89
|
161
|
+
|
162
|
+
racc_token_table = {
|
163
|
+
false => 0,
|
164
|
+
:error => 1,
|
165
|
+
:ALGORITHM => 2,
|
166
|
+
:BITMAP => 3,
|
167
|
+
:BLOCKS => 4,
|
168
|
+
:BYTE_UNIT => 5,
|
169
|
+
:CHUNK => 6,
|
170
|
+
:FAILED => 7,
|
171
|
+
:FINISH => 8,
|
172
|
+
:FLOAT => 9,
|
173
|
+
:IDENTIFIER => 10,
|
174
|
+
:INTEGER => 11,
|
175
|
+
:LEVEL => 12,
|
176
|
+
:MIN => 13,
|
177
|
+
:PAGES => 14,
|
178
|
+
:PERSONALITIES => 15,
|
179
|
+
:PERSONALITY => 16,
|
180
|
+
:PROGRESS => 17,
|
181
|
+
:RECOVERY => 18,
|
182
|
+
:SPEED => 19,
|
183
|
+
:SPEED_UNIT => 20,
|
184
|
+
:SUPER => 21,
|
185
|
+
:UNIT => 22,
|
186
|
+
:UNUSED_DEVICES => 23,
|
187
|
+
":" => 24,
|
188
|
+
"[" => 25,
|
189
|
+
"]" => 26,
|
190
|
+
"/" => 27,
|
191
|
+
"(" => 28,
|
192
|
+
")" => 29,
|
193
|
+
"," => 30,
|
194
|
+
"=" => 31,
|
195
|
+
"%" => 32,
|
196
|
+
"<" => 33,
|
197
|
+
">" => 34 }
|
198
|
+
|
199
|
+
racc_nt_base = 35
|
200
|
+
|
201
|
+
racc_use_result_var = true
|
202
|
+
|
203
|
+
Racc_arg = [
|
204
|
+
racc_action_table,
|
205
|
+
racc_action_check,
|
206
|
+
racc_action_default,
|
207
|
+
racc_action_pointer,
|
208
|
+
racc_goto_table,
|
209
|
+
racc_goto_check,
|
210
|
+
racc_goto_default,
|
211
|
+
racc_goto_pointer,
|
212
|
+
racc_nt_base,
|
213
|
+
racc_reduce_table,
|
214
|
+
racc_token_table,
|
215
|
+
racc_shift_n,
|
216
|
+
racc_reduce_n,
|
217
|
+
racc_use_result_var ]
|
218
|
+
|
219
|
+
Racc_token_to_s_table = [
|
220
|
+
"$end",
|
221
|
+
"error",
|
222
|
+
"ALGORITHM",
|
223
|
+
"BITMAP",
|
224
|
+
"BLOCKS",
|
225
|
+
"BYTE_UNIT",
|
226
|
+
"CHUNK",
|
227
|
+
"FAILED",
|
228
|
+
"FINISH",
|
229
|
+
"FLOAT",
|
230
|
+
"IDENTIFIER",
|
231
|
+
"INTEGER",
|
232
|
+
"LEVEL",
|
233
|
+
"MIN",
|
234
|
+
"PAGES",
|
235
|
+
"PERSONALITIES",
|
236
|
+
"PERSONALITY",
|
237
|
+
"PROGRESS",
|
238
|
+
"RECOVERY",
|
239
|
+
"SPEED",
|
240
|
+
"SPEED_UNIT",
|
241
|
+
"SUPER",
|
242
|
+
"UNIT",
|
243
|
+
"UNUSED_DEVICES",
|
244
|
+
"\":\"",
|
245
|
+
"\"[\"",
|
246
|
+
"\"]\"",
|
247
|
+
"\"/\"",
|
248
|
+
"\"(\"",
|
249
|
+
"\")\"",
|
250
|
+
"\",\"",
|
251
|
+
"\"=\"",
|
252
|
+
"\"%\"",
|
253
|
+
"\"<\"",
|
254
|
+
"\">\"",
|
255
|
+
"$start",
|
256
|
+
"target",
|
257
|
+
"personalities",
|
258
|
+
"devices",
|
259
|
+
"unused_devices",
|
260
|
+
"list_of_personalities",
|
261
|
+
"device",
|
262
|
+
"list_of_devices",
|
263
|
+
"super",
|
264
|
+
"level",
|
265
|
+
"bitmap",
|
266
|
+
"restore_progress" ]
|
267
|
+
|
268
|
+
Racc_debug_parser = false
|
269
|
+
|
270
|
+
##### State transition tables end #####
|
271
|
+
|
272
|
+
# reduce 0 omitted
|
273
|
+
|
274
|
+
module_eval(<<'.,.,', 'mdstat_parser.y', 3)
|
275
|
+
def _reduce_1(val, _values, result)
|
276
|
+
result = val[1]
|
277
|
+
result
|
278
|
+
end
|
279
|
+
.,.,
|
280
|
+
|
281
|
+
# reduce 2 omitted
|
282
|
+
|
283
|
+
# reduce 3 omitted
|
284
|
+
|
285
|
+
# reduce 4 omitted
|
286
|
+
|
287
|
+
module_eval(<<'.,.,', 'mdstat_parser.y', 10)
|
288
|
+
def _reduce_5(val, _values, result)
|
289
|
+
result = val[0].merge(val[1])
|
290
|
+
result
|
291
|
+
end
|
292
|
+
.,.,
|
293
|
+
|
294
|
+
module_eval(<<'.,.,', 'mdstat_parser.y', 11)
|
295
|
+
def _reduce_6(val, _values, result)
|
296
|
+
result = {}
|
297
|
+
result
|
298
|
+
end
|
299
|
+
.,.,
|
300
|
+
|
301
|
+
module_eval(<<'.,.,', 'mdstat_parser.y', 13)
|
302
|
+
def _reduce_7(val, _values, result)
|
303
|
+
result = { val[0] => val[15] }
|
304
|
+
result
|
305
|
+
end
|
306
|
+
.,.,
|
307
|
+
|
308
|
+
# reduce 8 omitted
|
309
|
+
|
310
|
+
# reduce 9 omitted
|
311
|
+
|
312
|
+
# reduce 10 omitted
|
313
|
+
|
314
|
+
# reduce 11 omitted
|
315
|
+
|
316
|
+
# reduce 12 omitted
|
317
|
+
|
318
|
+
# reduce 13 omitted
|
319
|
+
|
320
|
+
# reduce 14 omitted
|
321
|
+
|
322
|
+
# reduce 15 omitted
|
323
|
+
|
324
|
+
# reduce 16 omitted
|
325
|
+
|
326
|
+
# reduce 17 omitted
|
327
|
+
|
328
|
+
# reduce 18 omitted
|
329
|
+
|
330
|
+
# reduce 19 omitted
|
331
|
+
|
332
|
+
# reduce 20 omitted
|
333
|
+
|
334
|
+
def _reduce_none(val, _values, result)
|
335
|
+
val[0]
|
336
|
+
end
|
337
|
+
|
338
|
+
end # class MdstatParser
|
339
|
+
end # module Tools
|
340
|
+
end # module Riemann
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'open3'
|
4
|
+
|
5
|
+
require 'riemann/tools'
|
6
|
+
|
7
|
+
module Riemann
|
8
|
+
module Tools
|
9
|
+
class Zpool
|
10
|
+
include Riemann::Tools
|
11
|
+
|
12
|
+
def tick
|
13
|
+
output, status = Open3.capture2e('zpool status -x')
|
14
|
+
|
15
|
+
report(
|
16
|
+
service: 'zpool health',
|
17
|
+
message: output,
|
18
|
+
state: status.success? ? 'ok' : 'critical',
|
19
|
+
)
|
20
|
+
rescue Errno::ENOENT => e
|
21
|
+
report(
|
22
|
+
service: 'zpool health',
|
23
|
+
message: e.message,
|
24
|
+
state: 'critical',
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/riemann-tools.gemspec
CHANGED
@@ -24,8 +24,14 @@ Gem::Specification.new do |spec|
|
|
24
24
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
25
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
26
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } -
|
27
|
-
[
|
28
|
-
|
27
|
+
[
|
28
|
+
'lib/riemann/tools/mdstat_parser.y',
|
29
|
+
'lib/riemann/tools/uptime_parser.y',
|
30
|
+
] +
|
31
|
+
[
|
32
|
+
'lib/riemann/tools/mdstat_parser.tab.rb',
|
33
|
+
'lib/riemann/tools/uptime_parser.tab.rb',
|
34
|
+
]
|
29
35
|
end
|
30
36
|
spec.bindir = 'bin'
|
31
37
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riemann-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Kingsbury
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -172,6 +172,7 @@ executables:
|
|
172
172
|
- riemann-haproxy
|
173
173
|
- riemann-health
|
174
174
|
- riemann-kvminstance
|
175
|
+
- riemann-md
|
175
176
|
- riemann-memcached
|
176
177
|
- riemann-net
|
177
178
|
- riemann-nginx-status
|
@@ -181,6 +182,7 @@ executables:
|
|
181
182
|
- riemann-varnish
|
182
183
|
- riemann-wrapper
|
183
184
|
- riemann-zookeeper
|
185
|
+
- riemann-zpool
|
184
186
|
extensions: []
|
185
187
|
extra_rdoc_files: []
|
186
188
|
files:
|
@@ -212,6 +214,7 @@ files:
|
|
212
214
|
- bin/riemann-haproxy
|
213
215
|
- bin/riemann-health
|
214
216
|
- bin/riemann-kvminstance
|
217
|
+
- bin/riemann-md
|
215
218
|
- bin/riemann-memcached
|
216
219
|
- bin/riemann-net
|
217
220
|
- bin/riemann-nginx-status
|
@@ -221,6 +224,7 @@ files:
|
|
221
224
|
- bin/riemann-varnish
|
222
225
|
- bin/riemann-wrapper
|
223
226
|
- bin/riemann-zookeeper
|
227
|
+
- bin/riemann-zpool
|
224
228
|
- lib/riemann/tools.rb
|
225
229
|
- lib/riemann/tools/apache_status.rb
|
226
230
|
- lib/riemann/tools/bench.rb
|
@@ -234,6 +238,8 @@ files:
|
|
234
238
|
- lib/riemann/tools/haproxy.rb
|
235
239
|
- lib/riemann/tools/health.rb
|
236
240
|
- lib/riemann/tools/kvm.rb
|
241
|
+
- lib/riemann/tools/md.rb
|
242
|
+
- lib/riemann/tools/mdstat_parser.tab.rb
|
237
243
|
- lib/riemann/tools/memcached.rb
|
238
244
|
- lib/riemann/tools/net.rb
|
239
245
|
- lib/riemann/tools/nginx_status.rb
|
@@ -246,6 +252,7 @@ files:
|
|
246
252
|
- lib/riemann/tools/varnish.rb
|
247
253
|
- lib/riemann/tools/version.rb
|
248
254
|
- lib/riemann/tools/zookeeper.rb
|
255
|
+
- lib/riemann/tools/zpool.rb
|
249
256
|
- riemann-tools.gemspec
|
250
257
|
- tools/riemann-aws/LICENSE
|
251
258
|
- tools/riemann-aws/README.md
|
@@ -314,7 +321,7 @@ metadata:
|
|
314
321
|
homepage_uri: https://github.com/aphyr/riemann-tools
|
315
322
|
source_code_uri: https://github.com/aphyr/riemann-tools
|
316
323
|
changelog_uri: https://github.com/aphyr/riemann-tools
|
317
|
-
post_install_message:
|
324
|
+
post_install_message:
|
318
325
|
rdoc_options: []
|
319
326
|
require_paths:
|
320
327
|
- lib
|
@@ -329,8 +336,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
329
336
|
- !ruby/object:Gem::Version
|
330
337
|
version: '0'
|
331
338
|
requirements: []
|
332
|
-
rubygems_version: 3.
|
333
|
-
signing_key:
|
339
|
+
rubygems_version: 3.3.19
|
340
|
+
signing_key:
|
334
341
|
specification_version: 4
|
335
342
|
summary: Utilities which submit events to Riemann.
|
336
343
|
test_files: []
|