riemann-tools 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +2 -0
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +8 -0
  5. data/.ruby-version +1 -0
  6. data/CHANGELOG.md +25 -2
  7. data/Rakefile +10 -3
  8. data/bin/riemann-apache-status +1 -106
  9. data/bin/riemann-bench +2 -70
  10. data/bin/riemann-cloudant +1 -56
  11. data/bin/riemann-consul +1 -106
  12. data/bin/riemann-dir-files-count +1 -55
  13. data/bin/riemann-dir-space +1 -55
  14. data/bin/riemann-diskstats +1 -92
  15. data/bin/riemann-fd +2 -81
  16. data/bin/riemann-freeswitch +2 -119
  17. data/bin/riemann-haproxy +1 -58
  18. data/bin/riemann-health +0 -2
  19. data/bin/riemann-kvminstance +2 -22
  20. data/bin/riemann-memcached +1 -37
  21. data/bin/riemann-net +0 -2
  22. data/bin/riemann-nginx-status +1 -85
  23. data/bin/riemann-ntp +0 -2
  24. data/bin/riemann-portcheck +1 -44
  25. data/bin/riemann-proc +1 -108
  26. data/bin/riemann-varnish +1 -54
  27. data/bin/riemann-wrapper +75 -0
  28. data/bin/riemann-zookeeper +1 -39
  29. data/lib/riemann/tools/apache_status.rb +107 -0
  30. data/lib/riemann/tools/bench.rb +72 -0
  31. data/lib/riemann/tools/cloudant.rb +57 -0
  32. data/lib/riemann/tools/consul_health.rb +107 -0
  33. data/lib/riemann/tools/dir_files_count.rb +56 -0
  34. data/lib/riemann/tools/dir_space.rb +56 -0
  35. data/lib/riemann/tools/diskstats.rb +94 -0
  36. data/lib/riemann/tools/fd.rb +81 -0
  37. data/lib/riemann/tools/freeswitch.rb +119 -0
  38. data/lib/riemann/tools/haproxy.rb +59 -0
  39. data/lib/riemann/tools/health.rb +150 -19
  40. data/lib/riemann/tools/kvm.rb +23 -0
  41. data/lib/riemann/tools/memcached.rb +38 -0
  42. data/lib/riemann/tools/net.rb +2 -1
  43. data/lib/riemann/tools/nginx_status.rb +86 -0
  44. data/lib/riemann/tools/ntp.rb +1 -0
  45. data/lib/riemann/tools/portcheck.rb +45 -0
  46. data/lib/riemann/tools/proc.rb +109 -0
  47. data/lib/riemann/tools/riemann_client_wrapper.rb +43 -0
  48. data/lib/riemann/tools/uptime_parser.tab.rb +323 -0
  49. data/lib/riemann/tools/varnish.rb +55 -0
  50. data/lib/riemann/tools/version.rb +1 -1
  51. data/lib/riemann/tools/zookeeper.rb +40 -0
  52. data/lib/riemann/tools.rb +2 -20
  53. data/riemann-tools.gemspec +4 -1
  54. data/tools/riemann-aws/Rakefile +6 -9
  55. data/tools/riemann-aws/bin/riemann-aws-billing +2 -87
  56. data/tools/riemann-aws/bin/riemann-aws-rds-status +2 -62
  57. data/tools/riemann-aws/bin/riemann-aws-sqs-status +2 -44
  58. data/tools/riemann-aws/bin/riemann-aws-status +2 -77
  59. data/tools/riemann-aws/bin/riemann-elb-metrics +2 -162
  60. data/tools/riemann-aws/bin/riemann-s3-list +2 -81
  61. data/tools/riemann-aws/bin/riemann-s3-status +2 -96
  62. data/tools/riemann-aws/lib/riemann/tools/aws/billing.rb +87 -0
  63. data/tools/riemann-aws/lib/riemann/tools/aws/elb_metrics.rb +163 -0
  64. data/tools/riemann-aws/lib/riemann/tools/aws/rds_status.rb +63 -0
  65. data/tools/riemann-aws/lib/riemann/tools/aws/s3_list.rb +82 -0
  66. data/tools/riemann-aws/lib/riemann/tools/aws/s3_status.rb +97 -0
  67. data/tools/riemann-aws/lib/riemann/tools/aws/sqs_status.rb +45 -0
  68. data/tools/riemann-aws/lib/riemann/tools/aws/status.rb +74 -0
  69. data/tools/riemann-chronos/Rakefile +6 -9
  70. data/tools/riemann-chronos/bin/riemann-chronos +1 -154
  71. data/tools/riemann-chronos/lib/riemann/tools/chronos.rb +157 -0
  72. data/tools/riemann-docker/Rakefile +5 -8
  73. data/tools/riemann-docker/bin/riemann-docker +2 -200
  74. data/tools/riemann-docker/lib/riemann/tools/docker.rb +200 -0
  75. data/tools/riemann-elasticsearch/Rakefile +6 -9
  76. data/tools/riemann-elasticsearch/bin/riemann-elasticsearch +1 -167
  77. data/tools/riemann-elasticsearch/lib/riemann/tools/elasticsearch.rb +170 -0
  78. data/tools/riemann-marathon/Rakefile +6 -9
  79. data/tools/riemann-marathon/bin/riemann-marathon +1 -156
  80. data/tools/riemann-marathon/lib/riemann/tools/marathon.rb +159 -0
  81. data/tools/riemann-mesos/Rakefile +6 -9
  82. data/tools/riemann-mesos/bin/riemann-mesos +1 -139
  83. data/tools/riemann-mesos/lib/riemann/tools/mesos.rb +142 -0
  84. data/tools/riemann-munin/Rakefile +5 -8
  85. data/tools/riemann-munin/bin/riemann-munin +1 -36
  86. data/tools/riemann-munin/lib/riemann/tools/munin.rb +37 -0
  87. data/tools/riemann-rabbitmq/Rakefile +6 -9
  88. data/tools/riemann-rabbitmq/bin/riemann-rabbitmq +1 -266
  89. data/tools/riemann-rabbitmq/lib/riemann/tools/rabbitmq.rb +269 -0
  90. data/tools/riemann-riak/Rakefile +5 -8
  91. data/tools/riemann-riak/bin/riemann-riak +1 -316
  92. data/tools/riemann-riak/bin/riemann-riak-keys +0 -1
  93. data/tools/riemann-riak/bin/riemann-riak-ring +0 -1
  94. data/tools/riemann-riak/lib/riemann/tools/riak.rb +317 -0
  95. metadata +57 -10
  96. data/.travis.yml +0 -31
  97. data/tools/riemann-riak/riak_status/key_count.erl +0 -13
  98. data/tools/riemann-riak/riak_status/riak_status.rb +0 -152
  99. data/tools/riemann-riak/riak_status/ringready.erl +0 -9
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.1.1
4
+ version: 1.2.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-07-02 00:00:00.000000000 Z
11
+ date: 2022-08-17 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
@@ -165,6 +179,7 @@ executables:
165
179
  - riemann-portcheck
166
180
  - riemann-proc
167
181
  - riemann-varnish
182
+ - riemann-wrapper
168
183
  - riemann-zookeeper
169
184
  extensions: []
170
185
  extra_rdoc_files: []
@@ -177,7 +192,7 @@ files:
177
192
  - ".gitignore"
178
193
  - ".rspec"
179
194
  - ".rubocop.yml"
180
- - ".travis.yml"
195
+ - ".ruby-version"
181
196
  - CHANGELOG.md
182
197
  - Gemfile
183
198
  - ISSUE_TEMPLATE.md
@@ -204,13 +219,33 @@ files:
204
219
  - bin/riemann-portcheck
205
220
  - bin/riemann-proc
206
221
  - bin/riemann-varnish
222
+ - bin/riemann-wrapper
207
223
  - bin/riemann-zookeeper
208
224
  - lib/riemann/tools.rb
225
+ - lib/riemann/tools/apache_status.rb
226
+ - lib/riemann/tools/bench.rb
227
+ - lib/riemann/tools/cloudant.rb
228
+ - lib/riemann/tools/consul_health.rb
229
+ - lib/riemann/tools/dir_files_count.rb
230
+ - lib/riemann/tools/dir_space.rb
231
+ - lib/riemann/tools/diskstats.rb
232
+ - lib/riemann/tools/fd.rb
233
+ - lib/riemann/tools/freeswitch.rb
234
+ - lib/riemann/tools/haproxy.rb
209
235
  - lib/riemann/tools/health.rb
236
+ - lib/riemann/tools/kvm.rb
237
+ - lib/riemann/tools/memcached.rb
210
238
  - lib/riemann/tools/net.rb
239
+ - lib/riemann/tools/nginx_status.rb
211
240
  - lib/riemann/tools/ntp.rb
241
+ - lib/riemann/tools/portcheck.rb
242
+ - lib/riemann/tools/proc.rb
243
+ - lib/riemann/tools/riemann_client_wrapper.rb
244
+ - lib/riemann/tools/uptime_parser.tab.rb
212
245
  - lib/riemann/tools/utils.rb
246
+ - lib/riemann/tools/varnish.rb
213
247
  - lib/riemann/tools/version.rb
248
+ - lib/riemann/tools/zookeeper.rb
214
249
  - riemann-tools.gemspec
215
250
  - tools/riemann-aws/LICENSE
216
251
  - tools/riemann-aws/README.md
@@ -222,43 +257,55 @@ files:
222
257
  - tools/riemann-aws/bin/riemann-elb-metrics
223
258
  - tools/riemann-aws/bin/riemann-s3-list
224
259
  - tools/riemann-aws/bin/riemann-s3-status
260
+ - tools/riemann-aws/lib/riemann/tools/aws/billing.rb
261
+ - tools/riemann-aws/lib/riemann/tools/aws/elb_metrics.rb
262
+ - tools/riemann-aws/lib/riemann/tools/aws/rds_status.rb
263
+ - tools/riemann-aws/lib/riemann/tools/aws/s3_list.rb
264
+ - tools/riemann-aws/lib/riemann/tools/aws/s3_status.rb
265
+ - tools/riemann-aws/lib/riemann/tools/aws/sqs_status.rb
266
+ - tools/riemann-aws/lib/riemann/tools/aws/status.rb
225
267
  - tools/riemann-chronos/LICENSE
226
268
  - tools/riemann-chronos/README.md
227
269
  - tools/riemann-chronos/Rakefile
228
270
  - tools/riemann-chronos/bin/riemann-chronos
271
+ - tools/riemann-chronos/lib/riemann/tools/chronos.rb
229
272
  - tools/riemann-docker/LICENSE
230
273
  - tools/riemann-docker/README.md
231
274
  - tools/riemann-docker/Rakefile
232
275
  - tools/riemann-docker/bin/riemann-docker
276
+ - tools/riemann-docker/lib/riemann/tools/docker.rb
233
277
  - tools/riemann-elasticsearch/LICENSE
234
278
  - tools/riemann-elasticsearch/README.md
235
279
  - tools/riemann-elasticsearch/Rakefile
236
280
  - tools/riemann-elasticsearch/bin/riemann-elasticsearch
281
+ - tools/riemann-elasticsearch/lib/riemann/tools/elasticsearch.rb
237
282
  - tools/riemann-marathon/LICENSE
238
283
  - tools/riemann-marathon/README.md
239
284
  - tools/riemann-marathon/Rakefile
240
285
  - tools/riemann-marathon/bin/riemann-marathon
286
+ - tools/riemann-marathon/lib/riemann/tools/marathon.rb
241
287
  - tools/riemann-mesos/LICENSE
242
288
  - tools/riemann-mesos/README.md
243
289
  - tools/riemann-mesos/Rakefile
244
290
  - tools/riemann-mesos/bin/riemann-mesos
291
+ - tools/riemann-mesos/lib/riemann/tools/mesos.rb
245
292
  - tools/riemann-munin/LICENSE
246
293
  - tools/riemann-munin/README.md
247
294
  - tools/riemann-munin/Rakefile
248
295
  - tools/riemann-munin/bin/riemann-munin
296
+ - tools/riemann-munin/lib/riemann/tools/munin.rb
249
297
  - tools/riemann-rabbitmq/LICENSE
250
298
  - tools/riemann-rabbitmq/README.md
251
299
  - tools/riemann-rabbitmq/Rakefile
252
300
  - tools/riemann-rabbitmq/bin/riemann-rabbitmq
301
+ - tools/riemann-rabbitmq/lib/riemann/tools/rabbitmq.rb
253
302
  - tools/riemann-riak/LICENSE
254
303
  - tools/riemann-riak/README.md
255
304
  - tools/riemann-riak/Rakefile
256
305
  - tools/riemann-riak/bin/riemann-riak
257
306
  - tools/riemann-riak/bin/riemann-riak-keys
258
307
  - tools/riemann-riak/bin/riemann-riak-ring
259
- - tools/riemann-riak/riak_status/key_count.erl
260
- - tools/riemann-riak/riak_status/riak_status.rb
261
- - tools/riemann-riak/riak_status/ringready.erl
308
+ - tools/riemann-riak/lib/riemann/tools/riak.rb
262
309
  homepage: https://github.com/aphyr/riemann-tools
263
310
  licenses:
264
311
  - MIT
@@ -267,7 +314,7 @@ metadata:
267
314
  homepage_uri: https://github.com/aphyr/riemann-tools
268
315
  source_code_uri: https://github.com/aphyr/riemann-tools
269
316
  changelog_uri: https://github.com/aphyr/riemann-tools
270
- post_install_message:
317
+ post_install_message:
271
318
  rdoc_options: []
272
319
  require_paths:
273
320
  - lib
@@ -282,8 +329,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
282
329
  - !ruby/object:Gem::Version
283
330
  version: '0'
284
331
  requirements: []
285
- rubygems_version: 3.3.16
286
- signing_key:
332
+ rubygems_version: 3.2.5
333
+ signing_key:
287
334
  specification_version: 4
288
335
  summary: Utilities which submit events to Riemann.
289
336
  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__
@@ -1,9 +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("~p\n", [
8
- rpc:call(list_to_atom(Node), riak_kv_console, ringready, [[]])
9
- ]).