riemann-tools 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +11 -0
- data/.github/workflows/ci.yml +13 -0
- data/.github/workflows/codeql-analysis.yml +72 -0
- data/.rubocop.yml +32 -0
- data/CHANGELOG.md +31 -2
- data/README.markdown +8 -24
- data/Rakefile +4 -2
- data/SECURITY.md +42 -0
- data/bin/riemann-apache-status +92 -78
- data/bin/riemann-bench +54 -49
- data/bin/riemann-cloudant +44 -40
- data/bin/riemann-consul +82 -76
- data/bin/riemann-dir-files-count +53 -47
- data/bin/riemann-dir-space +53 -47
- data/bin/riemann-diskstats +78 -75
- data/bin/riemann-fd +68 -48
- data/bin/riemann-freeswitch +108 -103
- data/bin/riemann-haproxy +46 -40
- data/bin/riemann-health +4 -343
- data/bin/riemann-kvminstance +18 -13
- data/bin/riemann-memcached +35 -29
- data/bin/riemann-net +4 -104
- data/bin/riemann-nginx-status +74 -67
- data/bin/riemann-ntp +4 -33
- data/bin/riemann-portcheck +40 -31
- data/bin/riemann-proc +96 -90
- data/bin/riemann-varnish +51 -45
- data/bin/riemann-zookeeper +38 -34
- data/lib/riemann/tools/health.rb +347 -0
- data/lib/riemann/tools/net.rb +104 -0
- data/lib/riemann/tools/ntp.rb +41 -0
- data/lib/riemann/tools/version.rb +1 -1
- data/lib/riemann/tools.rb +37 -40
- data/riemann-tools.gemspec +4 -1
- data/tools/riemann-aws/{Rakefile.rb → Rakefile} +2 -0
- data/tools/riemann-aws/bin/riemann-aws-billing +72 -66
- data/tools/riemann-aws/bin/riemann-aws-rds-status +55 -41
- data/tools/riemann-aws/bin/riemann-aws-sqs-status +37 -31
- data/tools/riemann-aws/bin/riemann-aws-status +63 -51
- data/tools/riemann-aws/bin/riemann-elb-metrics +149 -148
- data/tools/riemann-aws/bin/riemann-s3-list +70 -65
- data/tools/riemann-aws/bin/riemann-s3-status +85 -82
- data/tools/riemann-chronos/{Rakefile.rb → Rakefile} +2 -0
- data/tools/riemann-chronos/bin/riemann-chronos +136 -119
- data/tools/riemann-docker/{Rakefile.rb → Rakefile} +2 -0
- data/tools/riemann-docker/bin/riemann-docker +163 -174
- data/tools/riemann-elasticsearch/{Rakefile.rb → Rakefile} +2 -0
- data/tools/riemann-elasticsearch/bin/riemann-elasticsearch +155 -147
- data/tools/riemann-marathon/{Rakefile.rb → Rakefile} +2 -0
- data/tools/riemann-marathon/bin/riemann-marathon +138 -122
- data/tools/riemann-mesos/{Rakefile.rb → Rakefile} +2 -0
- data/tools/riemann-mesos/bin/riemann-mesos +125 -110
- data/tools/riemann-munin/{Rakefile.rb → Rakefile} +2 -0
- data/tools/riemann-munin/bin/riemann-munin +28 -22
- data/tools/riemann-rabbitmq/{Rakefile.rb → Rakefile} +2 -0
- data/tools/riemann-rabbitmq/bin/riemann-rabbitmq +226 -222
- data/tools/riemann-riak/{Rakefile.rb → Rakefile} +2 -0
- data/tools/riemann-riak/bin/riemann-riak +281 -289
- data/tools/riemann-riak/riak_status/riak_status.rb +39 -39
- metadata +65 -16
@@ -1,330 +1,322 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'English'
|
5
|
+
Process.setproctitle($PROGRAM_NAME)
|
3
6
|
|
4
7
|
# Forwards information on a Riak node to Riemann.
|
5
8
|
|
6
9
|
require 'riemann/tools'
|
7
10
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
@httpstatus = false
|
48
|
-
end
|
49
|
-
|
50
|
-
# we're going to override the emulator setting to allow users to
|
51
|
-
# dynamically input the cookie
|
52
|
-
# this is done only once - hopefully it doesn't get overridden.
|
53
|
-
ENV['ERL_AFLAGS'] = "-setcookie #{opts[:cookie]}"
|
54
|
-
end
|
11
|
+
module Riemann
|
12
|
+
module Tools
|
13
|
+
class Riak
|
14
|
+
include Riemann::Tools
|
15
|
+
require 'net/http'
|
16
|
+
require 'net/https'
|
17
|
+
require 'yajl/json_gem'
|
18
|
+
|
19
|
+
opt :riak_host, 'Riak host for stats <IP> or SSL http(s)://<IP>', default: Socket.gethostname
|
20
|
+
opt :data_dir, 'Riak data directory', default: '/var/lib/riak'
|
21
|
+
opt :stats_port, 'Riak HTTP port for stats', default: 8098
|
22
|
+
opt :stats_path, 'Riak HTTP stats path', default: '/stats'
|
23
|
+
opt :node_name, 'Riak erlang node name', default: "riak@#{Socket.gethostname}"
|
24
|
+
opt :cookie, 'Riak cookie to use', default: 'riak'
|
25
|
+
|
26
|
+
opt :get_50_warning, 'FSM 50% get time warning threshold (ms)', default: 1000
|
27
|
+
opt :put_50_warning, 'FSM 50% put time warning threshold (ms)', default: 1000
|
28
|
+
opt :get_95_warning, 'FSM 95% get time warning threshold (ms)', default: 2000
|
29
|
+
opt :put_95_warning, 'FSM 95% put time warning threshold (ms)', default: 2000
|
30
|
+
opt :get_99_warning, 'FSM 99% get time warning threshold (ms)', default: 10_000
|
31
|
+
opt :put_99_warning, 'FSM 99% put time warning threshold (ms)', default: 10_000
|
32
|
+
|
33
|
+
def initialize
|
34
|
+
detect_features
|
35
|
+
|
36
|
+
@httpstatus = true
|
37
|
+
|
38
|
+
begin
|
39
|
+
uri = URI.parse(opts[:riak_host])
|
40
|
+
uri.host = opts[:riak_host] if uri.host.nil?
|
41
|
+
http = Net::HTTP.new(uri.host, opts[:stats_port])
|
42
|
+
http.use_ssl = uri.scheme == 'https'
|
43
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if http.use_ssl?
|
44
|
+
http.start do |h|
|
45
|
+
h.get opts[:stats_path]
|
46
|
+
end
|
47
|
+
rescue StandardError => _e
|
48
|
+
@httpstatus = false
|
49
|
+
end
|
55
50
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
51
|
+
# we're going to override the emulator setting to allow users to
|
52
|
+
# dynamically input the cookie
|
53
|
+
# this is done only once - hopefully it doesn't get overridden.
|
54
|
+
ENV['ERL_AFLAGS'] = "-setcookie #{opts[:cookie]}"
|
55
|
+
end
|
60
56
|
|
61
|
-
|
62
|
-
|
63
|
-
|
57
|
+
# Identifies whether escript and riak-admin are installed
|
58
|
+
def detect_features
|
59
|
+
@escript = true # Whether escript is present on this machine
|
60
|
+
@riakadmin = true # Whether riak-admin is present
|
64
61
|
|
65
|
-
|
66
|
-
@riakadmin = false
|
67
|
-
end
|
68
|
-
end
|
62
|
+
@escript = false if `which escript` =~ /^\s*$/
|
69
63
|
|
70
|
-
|
71
|
-
|
72
|
-
str = `#{File.expand_path(File.dirname(__FILE__))}/riemann-riak-ring #{opts[:node_name]}`.chomp
|
73
|
-
elsif @riakadmin
|
74
|
-
str = `riak-admin ringready`
|
75
|
-
else
|
76
|
-
nil
|
77
|
-
end
|
64
|
+
@riakadmin = false if `which riak-admin` =~ /^\s*$/
|
65
|
+
end
|
78
66
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
:state => 'ok',
|
86
|
-
:description => str
|
87
|
-
)
|
88
|
-
else
|
89
|
-
report(
|
90
|
-
:host => opts[:riak_host],
|
91
|
-
:service => 'riak ring',
|
92
|
-
:state => 'warning',
|
93
|
-
:description => str
|
94
|
-
)
|
95
|
-
end
|
96
|
-
end
|
67
|
+
def check_ring
|
68
|
+
str = if @escript
|
69
|
+
`#{__dir__}/riemann-riak-ring #{opts[:node_name]}`.chomp
|
70
|
+
elsif @riakadmin
|
71
|
+
`riak-admin ringready`
|
72
|
+
end
|
97
73
|
|
98
|
-
|
99
|
-
keys = `#{File.expand_path(File.dirname(__FILE__))}/riemann-riak-keys #{opts[:node_name]}`.chomp
|
100
|
-
if keys =~ /^\d+$/
|
101
|
-
report(
|
102
|
-
:host => opts[:riak_host],
|
103
|
-
:service => 'riak keys',
|
104
|
-
:state => 'ok',
|
105
|
-
:metric => keys.to_i,
|
106
|
-
:description => keys
|
107
|
-
)
|
108
|
-
else
|
109
|
-
report(
|
110
|
-
:host => opts[:riak_host],
|
111
|
-
:service => 'riak keys',
|
112
|
-
:state => 'unknown',
|
113
|
-
:description => keys
|
114
|
-
)
|
115
|
-
end
|
116
|
-
end
|
74
|
+
return if str.nil?
|
117
75
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
76
|
+
if str =~ /^TRUE/
|
77
|
+
report(
|
78
|
+
host: opts[:riak_host],
|
79
|
+
service: 'riak ring',
|
80
|
+
state: 'ok',
|
81
|
+
description: str,
|
82
|
+
)
|
83
|
+
else
|
84
|
+
report(
|
85
|
+
host: opts[:riak_host],
|
86
|
+
service: 'riak ring',
|
87
|
+
state: 'warning',
|
88
|
+
description: str,
|
89
|
+
)
|
90
|
+
end
|
91
|
+
end
|
124
92
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
end
|
93
|
+
def check_keys
|
94
|
+
keys = `#{__dir__}/riemann-riak-keys #{opts[:node_name]}`.chomp
|
95
|
+
if keys =~ /^\d+$/
|
96
|
+
report(
|
97
|
+
host: opts[:riak_host],
|
98
|
+
service: 'riak keys',
|
99
|
+
state: 'ok',
|
100
|
+
metric: keys.to_i,
|
101
|
+
description: keys,
|
102
|
+
)
|
103
|
+
else
|
104
|
+
report(
|
105
|
+
host: opts[:riak_host],
|
106
|
+
service: 'riak keys',
|
107
|
+
state: 'unknown',
|
108
|
+
description: keys,
|
109
|
+
)
|
110
|
+
end
|
111
|
+
end
|
145
112
|
|
146
|
-
|
147
|
-
|
148
|
-
report(
|
149
|
-
:host => opts[:riak_host],
|
150
|
-
:service => 'riak disk',
|
151
|
-
:state => 'ok',
|
152
|
-
:metric => gb,
|
153
|
-
:description => "#{gb} GB in #{opts[:data_dir]}"
|
154
|
-
)
|
155
|
-
end
|
113
|
+
def check_transfers
|
114
|
+
str = (`riak-admin transfers` if @riakadmin)
|
156
115
|
|
157
|
-
|
158
|
-
def fsm_stat(type, property, percentile)
|
159
|
-
"node_#{type}_fsm_#{property}_#{percentile == 50 ? 'median' : percentile}"
|
160
|
-
end
|
116
|
+
return if str.nil?
|
161
117
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
118
|
+
if str =~ /'#{opts[:node_name]}' waiting to handoff (\d+) partitions/
|
119
|
+
report(
|
120
|
+
host: opts[:riak_host],
|
121
|
+
service: 'riak transfers',
|
122
|
+
state: 'critical',
|
123
|
+
metric: Regexp.last_match(1).to_i,
|
124
|
+
description: "waiting to handoff #{Regexp.last_match(1)} partitions",
|
125
|
+
)
|
126
|
+
else
|
127
|
+
report(
|
128
|
+
host: opts[:riak_host],
|
129
|
+
service: 'riak transfers',
|
130
|
+
state: 'ok',
|
131
|
+
metric: 0,
|
132
|
+
description: 'No pending transfers',
|
133
|
+
)
|
134
|
+
end
|
135
|
+
end
|
174
136
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
137
|
+
def check_disk
|
138
|
+
gb = `du -Ls #{opts[:data_dir]}`.split(/\s+/).first.to_i / (1024.0**2)
|
139
|
+
report(
|
140
|
+
host: opts[:riak_host],
|
141
|
+
service: 'riak disk',
|
142
|
+
state: 'ok',
|
143
|
+
metric: gb,
|
144
|
+
description: "#{gb} GB in #{opts[:data_dir]}",
|
145
|
+
)
|
181
146
|
end
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
147
|
+
|
148
|
+
# Returns the riak stat for the given fsm type and percentile.
|
149
|
+
def fsm_stat(type, property, percentile)
|
150
|
+
"node_#{type}_fsm_#{property}_#{percentile == 50 ? 'median' : percentile}"
|
186
151
|
end
|
187
|
-
|
188
|
-
|
152
|
+
|
153
|
+
# Returns the alerts state for the given fsm.
|
154
|
+
def fsm_state(type, percentile, val)
|
155
|
+
limit = opts["#{type}_#{percentile}_warning".to_sym]
|
156
|
+
case val
|
157
|
+
when 0..limit
|
158
|
+
'ok'
|
159
|
+
when limit..limit * 2
|
160
|
+
'warning'
|
161
|
+
else
|
162
|
+
'critical'
|
163
|
+
end
|
189
164
|
end
|
190
|
-
rescue => e
|
191
|
-
report(
|
192
|
-
:host => opts[:riak_host],
|
193
|
-
:service => 'riak',
|
194
|
-
:state => 'critical',
|
195
|
-
:description => "error fetching #{opts[:riak_host]}:#{opts[:stats_port]} #{e.class}, #{e.message}"
|
196
|
-
)
|
197
|
-
raise
|
198
|
-
end
|
199
165
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
166
|
+
# Get current stats via HTTP
|
167
|
+
def stats_http
|
168
|
+
begin
|
169
|
+
uri = URI.parse(opts[:riak_host])
|
170
|
+
uri.host = opts[:riak_host] if uri.host.nil?
|
171
|
+
http = Net::HTTP.new(uri.host, opts[:stats_port])
|
172
|
+
http.use_ssl = uri.scheme == 'https'
|
173
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if http.use_ssl?
|
174
|
+
res = http.start do |h|
|
175
|
+
h.get opts[:stats_path]
|
176
|
+
end
|
177
|
+
rescue StandardError => e
|
178
|
+
report(
|
179
|
+
host: opts[:riak_host],
|
180
|
+
service: 'riak',
|
181
|
+
state: 'critical',
|
182
|
+
description: "error fetching #{opts[:riak_host]}:#{opts[:stats_port]} #{e.class}, #{e.message}",
|
183
|
+
)
|
184
|
+
raise
|
185
|
+
end
|
212
186
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
187
|
+
if res.code.to_i == 200
|
188
|
+
JSON.parse(res.body)
|
189
|
+
else
|
190
|
+
report(
|
191
|
+
host: opts[:riak_host],
|
192
|
+
service: 'riak',
|
193
|
+
state: 'critical',
|
194
|
+
description: "stats returned HTTP #{res.code}:\n\n#{res.body}",
|
195
|
+
)
|
196
|
+
raise "Can't fetch stats via HTTP: #{res.core}:\n\n#{res.body}"
|
197
|
+
end
|
198
|
+
end
|
219
199
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
elsif @riakadmin
|
225
|
-
stats_riak_admin
|
226
|
-
else
|
227
|
-
report(
|
228
|
-
:host => opts[:riak_host],
|
229
|
-
:service => 'riak',
|
230
|
-
:state => 'critical',
|
231
|
-
:description => "No mechanism for fetching Riak stats: neither HTTP nor riak-admin available."
|
232
|
-
)
|
233
|
-
raise "No mechanism for fetching Riak stats: neither HTTP nor riak-admin available."
|
234
|
-
end
|
235
|
-
end
|
200
|
+
# Get current stats via riak-admin
|
201
|
+
def stats_riak_admin
|
202
|
+
str = `riak-admin status`
|
203
|
+
raise 'riak-admin failed' unless $CHILD_STATUS == 0
|
236
204
|
|
237
|
-
|
238
|
-
|
239
|
-
'vnode_puts',
|
240
|
-
'node_gets',
|
241
|
-
'node_puts',
|
242
|
-
'node_gets_set',
|
243
|
-
'node_puts_set',
|
244
|
-
'read_repairs']
|
245
|
-
end
|
205
|
+
Hash[str.split(/\n/).map { |i| i.split(/ : /) }]
|
206
|
+
end
|
246
207
|
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
208
|
+
# Get current stats as a hash
|
209
|
+
def stats
|
210
|
+
if @httpstatus
|
211
|
+
stats_http
|
212
|
+
elsif @riakadmin
|
213
|
+
stats_riak_admin
|
214
|
+
else
|
215
|
+
report(
|
216
|
+
host: opts[:riak_host],
|
217
|
+
service: 'riak',
|
218
|
+
state: 'critical',
|
219
|
+
description: 'No mechanism for fetching Riak stats: neither HTTP nor riak-admin available.',
|
220
|
+
)
|
221
|
+
raise 'No mechanism for fetching Riak stats: neither HTTP nor riak-admin available.'
|
222
|
+
end
|
223
|
+
end
|
251
224
|
|
252
|
-
|
253
|
-
|
254
|
-
|
225
|
+
def core_services
|
226
|
+
%w[vnode_gets
|
227
|
+
vnode_puts
|
228
|
+
node_gets
|
229
|
+
node_puts
|
230
|
+
node_gets_set
|
231
|
+
node_puts_set
|
232
|
+
read_repairs]
|
233
|
+
end
|
255
234
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
stats = self.stats
|
260
|
-
rescue => e
|
261
|
-
event = {:state => 'critical',
|
262
|
-
:description => e.message,
|
263
|
-
:host => opts[:riak_host]}
|
264
|
-
# Report errors
|
265
|
-
report(event.merge(:service => 'riak'))
|
266
|
-
core_services.each do |s|
|
267
|
-
report(event.merge(:service => "riak #{s}"))
|
235
|
+
def fsm_types
|
236
|
+
[{ 'get' => 'time' }, { 'put' => 'time' },
|
237
|
+
{ 'get' => 'set_objsize' },]
|
268
238
|
end
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
239
|
+
|
240
|
+
def fsm_percentiles
|
241
|
+
[50, 95, 99]
|
242
|
+
end
|
243
|
+
|
244
|
+
# Reports current stats to Riemann
|
245
|
+
def check_stats
|
246
|
+
begin
|
247
|
+
stats = self.stats
|
248
|
+
rescue StandardError => e
|
249
|
+
event = {
|
250
|
+
state: 'critical',
|
251
|
+
description: e.message,
|
252
|
+
host: opts[:riak_host],
|
253
|
+
}
|
254
|
+
# Report errors
|
255
|
+
report(event.merge(service: 'riak'))
|
256
|
+
core_services.each do |s|
|
257
|
+
report(event.merge(service: "riak #{s}"))
|
273
258
|
end
|
259
|
+
fsm_types.each do |typespec|
|
260
|
+
typespec.each do |type, prop|
|
261
|
+
fsm_percentiles.each do |percentile|
|
262
|
+
report(event.merge(service: "riak #{type} #{prop} #{percentile}"))
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
return
|
274
267
|
end
|
275
|
-
end
|
276
|
-
return
|
277
|
-
end
|
278
268
|
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
# Gets/puts/rr
|
287
|
-
core_services.each do |s|
|
288
|
-
report(
|
289
|
-
:host => opts[:riak_host],
|
290
|
-
:service => "riak #{s}",
|
291
|
-
:state => 'ok',
|
292
|
-
:metric => stats[s].to_i/60.0,
|
293
|
-
:description => "#{stats[s].to_i/60.0}/sec"
|
294
|
-
)
|
295
|
-
end
|
269
|
+
# Riak itself
|
270
|
+
report(
|
271
|
+
host: opts[:riak_host],
|
272
|
+
service: 'riak',
|
273
|
+
state: 'ok',
|
274
|
+
)
|
296
275
|
|
297
|
-
|
298
|
-
|
299
|
-
typespec.each do |type, prop|
|
300
|
-
fsm_percentiles.each do |percentile|
|
301
|
-
val = stats[fsm_stat(type, prop, percentile)].to_i || 0
|
302
|
-
val = 0 if val == 'undefined'
|
303
|
-
val /= 1000.0 if prop == 'time' # Convert us to ms
|
304
|
-
if prop == 'time'
|
305
|
-
state = fsm_state(type, percentile, val)
|
306
|
-
else
|
307
|
-
state = "ok"
|
308
|
-
end
|
276
|
+
# Gets/puts/rr
|
277
|
+
core_services.each do |s|
|
309
278
|
report(
|
310
|
-
:
|
311
|
-
:
|
312
|
-
:
|
313
|
-
:
|
314
|
-
:
|
279
|
+
host: opts[:riak_host],
|
280
|
+
service: "riak #{s}",
|
281
|
+
state: 'ok',
|
282
|
+
metric: stats[s].to_i / 60.0,
|
283
|
+
description: "#{stats[s].to_i / 60.0}/sec",
|
315
284
|
)
|
316
285
|
end
|
286
|
+
|
287
|
+
# FSMs
|
288
|
+
fsm_types.each do |typespec|
|
289
|
+
typespec.each do |type, prop|
|
290
|
+
fsm_percentiles.each do |percentile|
|
291
|
+
val = stats[fsm_stat(type, prop, percentile)].to_i || 0
|
292
|
+
val = 0 if val == 'undefined'
|
293
|
+
val /= 1000.0 if prop == 'time' # Convert us to ms
|
294
|
+
state = if prop == 'time'
|
295
|
+
fsm_state(type, percentile, val)
|
296
|
+
else
|
297
|
+
'ok'
|
298
|
+
end
|
299
|
+
report(
|
300
|
+
host: opts[:riak_host],
|
301
|
+
service: "riak #{type} #{prop} #{percentile}",
|
302
|
+
state: state,
|
303
|
+
metric: val,
|
304
|
+
description: "#{val} ms",
|
305
|
+
)
|
306
|
+
end
|
307
|
+
end
|
308
|
+
end
|
317
309
|
end
|
318
|
-
end
|
319
|
-
end
|
320
310
|
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
311
|
+
def tick
|
312
|
+
# This can utterly destroy a cluster, so we disable
|
313
|
+
# check_keys
|
314
|
+
check_stats
|
315
|
+
check_ring
|
316
|
+
check_disk
|
317
|
+
check_transfers
|
318
|
+
end
|
319
|
+
end
|
328
320
|
end
|
329
321
|
end
|
330
322
|
|