riemann-tools 0.2.11 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.docker/Dockerfile +7 -0
- data/.docker/publish.sh +35 -0
- data/.github/workflows/ci.yml +29 -0
- data/.gitignore +6 -0
- data/.rspec +2 -0
- data/.travis.yml +31 -0
- data/CHANGELOG.md +393 -0
- data/Gemfile +6 -0
- data/ISSUE_TEMPLATE.md +15 -0
- data/README.markdown +17 -1
- data/Rakefile +21 -0
- data/bin/riemann-apache-status +1 -0
- data/bin/riemann-bench +1 -0
- data/bin/riemann-cloudant +1 -0
- data/bin/riemann-consul +3 -2
- data/bin/riemann-dir-files-count +1 -0
- data/bin/riemann-dir-space +1 -0
- data/bin/riemann-diskstats +1 -0
- data/bin/riemann-fd +1 -0
- data/bin/riemann-freeswitch +1 -0
- data/bin/riemann-haproxy +1 -0
- data/bin/riemann-health +87 -10
- data/bin/riemann-kvminstance +1 -0
- data/bin/riemann-memcached +1 -0
- data/bin/riemann-net +3 -2
- data/bin/riemann-nginx-status +1 -0
- data/bin/riemann-ntp +1 -0
- data/bin/riemann-portcheck +42 -0
- data/bin/riemann-proc +2 -1
- data/bin/riemann-varnish +1 -0
- data/bin/riemann-zookeeper +1 -0
- data/lib/riemann/tools/utils.rb +17 -0
- data/lib/riemann/tools/version.rb +7 -0
- data/lib/riemann/tools.rb +15 -5
- data/riemann-tools.gemspec +39 -0
- data/tools/riemann-aws/LICENSE +21 -0
- data/tools/riemann-aws/README.md +54 -0
- data/tools/riemann-aws/Rakefile.rb +35 -0
- data/tools/riemann-aws/bin/riemann-aws-billing +87 -0
- data/tools/riemann-aws/bin/riemann-aws-rds-status +54 -0
- data/tools/riemann-aws/bin/riemann-aws-sqs-status +44 -0
- data/tools/riemann-aws/bin/riemann-aws-status +71 -0
- data/tools/riemann-aws/bin/riemann-elb-metrics +167 -0
- data/tools/riemann-aws/bin/riemann-s3-list +82 -0
- data/tools/riemann-aws/bin/riemann-s3-status +99 -0
- data/tools/riemann-chronos/LICENSE +21 -0
- data/tools/riemann-chronos/README.md +10 -0
- data/tools/riemann-chronos/Rakefile.rb +35 -0
- data/tools/riemann-chronos/bin/riemann-chronos +144 -0
- data/tools/riemann-docker/LICENSE +21 -0
- data/tools/riemann-docker/README.md +10 -0
- data/tools/riemann-docker/Rakefile.rb +34 -0
- data/tools/riemann-docker/bin/riemann-docker +217 -0
- data/tools/riemann-elasticsearch/LICENSE +21 -0
- data/tools/riemann-elasticsearch/README.md +10 -0
- data/tools/riemann-elasticsearch/Rakefile.rb +35 -0
- data/tools/riemann-elasticsearch/bin/riemann-elasticsearch +166 -0
- data/tools/riemann-marathon/LICENSE +21 -0
- data/tools/riemann-marathon/README.md +10 -0
- data/tools/riemann-marathon/Rakefile.rb +35 -0
- data/tools/riemann-marathon/bin/riemann-marathon +147 -0
- data/tools/riemann-mesos/LICENSE +21 -0
- data/tools/riemann-mesos/README.md +10 -0
- data/tools/riemann-mesos/Rakefile.rb +35 -0
- data/tools/riemann-mesos/bin/riemann-mesos +131 -0
- data/tools/riemann-munin/LICENSE +21 -0
- data/tools/riemann-munin/README.md +10 -0
- data/tools/riemann-munin/Rakefile.rb +34 -0
- data/tools/riemann-munin/bin/riemann-munin +37 -0
- data/tools/riemann-rabbitmq/LICENSE +21 -0
- data/tools/riemann-rabbitmq/README.md +10 -0
- data/tools/riemann-rabbitmq/Rakefile.rb +35 -0
- data/tools/riemann-rabbitmq/bin/riemann-rabbitmq +269 -0
- data/tools/riemann-riak/LICENSE +21 -0
- data/tools/riemann-riak/README.md +10 -0
- data/tools/riemann-riak/Rakefile.rb +34 -0
- data/tools/riemann-riak/bin/riemann-riak +331 -0
- data/tools/riemann-riak/bin/riemann-riak-keys +13 -0
- data/tools/riemann-riak/bin/riemann-riak-ring +9 -0
- data/tools/riemann-riak/riak_status/key_count.erl +13 -0
- data/tools/riemann-riak/riak_status/riak_status.rb +152 -0
- data/tools/riemann-riak/riak_status/ringready.erl +9 -0
- metadata +130 -16
@@ -0,0 +1,152 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
Process.setproctitle($0)
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../vodpod-common/lib")
|
5
|
+
require 'rubygems'
|
6
|
+
require 'vodpod-common'
|
7
|
+
require 'vodpod/alerts'
|
8
|
+
require 'vodpod/starling'
|
9
|
+
require 'net/http'
|
10
|
+
require 'yajl/json_gem'
|
11
|
+
|
12
|
+
class RiakStatus
|
13
|
+
PORT = 8098
|
14
|
+
PATH = '/stats'
|
15
|
+
INTERVAL = 10
|
16
|
+
|
17
|
+
FSM_LIMITS = {
|
18
|
+
:get => {
|
19
|
+
50 => 1000,
|
20
|
+
95 => 2000,
|
21
|
+
99 => 10000
|
22
|
+
},
|
23
|
+
:put => {
|
24
|
+
50 => 1000,
|
25
|
+
95 => 2000,
|
26
|
+
99 => 10000
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
def initialize(opts = {})
|
31
|
+
@host = opts[:host] || `hostname`.chomp
|
32
|
+
@port = opts[:port] || PORT
|
33
|
+
@path = opts[:path] || PATH
|
34
|
+
end
|
35
|
+
|
36
|
+
def alert(subservice, state, metric, description)
|
37
|
+
Vodpod.alert(
|
38
|
+
:service => "riak #{subservice}",
|
39
|
+
:state => state,
|
40
|
+
:metric => metric,
|
41
|
+
:description => description
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
def check_ring
|
46
|
+
str = `#{File.expand_path(File.dirname(__FILE__))}/ringready.erl riak@#{`hostname`}`.chomp
|
47
|
+
if str =~ /^TRUE/
|
48
|
+
alert 'ring', :ok, nil, str
|
49
|
+
else
|
50
|
+
alert 'ring', :warning, nil, str
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def check_keys
|
55
|
+
keys = `#{File.expand_path(File.dirname(__FILE__))}/key_count.erl riak@#{`hostname`}`.chomp
|
56
|
+
if keys =~ /^\d+$/
|
57
|
+
alert 'keys', :ok, keys.to_i, keys
|
58
|
+
else
|
59
|
+
alert 'keys', :error, nil, keys
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def check_disk
|
64
|
+
gb = `du -s /var/lib/riak/bitcask/`.split(/\s+/).first.to_i / (1024.0**2)
|
65
|
+
alert 'disk', :ok, gb, "#{gb} GB in bitcask"
|
66
|
+
end
|
67
|
+
|
68
|
+
# Returns the riak stat for the given fsm type and percentile.
|
69
|
+
def fsm_stat(type, percentile)
|
70
|
+
"node_#{type}_fsm_time_#{percentile == 50 ? 'median' : percentile}"
|
71
|
+
end
|
72
|
+
|
73
|
+
# Returns the alerts state for the given fsm.
|
74
|
+
def fsm_state(type, percentile, val)
|
75
|
+
limit = FSM_LIMITS[type][percentile]
|
76
|
+
case val
|
77
|
+
when 0 .. limit
|
78
|
+
:ok
|
79
|
+
when limit .. limit * 2
|
80
|
+
:warning
|
81
|
+
else
|
82
|
+
:critical
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def check_stats
|
87
|
+
begin
|
88
|
+
res = Net::HTTP.start(@host, @port) do |http|
|
89
|
+
http.get('/stats')
|
90
|
+
end
|
91
|
+
rescue => e
|
92
|
+
Vodpod.alert(
|
93
|
+
:service => 'riak',
|
94
|
+
:state => :critical,
|
95
|
+
:description => "error fetching /stats: #{e.class}, #{e.message}"
|
96
|
+
)
|
97
|
+
return
|
98
|
+
end
|
99
|
+
|
100
|
+
if res.code.to_i == 200
|
101
|
+
stats = JSON.parse(res.body)
|
102
|
+
else
|
103
|
+
Vodpod.alert(
|
104
|
+
:service => 'riak',
|
105
|
+
:state => :critical,
|
106
|
+
:description => "stats returned HTTP #{res.code}:\n\n#{res.body}"
|
107
|
+
)
|
108
|
+
return
|
109
|
+
end
|
110
|
+
|
111
|
+
Vodpod.alert(
|
112
|
+
:service => 'riak',
|
113
|
+
:state => :ok
|
114
|
+
)
|
115
|
+
|
116
|
+
# Gets/puts/rr
|
117
|
+
[
|
118
|
+
'vnode_gets',
|
119
|
+
'vnode_puts',
|
120
|
+
'node_gets',
|
121
|
+
'node_puts',
|
122
|
+
'read_repairs'
|
123
|
+
].each do |s|
|
124
|
+
alert s, :ok, stats[s]/60.0, "#{stats[s]/60.0}/sec"
|
125
|
+
end
|
126
|
+
|
127
|
+
# FSMs
|
128
|
+
[:get, :put].each do |type|
|
129
|
+
[50, 95, 99].each do |percentile|
|
130
|
+
val = stats[fsm_stat(type, percentile)] || 0
|
131
|
+
val = 0 if val == 'undefined'
|
132
|
+
val /= 1000.0 # Convert us to ms
|
133
|
+
state = fsm_state(type, percentile, val)
|
134
|
+
alert "#{type} #{percentile}", state, val, "#{val} ms"
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def run
|
140
|
+
loop do
|
141
|
+
# check_keys
|
142
|
+
check_stats
|
143
|
+
check_ring
|
144
|
+
check_disk
|
145
|
+
sleep INTERVAL
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
if $0 == __FILE__
|
151
|
+
RiakStatus.new.run
|
152
|
+
end
|
metadata
CHANGED
@@ -1,59 +1,108 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riemann-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Kingsbury
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '1.8'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '1.8'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: optimist
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
31
34
|
- - ">="
|
32
35
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
36
|
+
version: 3.0.0
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '3.0'
|
38
44
|
- - ">="
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
46
|
+
version: 3.0.0
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
48
|
+
name: riemann-client
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: github_changelog_generator
|
43
63
|
requirement: !ruby/object:Gem::Requirement
|
44
64
|
requirements:
|
45
65
|
- - ">="
|
46
66
|
- !ruby/object:Gem::Version
|
47
67
|
version: '0'
|
48
|
-
type: :
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rake
|
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'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: rspec
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :development
|
49
97
|
prerelease: false
|
50
98
|
version_requirements: !ruby/object:Gem::Requirement
|
51
99
|
requirements:
|
52
100
|
- - ">="
|
53
101
|
- !ruby/object:Gem::Version
|
54
102
|
version: '0'
|
55
|
-
description:
|
56
|
-
email:
|
103
|
+
description: Collection of utilities which submit events to Riemann,
|
104
|
+
email:
|
105
|
+
- aphyr@aphyr.com
|
57
106
|
executables:
|
58
107
|
- riemann-apache-status
|
59
108
|
- riemann-bench
|
@@ -71,14 +120,25 @@ executables:
|
|
71
120
|
- riemann-net
|
72
121
|
- riemann-nginx-status
|
73
122
|
- riemann-ntp
|
123
|
+
- riemann-portcheck
|
74
124
|
- riemann-proc
|
75
125
|
- riemann-varnish
|
76
126
|
- riemann-zookeeper
|
77
127
|
extensions: []
|
78
128
|
extra_rdoc_files: []
|
79
129
|
files:
|
130
|
+
- ".docker/Dockerfile"
|
131
|
+
- ".docker/publish.sh"
|
132
|
+
- ".github/workflows/ci.yml"
|
133
|
+
- ".gitignore"
|
134
|
+
- ".rspec"
|
135
|
+
- ".travis.yml"
|
136
|
+
- CHANGELOG.md
|
137
|
+
- Gemfile
|
138
|
+
- ISSUE_TEMPLATE.md
|
80
139
|
- LICENSE
|
81
140
|
- README.markdown
|
141
|
+
- Rakefile
|
82
142
|
- bin/riemann-apache-status
|
83
143
|
- bin/riemann-bench
|
84
144
|
- bin/riemann-cloudant
|
@@ -95,14 +155,69 @@ files:
|
|
95
155
|
- bin/riemann-net
|
96
156
|
- bin/riemann-nginx-status
|
97
157
|
- bin/riemann-ntp
|
158
|
+
- bin/riemann-portcheck
|
98
159
|
- bin/riemann-proc
|
99
160
|
- bin/riemann-varnish
|
100
161
|
- bin/riemann-zookeeper
|
101
162
|
- lib/riemann/tools.rb
|
163
|
+
- lib/riemann/tools/utils.rb
|
164
|
+
- lib/riemann/tools/version.rb
|
165
|
+
- riemann-tools.gemspec
|
166
|
+
- tools/riemann-aws/LICENSE
|
167
|
+
- tools/riemann-aws/README.md
|
168
|
+
- tools/riemann-aws/Rakefile.rb
|
169
|
+
- tools/riemann-aws/bin/riemann-aws-billing
|
170
|
+
- tools/riemann-aws/bin/riemann-aws-rds-status
|
171
|
+
- tools/riemann-aws/bin/riemann-aws-sqs-status
|
172
|
+
- tools/riemann-aws/bin/riemann-aws-status
|
173
|
+
- tools/riemann-aws/bin/riemann-elb-metrics
|
174
|
+
- tools/riemann-aws/bin/riemann-s3-list
|
175
|
+
- tools/riemann-aws/bin/riemann-s3-status
|
176
|
+
- tools/riemann-chronos/LICENSE
|
177
|
+
- tools/riemann-chronos/README.md
|
178
|
+
- tools/riemann-chronos/Rakefile.rb
|
179
|
+
- tools/riemann-chronos/bin/riemann-chronos
|
180
|
+
- tools/riemann-docker/LICENSE
|
181
|
+
- tools/riemann-docker/README.md
|
182
|
+
- tools/riemann-docker/Rakefile.rb
|
183
|
+
- tools/riemann-docker/bin/riemann-docker
|
184
|
+
- tools/riemann-elasticsearch/LICENSE
|
185
|
+
- tools/riemann-elasticsearch/README.md
|
186
|
+
- tools/riemann-elasticsearch/Rakefile.rb
|
187
|
+
- tools/riemann-elasticsearch/bin/riemann-elasticsearch
|
188
|
+
- tools/riemann-marathon/LICENSE
|
189
|
+
- tools/riemann-marathon/README.md
|
190
|
+
- tools/riemann-marathon/Rakefile.rb
|
191
|
+
- tools/riemann-marathon/bin/riemann-marathon
|
192
|
+
- tools/riemann-mesos/LICENSE
|
193
|
+
- tools/riemann-mesos/README.md
|
194
|
+
- tools/riemann-mesos/Rakefile.rb
|
195
|
+
- tools/riemann-mesos/bin/riemann-mesos
|
196
|
+
- tools/riemann-munin/LICENSE
|
197
|
+
- tools/riemann-munin/README.md
|
198
|
+
- tools/riemann-munin/Rakefile.rb
|
199
|
+
- tools/riemann-munin/bin/riemann-munin
|
200
|
+
- tools/riemann-rabbitmq/LICENSE
|
201
|
+
- tools/riemann-rabbitmq/README.md
|
202
|
+
- tools/riemann-rabbitmq/Rakefile.rb
|
203
|
+
- tools/riemann-rabbitmq/bin/riemann-rabbitmq
|
204
|
+
- tools/riemann-riak/LICENSE
|
205
|
+
- tools/riemann-riak/README.md
|
206
|
+
- tools/riemann-riak/Rakefile.rb
|
207
|
+
- tools/riemann-riak/bin/riemann-riak
|
208
|
+
- tools/riemann-riak/bin/riemann-riak-keys
|
209
|
+
- tools/riemann-riak/bin/riemann-riak-ring
|
210
|
+
- tools/riemann-riak/riak_status/key_count.erl
|
211
|
+
- tools/riemann-riak/riak_status/riak_status.rb
|
212
|
+
- tools/riemann-riak/riak_status/ringready.erl
|
102
213
|
homepage: https://github.com/aphyr/riemann-tools
|
103
214
|
licenses:
|
104
215
|
- MIT
|
105
|
-
metadata:
|
216
|
+
metadata:
|
217
|
+
allowed_push_host: https://rubygems.org/
|
218
|
+
homepage_uri: https://github.com/aphyr/riemann-tools
|
219
|
+
source_code_uri: https://github.com/aphyr/riemann-tools
|
220
|
+
changelog_uri: https://github.com/aphyr/riemann-tools
|
106
221
|
post_install_message:
|
107
222
|
rdoc_options: []
|
108
223
|
require_paths:
|
@@ -111,15 +226,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
226
|
requirements:
|
112
227
|
- - ">="
|
113
228
|
- !ruby/object:Gem::Version
|
114
|
-
version:
|
229
|
+
version: 2.5.0
|
115
230
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
231
|
requirements:
|
117
232
|
- - ">="
|
118
233
|
- !ruby/object:Gem::Version
|
119
234
|
version: '0'
|
120
235
|
requirements: []
|
121
|
-
|
122
|
-
rubygems_version: 2.4.5
|
236
|
+
rubygems_version: 3.2.5
|
123
237
|
signing_key:
|
124
238
|
specification_version: 4
|
125
239
|
summary: Utilities which submit events to Riemann.
|