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