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,5 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
Process.setproctitle($PROGRAM_NAME)
|
3
5
|
|
4
6
|
$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../vodpod-common/lib")
|
5
7
|
require 'rubygems'
|
@@ -15,17 +17,17 @@ class RiakStatus
|
|
15
17
|
INTERVAL = 10
|
16
18
|
|
17
19
|
FSM_LIMITS = {
|
18
|
-
:
|
20
|
+
get: {
|
19
21
|
50 => 1000,
|
20
22
|
95 => 2000,
|
21
|
-
99 =>
|
23
|
+
99 => 10_000,
|
22
24
|
},
|
23
|
-
:
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
}
|
28
|
-
}
|
25
|
+
put: {
|
26
|
+
50 => 1000,
|
27
|
+
95 => 2000,
|
28
|
+
99 => 10_000,
|
29
|
+
},
|
30
|
+
}.freeze
|
29
31
|
|
30
32
|
def initialize(opts = {})
|
31
33
|
@host = opts[:host] || `hostname`.chomp
|
@@ -35,15 +37,15 @@ class RiakStatus
|
|
35
37
|
|
36
38
|
def alert(subservice, state, metric, description)
|
37
39
|
Vodpod.alert(
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
40
|
+
service: "riak #{subservice}",
|
41
|
+
state: state,
|
42
|
+
metric: metric,
|
43
|
+
description: description,
|
42
44
|
)
|
43
45
|
end
|
44
46
|
|
45
47
|
def check_ring
|
46
|
-
str =
|
48
|
+
str = %x(#{__dir__}/ringready.erl riak@#{`hostname`}).chomp
|
47
49
|
if str =~ /^TRUE/
|
48
50
|
alert 'ring', :ok, nil, str
|
49
51
|
else
|
@@ -52,7 +54,7 @@ class RiakStatus
|
|
52
54
|
end
|
53
55
|
|
54
56
|
def check_keys
|
55
|
-
keys =
|
57
|
+
keys = %x(#{__dir__}/key_count.erl riak@#{`hostname`}).chomp
|
56
58
|
if keys =~ /^\d+$/
|
57
59
|
alert 'keys', :ok, keys.to_i, keys
|
58
60
|
else
|
@@ -74,9 +76,9 @@ class RiakStatus
|
|
74
76
|
def fsm_state(type, percentile, val)
|
75
77
|
limit = FSM_LIMITS[type][percentile]
|
76
78
|
case val
|
77
|
-
when 0
|
79
|
+
when 0..limit
|
78
80
|
:ok
|
79
|
-
when limit
|
81
|
+
when limit..limit * 2
|
80
82
|
:warning
|
81
83
|
else
|
82
84
|
:critical
|
@@ -88,11 +90,11 @@ class RiakStatus
|
|
88
90
|
res = Net::HTTP.start(@host, @port) do |http|
|
89
91
|
http.get('/stats')
|
90
92
|
end
|
91
|
-
rescue => e
|
93
|
+
rescue StandardError => e
|
92
94
|
Vodpod.alert(
|
93
|
-
:
|
94
|
-
:
|
95
|
-
:
|
95
|
+
service: 'riak',
|
96
|
+
state: :critical,
|
97
|
+
description: "error fetching /stats: #{e.class}, #{e.message}",
|
96
98
|
)
|
97
99
|
return
|
98
100
|
end
|
@@ -101,36 +103,36 @@ class RiakStatus
|
|
101
103
|
stats = JSON.parse(res.body)
|
102
104
|
else
|
103
105
|
Vodpod.alert(
|
104
|
-
:
|
105
|
-
:
|
106
|
-
:
|
106
|
+
service: 'riak',
|
107
|
+
state: :critical,
|
108
|
+
description: "stats returned HTTP #{res.code}:\n\n#{res.body}",
|
107
109
|
)
|
108
110
|
return
|
109
111
|
end
|
110
112
|
|
111
113
|
Vodpod.alert(
|
112
|
-
:
|
113
|
-
:
|
114
|
+
service: 'riak',
|
115
|
+
state: :ok,
|
114
116
|
)
|
115
117
|
|
116
118
|
# Gets/puts/rr
|
117
|
-
[
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
119
|
+
%w[
|
120
|
+
vnode_gets
|
121
|
+
vnode_puts
|
122
|
+
node_gets
|
123
|
+
node_puts
|
124
|
+
read_repairs
|
123
125
|
].each do |s|
|
124
|
-
alert s, :ok, stats[s]/60.0, "#{stats[s]/60.0}/sec"
|
126
|
+
alert s, :ok, stats[s] / 60.0, "#{stats[s] / 60.0}/sec"
|
125
127
|
end
|
126
128
|
|
127
129
|
# FSMs
|
128
|
-
[
|
130
|
+
%i[get put].each do |type|
|
129
131
|
[50, 95, 99].each do |percentile|
|
130
132
|
val = stats[fsm_stat(type, percentile)] || 0
|
131
133
|
val = 0 if val == 'undefined'
|
132
134
|
val /= 1000.0 # Convert us to ms
|
133
|
-
state = fsm_state(type, percentile, val)
|
135
|
+
state = fsm_state(type, percentile, val)
|
134
136
|
alert "#{type} #{percentile}", state, val, "#{val} ms"
|
135
137
|
end
|
136
138
|
end
|
@@ -138,7 +140,7 @@ class RiakStatus
|
|
138
140
|
|
139
141
|
def run
|
140
142
|
loop do
|
141
|
-
# check_keys
|
143
|
+
# check_keys
|
142
144
|
check_stats
|
143
145
|
check_ring
|
144
146
|
check_disk
|
@@ -147,6 +149,4 @@ class RiakStatus
|
|
147
149
|
end
|
148
150
|
end
|
149
151
|
|
150
|
-
if $
|
151
|
-
RiakStatus.new.run
|
152
|
-
end
|
152
|
+
RiakStatus.new.run if $PROGRAM_NAME == __FILE__
|
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.1.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-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -100,6 +100,48 @@ dependencies:
|
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: rubocop
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: rubocop-rake
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: rubocop-rspec
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
103
145
|
description: Collection of utilities which submit events to Riemann,
|
104
146
|
email:
|
105
147
|
- aphyr@aphyr.com
|
@@ -129,9 +171,12 @@ extra_rdoc_files: []
|
|
129
171
|
files:
|
130
172
|
- ".docker/Dockerfile"
|
131
173
|
- ".docker/publish.sh"
|
174
|
+
- ".github/dependabot.yml"
|
132
175
|
- ".github/workflows/ci.yml"
|
176
|
+
- ".github/workflows/codeql-analysis.yml"
|
133
177
|
- ".gitignore"
|
134
178
|
- ".rspec"
|
179
|
+
- ".rubocop.yml"
|
135
180
|
- ".travis.yml"
|
136
181
|
- CHANGELOG.md
|
137
182
|
- Gemfile
|
@@ -139,6 +184,7 @@ files:
|
|
139
184
|
- LICENSE
|
140
185
|
- README.markdown
|
141
186
|
- Rakefile
|
187
|
+
- SECURITY.md
|
142
188
|
- bin/riemann-apache-status
|
143
189
|
- bin/riemann-bench
|
144
190
|
- bin/riemann-cloudant
|
@@ -160,12 +206,15 @@ files:
|
|
160
206
|
- bin/riemann-varnish
|
161
207
|
- bin/riemann-zookeeper
|
162
208
|
- lib/riemann/tools.rb
|
209
|
+
- lib/riemann/tools/health.rb
|
210
|
+
- lib/riemann/tools/net.rb
|
211
|
+
- lib/riemann/tools/ntp.rb
|
163
212
|
- lib/riemann/tools/utils.rb
|
164
213
|
- lib/riemann/tools/version.rb
|
165
214
|
- riemann-tools.gemspec
|
166
215
|
- tools/riemann-aws/LICENSE
|
167
216
|
- tools/riemann-aws/README.md
|
168
|
-
- tools/riemann-aws/Rakefile
|
217
|
+
- tools/riemann-aws/Rakefile
|
169
218
|
- tools/riemann-aws/bin/riemann-aws-billing
|
170
219
|
- tools/riemann-aws/bin/riemann-aws-rds-status
|
171
220
|
- tools/riemann-aws/bin/riemann-aws-sqs-status
|
@@ -175,35 +224,35 @@ files:
|
|
175
224
|
- tools/riemann-aws/bin/riemann-s3-status
|
176
225
|
- tools/riemann-chronos/LICENSE
|
177
226
|
- tools/riemann-chronos/README.md
|
178
|
-
- tools/riemann-chronos/Rakefile
|
227
|
+
- tools/riemann-chronos/Rakefile
|
179
228
|
- tools/riemann-chronos/bin/riemann-chronos
|
180
229
|
- tools/riemann-docker/LICENSE
|
181
230
|
- tools/riemann-docker/README.md
|
182
|
-
- tools/riemann-docker/Rakefile
|
231
|
+
- tools/riemann-docker/Rakefile
|
183
232
|
- tools/riemann-docker/bin/riemann-docker
|
184
233
|
- tools/riemann-elasticsearch/LICENSE
|
185
234
|
- tools/riemann-elasticsearch/README.md
|
186
|
-
- tools/riemann-elasticsearch/Rakefile
|
235
|
+
- tools/riemann-elasticsearch/Rakefile
|
187
236
|
- tools/riemann-elasticsearch/bin/riemann-elasticsearch
|
188
237
|
- tools/riemann-marathon/LICENSE
|
189
238
|
- tools/riemann-marathon/README.md
|
190
|
-
- tools/riemann-marathon/Rakefile
|
239
|
+
- tools/riemann-marathon/Rakefile
|
191
240
|
- tools/riemann-marathon/bin/riemann-marathon
|
192
241
|
- tools/riemann-mesos/LICENSE
|
193
242
|
- tools/riemann-mesos/README.md
|
194
|
-
- tools/riemann-mesos/Rakefile
|
243
|
+
- tools/riemann-mesos/Rakefile
|
195
244
|
- tools/riemann-mesos/bin/riemann-mesos
|
196
245
|
- tools/riemann-munin/LICENSE
|
197
246
|
- tools/riemann-munin/README.md
|
198
|
-
- tools/riemann-munin/Rakefile
|
247
|
+
- tools/riemann-munin/Rakefile
|
199
248
|
- tools/riemann-munin/bin/riemann-munin
|
200
249
|
- tools/riemann-rabbitmq/LICENSE
|
201
250
|
- tools/riemann-rabbitmq/README.md
|
202
|
-
- tools/riemann-rabbitmq/Rakefile
|
251
|
+
- tools/riemann-rabbitmq/Rakefile
|
203
252
|
- tools/riemann-rabbitmq/bin/riemann-rabbitmq
|
204
253
|
- tools/riemann-riak/LICENSE
|
205
254
|
- tools/riemann-riak/README.md
|
206
|
-
- tools/riemann-riak/Rakefile
|
255
|
+
- tools/riemann-riak/Rakefile
|
207
256
|
- tools/riemann-riak/bin/riemann-riak
|
208
257
|
- tools/riemann-riak/bin/riemann-riak-keys
|
209
258
|
- tools/riemann-riak/bin/riemann-riak-ring
|
@@ -218,7 +267,7 @@ metadata:
|
|
218
267
|
homepage_uri: https://github.com/aphyr/riemann-tools
|
219
268
|
source_code_uri: https://github.com/aphyr/riemann-tools
|
220
269
|
changelog_uri: https://github.com/aphyr/riemann-tools
|
221
|
-
post_install_message:
|
270
|
+
post_install_message:
|
222
271
|
rdoc_options: []
|
223
272
|
require_paths:
|
224
273
|
- lib
|
@@ -226,15 +275,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
226
275
|
requirements:
|
227
276
|
- - ">="
|
228
277
|
- !ruby/object:Gem::Version
|
229
|
-
version: 2.
|
278
|
+
version: 2.6.0
|
230
279
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
231
280
|
requirements:
|
232
281
|
- - ">="
|
233
282
|
- !ruby/object:Gem::Version
|
234
283
|
version: '0'
|
235
284
|
requirements: []
|
236
|
-
rubygems_version: 3.
|
237
|
-
signing_key:
|
285
|
+
rubygems_version: 3.3.16
|
286
|
+
signing_key:
|
238
287
|
specification_version: 4
|
239
288
|
summary: Utilities which submit events to Riemann.
|
240
289
|
test_files: []
|