riemann-tools 1.11.0 → 2.0.0
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/.github/workflows/ci.yml +3 -3
- data/.github/workflows/codeql-analysis.yml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +65 -10
- data/Gemfile +1 -11
- data/README.markdown +4 -3
- data/lib/riemann/tools/apache_status.rb +1 -0
- data/lib/riemann/tools/bench.rb +6 -5
- data/lib/riemann/tools/cloudant.rb +1 -0
- data/lib/riemann/tools/haproxy.rb +1 -0
- data/lib/riemann/tools/health.rb +7 -5
- data/lib/riemann/tools/hwmon.rb +24 -7
- data/lib/riemann/tools/mdstat_parser.tab.rb +137 -127
- data/lib/riemann/tools/memcached.rb +1 -0
- data/lib/riemann/tools/nginx_status.rb +1 -0
- data/lib/riemann/tools/portcheck.rb +1 -0
- data/lib/riemann/tools/riemann_client_wrapper.rb +49 -6
- data/lib/riemann/tools/tls_check.rb +4 -2
- data/lib/riemann/tools/uptime_parser.tab.rb +1 -1
- data/lib/riemann/tools/version.rb +1 -1
- data/lib/riemann/tools/zookeeper.rb +1 -0
- data/lib/riemann/tools.rb +4 -1
- data/riemann-tools.gemspec +5 -4
- data/tools/riemann-aws/lib/riemann/tools/aws/billing.rb +1 -0
- data/tools/riemann-aws/lib/riemann/tools/aws/elb_metrics.rb +1 -0
- data/tools/riemann-aws/lib/riemann/tools/aws/rds_status.rb +1 -0
- data/tools/riemann-aws/lib/riemann/tools/aws/s3_list.rb +1 -0
- data/tools/riemann-aws/lib/riemann/tools/aws/s3_status.rb +1 -0
- data/tools/riemann-aws/lib/riemann/tools/aws/sqs_status.rb +1 -0
- data/tools/riemann-aws/lib/riemann/tools/aws/status.rb +1 -0
- data/tools/riemann-chronos/lib/riemann/tools/chronos.rb +4 -4
- data/tools/riemann-elasticsearch/lib/riemann/tools/elasticsearch.rb +3 -2
- data/tools/riemann-marathon/lib/riemann/tools/marathon.rb +4 -4
- data/tools/riemann-mesos/lib/riemann/tools/mesos.rb +4 -4
- data/tools/riemann-munin/lib/riemann/tools/munin.rb +1 -0
- data/tools/riemann-rabbitmq/lib/riemann/tools/rabbitmq.rb +3 -3
- data/tools/riemann-riak/lib/riemann/tools/riak.rb +3 -2
- metadata +18 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# DO NOT MODIFY!!!!
|
|
3
|
-
# This file is automatically generated by Racc 1.
|
|
3
|
+
# This file is automatically generated by Racc 1.8.1
|
|
4
4
|
# from Racc grammar file "mdstat_parser.y".
|
|
5
5
|
#
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ module Riemann
|
|
|
15
15
|
module Tools
|
|
16
16
|
class MdstatParser < Racc::Parser
|
|
17
17
|
|
|
18
|
-
module_eval(<<'...end mdstat_parser.y/module_eval...', 'mdstat_parser.y',
|
|
18
|
+
module_eval(<<'...end mdstat_parser.y/module_eval...', 'mdstat_parser.y', 62)
|
|
19
19
|
|
|
20
20
|
def parse(text)
|
|
21
21
|
s = Utils::StringTokenizer.new(text)
|
|
@@ -23,7 +23,7 @@ module_eval(<<'...end mdstat_parser.y/module_eval...', 'mdstat_parser.y', 58)
|
|
|
23
23
|
until s.eos? do
|
|
24
24
|
case
|
|
25
25
|
when s.scan(/\n/) then s.push_token(nil)
|
|
26
|
-
when s.scan(
|
|
26
|
+
when s.scan(/[[:blank:]]+/) then s.push_token(nil)
|
|
27
27
|
|
|
28
28
|
when s.scan(/\([WJFSR]\)/) then s.push_token(:DISK_STATUS)
|
|
29
29
|
when s.scan(/<none>/) then s.push_token(:NONE)
|
|
@@ -40,6 +40,7 @@ module_eval(<<'...end mdstat_parser.y/module_eval...', 'mdstat_parser.y', 58)
|
|
|
40
40
|
when s.scan(/\[/) then s.push_token('[')
|
|
41
41
|
when s.scan(/]/) then s.push_token(']')
|
|
42
42
|
|
|
43
|
+
when s.scan(/auto-read-only\b/) then s.push_token(:AUTO_READ_ONLY)
|
|
43
44
|
when s.scan(/DELAYED\b/) then s.push_token(:DELAYED)
|
|
44
45
|
when s.scan(/KB\b/) then s.push_token(:BYTE_UNIT)
|
|
45
46
|
when s.scan(/K\/sec\b/) then s.push_token(:SPEED_UNIT)
|
|
@@ -89,154 +90,157 @@ module_eval(<<'...end mdstat_parser.y/module_eval...', 'mdstat_parser.y', 58)
|
|
|
89
90
|
##### State transition tables begin ###
|
|
90
91
|
|
|
91
92
|
racc_action_table = [
|
|
92
|
-
|
|
93
|
-
3, 13, 10,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
64, 17, 10, 57, 58, 15, 77, 59, 60, 14,
|
|
94
|
+
3, 13, 10, 32, 4, 7, 12, 65, 76, 66,
|
|
95
|
+
67, 11, 75, 18, 19, 20, 21, 22, 24, 25,
|
|
96
|
+
26, 27, 28, 10, 31, 34, 36, 38, 39, 40,
|
|
97
|
+
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
|
|
98
|
+
51, 52, 53, 54, 55, 62, 68, 69, 70, 71,
|
|
99
|
+
72, 73, 74, 78, 79, 80, 81, 82, 83, 84,
|
|
100
|
+
85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
|
|
101
|
+
95, 96, 97, 98, 99, 100, 101, 102, 103, 104 ]
|
|
101
102
|
|
|
102
103
|
racc_action_check = [
|
|
103
|
-
|
|
104
|
-
0, 10,
|
|
105
|
-
|
|
106
|
-
23, 24,
|
|
107
|
-
38,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
104
|
+
57, 11, 5, 54, 54, 11, 70, 54, 54, 10,
|
|
105
|
+
0, 10, 29, 29, 1, 4, 6, 57, 70, 57,
|
|
106
|
+
57, 5, 70, 12, 13, 14, 16, 18, 19, 20,
|
|
107
|
+
23, 24, 25, 26, 27, 32, 34, 35, 36, 37,
|
|
108
|
+
38, 40, 41, 42, 43, 44, 45, 46, 47, 48,
|
|
109
|
+
49, 50, 51, 52, 53, 56, 58, 59, 60, 62,
|
|
110
|
+
63, 68, 69, 71, 72, 78, 79, 80, 81, 82,
|
|
111
|
+
83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
|
|
112
|
+
93, 94, 95, 96, 97, 98, 99, 101, 102, 103 ]
|
|
112
113
|
|
|
113
114
|
racc_action_pointer = [
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
-
|
|
120
|
-
nil, nil, nil, nil,
|
|
121
|
-
nil, nil, nil, nil,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
nil ]
|
|
115
|
+
-9, 14, nil, nil, 15, -11, -17, nil, nil, nil,
|
|
116
|
+
-24, -12, 3, 11, 11, nil, 13, nil, -7, -9,
|
|
117
|
+
-5, nil, nil, 10, 28, 22, 20, -4, nil, -1,
|
|
118
|
+
nil, nil, 30, nil, 6, 22, 26, 6, 26, nil,
|
|
119
|
+
27, 3, 7, 30, 31, 15, 13, 40, 16, 11,
|
|
120
|
+
38, 50, 19, 40, -19, nil, 51, -7, 16, 17,
|
|
121
|
+
18, nil, 24, 20, nil, nil, nil, nil, 36, 37,
|
|
122
|
+
-3, 49, 52, nil, nil, nil, nil, nil, 29, 25,
|
|
123
|
+
53, 31, 51, 56, 38, 36, 59, 60, 69, 38,
|
|
124
|
+
43, 67, 40, 40, 67, 70, 77, 68, 77, 58,
|
|
125
|
+
nil, 47, 74, 60, nil ]
|
|
125
126
|
|
|
126
127
|
racc_action_default = [
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
-
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
-18 ]
|
|
128
|
+
-35, -35, -6, -4, -35, -35, -2, 105, -1, -5,
|
|
129
|
+
-35, -35, -35, -35, -35, -31, -32, -34, -35, -9,
|
|
130
|
+
-35, -33, -3, -35, -35, -13, -35, -35, -12, -35,
|
|
131
|
+
-11, -8, -35, -10, -15, -17, -35, -35, -35, -14,
|
|
132
|
+
-35, -35, -35, -35, -35, -35, -35, -35, -35, -35,
|
|
133
|
+
-35, -35, -35, -35, -26, -16, -19, -35, -35, -35,
|
|
134
|
+
-35, -7, -35, -35, -27, -28, -29, -30, -35, -35,
|
|
135
|
+
-35, -35, -35, -21, -22, -23, -24, -25, -35, -35,
|
|
136
|
+
-35, -35, -35, -35, -35, -35, -35, -35, -35, -35,
|
|
137
|
+
-35, -35, -35, -35, -35, -35, -35, -35, -35, -35,
|
|
138
|
+
-18, -35, -35, -35, -20 ]
|
|
138
139
|
|
|
139
140
|
racc_goto_table = [
|
|
140
|
-
9, 1, 2, 5, 8, 6,
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
9, 1, 2, 5, 8, 6, 23, 29, 35, 37,
|
|
142
|
+
56, 61, 63, 16, nil, nil, nil, nil, nil, nil,
|
|
143
|
+
nil, 30, nil, nil, 33 ]
|
|
143
144
|
|
|
144
145
|
racc_goto_check = [
|
|
145
146
|
6, 1, 2, 3, 4, 5, 7, 8, 9, 10,
|
|
146
|
-
11, 12, 13, nil, nil, nil, nil, nil,
|
|
147
|
-
6 ]
|
|
147
|
+
11, 12, 13, 14, nil, nil, nil, nil, nil, nil,
|
|
148
|
+
nil, 6, nil, nil, 6 ]
|
|
148
149
|
|
|
149
150
|
racc_goto_pointer = [
|
|
150
|
-
nil, 1, 2, 1, -1, 2, -5, -
|
|
151
|
-
-
|
|
151
|
+
nil, 1, 2, 1, -1, 2, -5, -13, -19, -26,
|
|
152
|
+
-26, -44, -45, -45, 2 ]
|
|
152
153
|
|
|
153
154
|
racc_goto_default = [
|
|
154
155
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
|
155
|
-
nil, nil, nil, nil ]
|
|
156
|
+
nil, nil, nil, nil, nil ]
|
|
156
157
|
|
|
157
158
|
racc_reduce_table = [
|
|
158
159
|
0, 0, :racc_error,
|
|
159
|
-
3,
|
|
160
|
-
2,
|
|
161
|
-
4, 46, :_reduce_none,
|
|
162
|
-
0, 46, :_reduce_none,
|
|
163
|
-
2, 44, :_reduce_5,
|
|
164
|
-
0, 44, :_reduce_6,
|
|
165
|
-
19, 47, :_reduce_7,
|
|
166
|
-
2, 48, :_reduce_none,
|
|
167
|
-
1, 48, :_reduce_none,
|
|
168
|
-
5, 47, :_reduce_none,
|
|
160
|
+
3, 43, :_reduce_1,
|
|
161
|
+
2, 44, :_reduce_none,
|
|
169
162
|
4, 47, :_reduce_none,
|
|
170
|
-
|
|
163
|
+
0, 47, :_reduce_none,
|
|
164
|
+
2, 45, :_reduce_5,
|
|
165
|
+
0, 45, :_reduce_6,
|
|
166
|
+
20, 48, :_reduce_7,
|
|
167
|
+
3, 49, :_reduce_none,
|
|
171
168
|
0, 49, :_reduce_none,
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
3, 51, :_reduce_none,
|
|
178
|
-
3, 51, :_reduce_none,
|
|
179
|
-
3, 51, :_reduce_none,
|
|
180
|
-
3, 51, :_reduce_none,
|
|
181
|
-
3, 51, :_reduce_none,
|
|
169
|
+
2, 50, :_reduce_none,
|
|
170
|
+
1, 50, :_reduce_none,
|
|
171
|
+
5, 48, :_reduce_none,
|
|
172
|
+
4, 48, :_reduce_none,
|
|
173
|
+
2, 51, :_reduce_none,
|
|
182
174
|
0, 51, :_reduce_none,
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
175
|
+
9, 52, :_reduce_none,
|
|
176
|
+
0, 52, :_reduce_none,
|
|
177
|
+
14, 54, :_reduce_none,
|
|
178
|
+
0, 54, :_reduce_none,
|
|
179
|
+
18, 53, :_reduce_none,
|
|
180
|
+
3, 53, :_reduce_none,
|
|
181
|
+
3, 53, :_reduce_none,
|
|
182
|
+
3, 53, :_reduce_none,
|
|
183
|
+
3, 53, :_reduce_none,
|
|
184
|
+
3, 53, :_reduce_none,
|
|
185
|
+
0, 53, :_reduce_none,
|
|
186
|
+
1, 55, :_reduce_none,
|
|
187
|
+
1, 55, :_reduce_none,
|
|
188
|
+
1, 55, :_reduce_none,
|
|
189
|
+
1, 55, :_reduce_none,
|
|
190
|
+
2, 46, :_reduce_none,
|
|
191
|
+
2, 46, :_reduce_none,
|
|
192
|
+
2, 56, :_reduce_none,
|
|
193
|
+
1, 56, :_reduce_none ]
|
|
194
|
+
|
|
195
|
+
racc_reduce_n = 35
|
|
196
|
+
|
|
197
|
+
racc_shift_n = 105
|
|
195
198
|
|
|
196
199
|
racc_token_table = {
|
|
197
200
|
false => 0,
|
|
198
201
|
:error => 1,
|
|
199
202
|
:ALGORITHM => 2,
|
|
200
|
-
:
|
|
201
|
-
:
|
|
202
|
-
:
|
|
203
|
-
:
|
|
204
|
-
:
|
|
205
|
-
:
|
|
206
|
-
:
|
|
207
|
-
:
|
|
208
|
-
:
|
|
209
|
-
:
|
|
210
|
-
:
|
|
211
|
-
:
|
|
212
|
-
:
|
|
213
|
-
:
|
|
214
|
-
:
|
|
215
|
-
:
|
|
216
|
-
:
|
|
217
|
-
:
|
|
218
|
-
:
|
|
219
|
-
:
|
|
220
|
-
:
|
|
221
|
-
:
|
|
222
|
-
:
|
|
223
|
-
:
|
|
224
|
-
:
|
|
225
|
-
:
|
|
226
|
-
:
|
|
227
|
-
:
|
|
228
|
-
:
|
|
229
|
-
|
|
230
|
-
"
|
|
231
|
-
"
|
|
232
|
-
"
|
|
233
|
-
"
|
|
234
|
-
"
|
|
235
|
-
"
|
|
236
|
-
"
|
|
237
|
-
"
|
|
238
|
-
|
|
239
|
-
|
|
203
|
+
:AUTO_READ_ONLY => 3,
|
|
204
|
+
:BITMAP => 4,
|
|
205
|
+
:BLOCKS => 5,
|
|
206
|
+
:BYTE_UNIT => 6,
|
|
207
|
+
:CHECK => 7,
|
|
208
|
+
:CHUNK => 8,
|
|
209
|
+
:DELAYED => 9,
|
|
210
|
+
:DISK_STATUS => 10,
|
|
211
|
+
:FINISH => 11,
|
|
212
|
+
:FLOAT => 12,
|
|
213
|
+
:IDENTIFIER => 13,
|
|
214
|
+
:INTEGER => 14,
|
|
215
|
+
:LEVEL => 15,
|
|
216
|
+
:MIN => 16,
|
|
217
|
+
:NONE => 17,
|
|
218
|
+
:PAGES => 18,
|
|
219
|
+
:PERSONALITIES => 19,
|
|
220
|
+
:PERSONALITY => 20,
|
|
221
|
+
:PENDING => 21,
|
|
222
|
+
:PROGRESS => 22,
|
|
223
|
+
:RECOVER => 23,
|
|
224
|
+
:RECOVERY => 24,
|
|
225
|
+
:REMOTE => 25,
|
|
226
|
+
:RESHAPE => 26,
|
|
227
|
+
:RESYNC => 27,
|
|
228
|
+
:SPEED => 28,
|
|
229
|
+
:SPEED_UNIT => 29,
|
|
230
|
+
:SUPER => 30,
|
|
231
|
+
:UNIT => 31,
|
|
232
|
+
:UNUSED_DEVICES => 32,
|
|
233
|
+
"[" => 33,
|
|
234
|
+
"]" => 34,
|
|
235
|
+
":" => 35,
|
|
236
|
+
"/" => 36,
|
|
237
|
+
"(" => 37,
|
|
238
|
+
")" => 38,
|
|
239
|
+
"," => 39,
|
|
240
|
+
"=" => 40,
|
|
241
|
+
"%" => 41 }
|
|
242
|
+
|
|
243
|
+
racc_nt_base = 42
|
|
240
244
|
|
|
241
245
|
racc_use_result_var = true
|
|
242
246
|
|
|
@@ -261,6 +265,7 @@ Racc_token_to_s_table = [
|
|
|
261
265
|
"$end",
|
|
262
266
|
"error",
|
|
263
267
|
"ALGORITHM",
|
|
268
|
+
"AUTO_READ_ONLY",
|
|
264
269
|
"BITMAP",
|
|
265
270
|
"BLOCKS",
|
|
266
271
|
"BYTE_UNIT",
|
|
@@ -294,11 +299,11 @@ Racc_token_to_s_table = [
|
|
|
294
299
|
"\"]\"",
|
|
295
300
|
"\":\"",
|
|
296
301
|
"\"/\"",
|
|
302
|
+
"\"(\"",
|
|
303
|
+
"\")\"",
|
|
297
304
|
"\",\"",
|
|
298
305
|
"\"=\"",
|
|
299
306
|
"\"%\"",
|
|
300
|
-
"\"(\"",
|
|
301
|
-
"\")\"",
|
|
302
307
|
"$start",
|
|
303
308
|
"target",
|
|
304
309
|
"personalities",
|
|
@@ -306,6 +311,7 @@ Racc_token_to_s_table = [
|
|
|
306
311
|
"unused_devices",
|
|
307
312
|
"list_of_personalities",
|
|
308
313
|
"device",
|
|
314
|
+
"auto_read_only",
|
|
309
315
|
"list_of_devices",
|
|
310
316
|
"super",
|
|
311
317
|
"level",
|
|
@@ -350,7 +356,7 @@ module_eval(<<'.,.,', 'mdstat_parser.y', 11)
|
|
|
350
356
|
|
|
351
357
|
module_eval(<<'.,.,', 'mdstat_parser.y', 13)
|
|
352
358
|
def _reduce_7(val, _values, result)
|
|
353
|
-
result = { val[0][:value] => val[
|
|
359
|
+
result = { val[0][:value] => val[16][:value] }
|
|
354
360
|
result
|
|
355
361
|
end
|
|
356
362
|
.,.,
|
|
@@ -405,6 +411,10 @@ module_eval(<<'.,.,', 'mdstat_parser.y', 13)
|
|
|
405
411
|
|
|
406
412
|
# reduce 32 omitted
|
|
407
413
|
|
|
414
|
+
# reduce 33 omitted
|
|
415
|
+
|
|
416
|
+
# reduce 34 omitted
|
|
417
|
+
|
|
408
418
|
def _reduce_none(val, _values, result)
|
|
409
419
|
val[0]
|
|
410
420
|
end
|
|
@@ -7,18 +7,49 @@ require 'riemann/client'
|
|
|
7
7
|
module Riemann
|
|
8
8
|
module Tools
|
|
9
9
|
class RiemannClientWrapper
|
|
10
|
-
|
|
10
|
+
include Singleton
|
|
11
11
|
|
|
12
12
|
BACKOFF_TMIN = 0.5 # Minimum delay between reconnection attempts
|
|
13
13
|
BACKOFF_TMAX = 30.0 # Maximum delay
|
|
14
14
|
BACKOFF_FACTOR = 2
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
# The wrapper manage a single connection to riemann, transport options
|
|
17
|
+
# cannot be adjusted when riemann-wrapper is running, and enqueing events
|
|
18
|
+
# should not happen when the system is tearing down. This is achieved
|
|
19
|
+
# with this simple state machine
|
|
20
|
+
#
|
|
21
|
+
# [idle] --client--> [running] --drain--> [draining]
|
|
22
|
+
# ^ |
|
|
23
|
+
# +-------[#reset (development only)]-------+
|
|
24
|
+
attr_reader :state
|
|
25
|
+
|
|
26
|
+
STATE_IDLE = 1
|
|
27
|
+
STATE_RUNNING = 2
|
|
28
|
+
STATE_DRAINING = 3
|
|
29
|
+
|
|
30
|
+
# These options are transport-related, and SHALL be the same for each
|
|
31
|
+
# tool running in riemann-wrapper. Other options are ignored as far as
|
|
32
|
+
# the wrapper is concerned.
|
|
33
|
+
ALLOWED_OPTIONS = %i[host port timeout tls tls_key tls_cert tls_ca_cert tls_verify tcp tls].freeze
|
|
34
|
+
|
|
35
|
+
attr_reader :options
|
|
36
|
+
|
|
37
|
+
def options=(options)
|
|
38
|
+
if state == STATE_IDLE
|
|
39
|
+
@options = options
|
|
40
|
+
@client = nil
|
|
41
|
+
else
|
|
42
|
+
return if options.slice(*ALLOWED_OPTIONS) == @options.slice(*ALLOWED_OPTIONS)
|
|
18
43
|
|
|
44
|
+
raise 'Cannot change options while running'
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def initialize
|
|
49
|
+
@options = nil
|
|
19
50
|
@queue = Queue.new
|
|
20
51
|
@max_bulk_size = 1000
|
|
21
|
-
@
|
|
52
|
+
@state = STATE_IDLE
|
|
22
53
|
|
|
23
54
|
@worker = Thread.new do
|
|
24
55
|
Thread.current.abort_on_exception = true
|
|
@@ -49,6 +80,8 @@ module Riemann
|
|
|
49
80
|
|
|
50
81
|
def client
|
|
51
82
|
@client ||= begin
|
|
83
|
+
@state = STATE_RUNNING
|
|
84
|
+
|
|
52
85
|
r = Riemann::Client.new(
|
|
53
86
|
host: options[:host],
|
|
54
87
|
port: options[:port],
|
|
@@ -69,15 +102,25 @@ module Riemann
|
|
|
69
102
|
end
|
|
70
103
|
|
|
71
104
|
def <<(event)
|
|
72
|
-
raise('Cannot queue events
|
|
105
|
+
raise('Cannot queue events while draining') if state == STATE_DRAINING
|
|
73
106
|
|
|
74
107
|
@queue << event
|
|
75
108
|
end
|
|
76
109
|
|
|
77
110
|
def drain
|
|
78
|
-
@
|
|
111
|
+
@state = STATE_DRAINING
|
|
79
112
|
sleep(1) until @queue.empty? || @worker.stop?
|
|
80
113
|
end
|
|
114
|
+
|
|
115
|
+
private
|
|
116
|
+
|
|
117
|
+
# For development purpose only: we do not want the singleton to leak
|
|
118
|
+
# state from one test to another.
|
|
119
|
+
def reset
|
|
120
|
+
@options = nil
|
|
121
|
+
@queue.clear
|
|
122
|
+
@state = STATE_IDLE
|
|
123
|
+
end
|
|
81
124
|
end
|
|
82
125
|
end
|
|
83
126
|
end
|
|
@@ -24,7 +24,7 @@ module URI
|
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
module Riemann
|
|
27
|
+
module Riemann # rubocop:disable Style/OneClassPerFile
|
|
28
28
|
module Tools
|
|
29
29
|
class TLSCheck
|
|
30
30
|
include Riemann::Tools
|
|
@@ -202,6 +202,8 @@ module Riemann
|
|
|
202
202
|
description.start_with? 'OCSP'
|
|
203
203
|
end
|
|
204
204
|
|
|
205
|
+
return '' unless ocsp
|
|
206
|
+
|
|
205
207
|
ocsp_uri = URI(ocsp[/URI:(.*)/, 1])
|
|
206
208
|
|
|
207
209
|
http_response = ::Net::HTTP.start(ocsp_uri.hostname, ocsp_uri.port) do |http|
|
|
@@ -478,7 +480,7 @@ module Riemann
|
|
|
478
480
|
capabilities = initial_handshake_packet[5] | (initial_handshake_packet[8] << 16)
|
|
479
481
|
|
|
480
482
|
ssl_flag = 1 << 11
|
|
481
|
-
raise 'No TLS support' if (
|
|
483
|
+
raise 'No TLS support' if capabilities.nobits?(ssl_flag)
|
|
482
484
|
|
|
483
485
|
socket.write(['2000000185ae7f0000000001210000000000000000000000000000000000000000000000'].pack('H*'))
|
|
484
486
|
tls_handshake(socket, uri.host)
|
data/lib/riemann/tools.rb
CHANGED
data/riemann-tools.gemspec
CHANGED
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
|
12
12
|
spec.description = 'Collection of utilities which submit events to Riemann,'
|
|
13
13
|
spec.homepage = 'https://github.com/aphyr/riemann-tools'
|
|
14
14
|
spec.license = 'MIT'
|
|
15
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.
|
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
|
|
16
16
|
|
|
17
17
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org/'
|
|
18
18
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
@@ -38,7 +38,8 @@ Gem::Specification.new do |spec|
|
|
|
38
38
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
39
39
|
spec.require_paths = ['lib']
|
|
40
40
|
|
|
41
|
-
spec.
|
|
42
|
-
spec.
|
|
43
|
-
spec.
|
|
41
|
+
spec.add_dependency 'csv', '~> 3.0'
|
|
42
|
+
spec.add_dependency 'json', '>= 1.8'
|
|
43
|
+
spec.add_dependency 'optimist', '~> 3.0', '>= 3.0.0'
|
|
44
|
+
spec.add_dependency 'riemann-client', '~> 1.1'
|
|
44
45
|
end
|
|
@@ -49,15 +49,15 @@ module Riemann
|
|
|
49
49
|
def health_url
|
|
50
50
|
path_prefix = options[:path_prefix]
|
|
51
51
|
path_prefix[0] = '' if path_prefix[0] == '/'
|
|
52
|
-
path_prefix[
|
|
53
|
-
"http://#{options[:chronos_host]}:#{options[:chronos_port]}#{path_prefix.length.positive?
|
|
52
|
+
path_prefix[-1] = '' if path_prefix[-1] == '/'
|
|
53
|
+
"http://#{options[:chronos_host]}:#{options[:chronos_port]}#{'/' if path_prefix.length.positive?}#{path_prefix}/metrics"
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def jobs_url
|
|
57
57
|
path_prefix = options[:path_prefix]
|
|
58
58
|
path_prefix[0] = '' if path_prefix[0] == '/'
|
|
59
|
-
path_prefix[
|
|
60
|
-
"http://#{options[:chronos_host]}:#{options[:chronos_port]}#{path_prefix.length.positive?
|
|
59
|
+
path_prefix[-1] = '' if path_prefix[-1] == '/'
|
|
60
|
+
"http://#{options[:chronos_host]}:#{options[:chronos_port]}#{'/' if path_prefix.length.positive?}#{path_prefix}/scheduler/jobs"
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
def tick
|