riemann-tools 0.2.11 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. checksums.yaml +5 -5
  2. data/.docker/Dockerfile +7 -0
  3. data/.docker/publish.sh +35 -0
  4. data/.github/workflows/ci.yml +29 -0
  5. data/.gitignore +6 -0
  6. data/.rspec +2 -0
  7. data/.travis.yml +31 -0
  8. data/CHANGELOG.md +393 -0
  9. data/Gemfile +6 -0
  10. data/ISSUE_TEMPLATE.md +15 -0
  11. data/README.markdown +17 -1
  12. data/Rakefile +21 -0
  13. data/bin/riemann-apache-status +1 -0
  14. data/bin/riemann-bench +1 -0
  15. data/bin/riemann-cloudant +1 -0
  16. data/bin/riemann-consul +3 -2
  17. data/bin/riemann-dir-files-count +1 -0
  18. data/bin/riemann-dir-space +1 -0
  19. data/bin/riemann-diskstats +1 -0
  20. data/bin/riemann-fd +1 -0
  21. data/bin/riemann-freeswitch +1 -0
  22. data/bin/riemann-haproxy +1 -0
  23. data/bin/riemann-health +87 -10
  24. data/bin/riemann-kvminstance +1 -0
  25. data/bin/riemann-memcached +1 -0
  26. data/bin/riemann-net +3 -2
  27. data/bin/riemann-nginx-status +1 -0
  28. data/bin/riemann-ntp +1 -0
  29. data/bin/riemann-portcheck +42 -0
  30. data/bin/riemann-proc +2 -1
  31. data/bin/riemann-varnish +1 -0
  32. data/bin/riemann-zookeeper +1 -0
  33. data/lib/riemann/tools/utils.rb +17 -0
  34. data/lib/riemann/tools/version.rb +7 -0
  35. data/lib/riemann/tools.rb +15 -5
  36. data/riemann-tools.gemspec +39 -0
  37. data/tools/riemann-aws/LICENSE +21 -0
  38. data/tools/riemann-aws/README.md +54 -0
  39. data/tools/riemann-aws/Rakefile.rb +35 -0
  40. data/tools/riemann-aws/bin/riemann-aws-billing +87 -0
  41. data/tools/riemann-aws/bin/riemann-aws-rds-status +54 -0
  42. data/tools/riemann-aws/bin/riemann-aws-sqs-status +44 -0
  43. data/tools/riemann-aws/bin/riemann-aws-status +71 -0
  44. data/tools/riemann-aws/bin/riemann-elb-metrics +167 -0
  45. data/tools/riemann-aws/bin/riemann-s3-list +82 -0
  46. data/tools/riemann-aws/bin/riemann-s3-status +99 -0
  47. data/tools/riemann-chronos/LICENSE +21 -0
  48. data/tools/riemann-chronos/README.md +10 -0
  49. data/tools/riemann-chronos/Rakefile.rb +35 -0
  50. data/tools/riemann-chronos/bin/riemann-chronos +144 -0
  51. data/tools/riemann-docker/LICENSE +21 -0
  52. data/tools/riemann-docker/README.md +10 -0
  53. data/tools/riemann-docker/Rakefile.rb +34 -0
  54. data/tools/riemann-docker/bin/riemann-docker +217 -0
  55. data/tools/riemann-elasticsearch/LICENSE +21 -0
  56. data/tools/riemann-elasticsearch/README.md +10 -0
  57. data/tools/riemann-elasticsearch/Rakefile.rb +35 -0
  58. data/tools/riemann-elasticsearch/bin/riemann-elasticsearch +166 -0
  59. data/tools/riemann-marathon/LICENSE +21 -0
  60. data/tools/riemann-marathon/README.md +10 -0
  61. data/tools/riemann-marathon/Rakefile.rb +35 -0
  62. data/tools/riemann-marathon/bin/riemann-marathon +147 -0
  63. data/tools/riemann-mesos/LICENSE +21 -0
  64. data/tools/riemann-mesos/README.md +10 -0
  65. data/tools/riemann-mesos/Rakefile.rb +35 -0
  66. data/tools/riemann-mesos/bin/riemann-mesos +131 -0
  67. data/tools/riemann-munin/LICENSE +21 -0
  68. data/tools/riemann-munin/README.md +10 -0
  69. data/tools/riemann-munin/Rakefile.rb +34 -0
  70. data/tools/riemann-munin/bin/riemann-munin +37 -0
  71. data/tools/riemann-rabbitmq/LICENSE +21 -0
  72. data/tools/riemann-rabbitmq/README.md +10 -0
  73. data/tools/riemann-rabbitmq/Rakefile.rb +35 -0
  74. data/tools/riemann-rabbitmq/bin/riemann-rabbitmq +269 -0
  75. data/tools/riemann-riak/LICENSE +21 -0
  76. data/tools/riemann-riak/README.md +10 -0
  77. data/tools/riemann-riak/Rakefile.rb +34 -0
  78. data/tools/riemann-riak/bin/riemann-riak +331 -0
  79. data/tools/riemann-riak/bin/riemann-riak-keys +13 -0
  80. data/tools/riemann-riak/bin/riemann-riak-ring +9 -0
  81. data/tools/riemann-riak/riak_status/key_count.erl +13 -0
  82. data/tools/riemann-riak/riak_status/riak_status.rb +152 -0
  83. data/tools/riemann-riak/riak_status/ringready.erl +9 -0
  84. metadata +130 -16
data/bin/riemann-cloudant CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ Process.setproctitle($0)
2
3
 
3
4
  # Gathers load balancer statistics from Cloudant.com (shared cluster) and submits them to Riemann.
4
5
 
data/bin/riemann-consul CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ Process.setproctitle($0)
2
3
 
3
4
  # Reports service and node status to riemann
4
5
 
@@ -48,8 +49,8 @@ class Riemann::Tools::ConsulHealth
48
49
 
49
50
  def tick
50
51
 
51
- leader = get(@consul_leader_url)
52
- leader_hostname = URI.parse("http://" + leader[1..-2]).hostname
52
+ leader = JSON.parse(get(@consul_leader_url))
53
+ leader_hostname = URI.parse("http://" + leader).hostname
53
54
 
54
55
  if (leader_hostname == @underlying_ip)
55
56
  nodes = JSON.parse(get(@consul_nodes_url))
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ Process.setproctitle($0)
2
3
 
3
4
  # Gets the number of files present on a directory and submits it to riemann
4
5
 
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ Process.setproctitle($0)
2
3
 
3
4
  # Gathers the space used by a directory and submits it to riemann
4
5
 
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ Process.setproctitle($0)
2
3
  #
3
4
  require 'rubygems'
4
5
  require 'riemann/tools'
data/bin/riemann-fd CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ Process.setproctitle($0)
2
3
 
3
4
  # Reports current file descriptor use to riemann.
4
5
  # By default reports the total system fd usage, can also report usage of individual processes
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ Process.setproctitle($0)
2
3
 
3
4
  require File.expand_path('../../lib/riemann/tools', __FILE__)
4
5
 
data/bin/riemann-haproxy CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ Process.setproctitle($0)
2
3
 
3
4
  # Gathers haproxy CSV statistics and submits them to Riemann.
4
5
 
data/bin/riemann-health CHANGED
@@ -1,11 +1,14 @@
1
1
  #!/usr/bin/env ruby
2
+ Process.setproctitle($0)
2
3
 
3
4
  # Reports current CPU, disk, load average, and memory use to riemann.
4
5
 
5
6
  require File.expand_path('../../lib/riemann/tools', __FILE__)
7
+ require File.expand_path('../../lib/riemann/tools/utils', __FILE__)
6
8
 
7
9
  class Riemann::Tools::Health
8
10
  include Riemann::Tools
11
+ include Riemann::Tools::Utils
9
12
 
10
13
  opt :cpu_warning, "CPU warning threshold (fraction of total jiffies)", :default => 0.9
11
14
  opt :cpu_critical, "CPU critical threshold (fraction of total jiffies)", :default => 0.95
@@ -36,8 +39,20 @@ class Riemann::Tools::Health
36
39
  @cores = `sysctl -n hw.ncpu`.to_i
37
40
  @cpu = method :freebsd_cpu
38
41
  @disk = method :disk
39
- @load = method :freebsd_load
42
+ @load = method :bsd_load
40
43
  @memory = method :freebsd_memory
44
+ when 'openbsd'
45
+ @cores = `sysctl -n hw.ncpu`.to_i
46
+ @cpu = method :openbsd_cpu
47
+ @disk = method :disk
48
+ @load = method :bsd_load
49
+ @memory = method :openbsd_memory
50
+ when 'sunos'
51
+ @cores = `mpstat -a 2>/dev/null`.split[33].to_i
52
+ @cpu = method :sunos_cpu
53
+ @disk = method :disk
54
+ @load = method :bsd_load
55
+ @memory = method :sunos_memory
41
56
  else
42
57
  @cores = `nproc`.to_i
43
58
  puts "WARNING: OS '#{@ostype}' not explicitly supported. Falling back to Linux" unless @ostype == "linux"
@@ -45,6 +60,7 @@ class Riemann::Tools::Health
45
60
  @disk = method :disk
46
61
  @load = method :linux_load
47
62
  @memory = method :linux_memory
63
+ @supports_exclude_type = `df --help 2>&1 | grep -e "--exclude-type"` != ""
48
64
  end
49
65
 
50
66
  opts[:checks].each do |check|
@@ -97,7 +113,7 @@ class Riemann::Tools::Health
97
113
  total = used + i2-i1
98
114
  fraction = used.to_f / total
99
115
 
100
- report_pct :cpu, fraction, "user+nice+system\n\n#{`ps -eo pcpu,pid,comm | sort -nrb -k1 | head -10`.chomp}"
116
+ report_pct :cpu, fraction, "user+nice+system\n\n#{reverse_numeric_sort_with_header(`ps -eo pcpu,pid,comm`)}"
101
117
  end
102
118
 
103
119
  @old_cpu = [u2, n2, s2, i2]
@@ -126,7 +142,7 @@ class Riemann::Tools::Health
126
142
  total = m['MemTotal'].to_i
127
143
  fraction = 1 - (free.to_f / total)
128
144
 
129
- report_pct :memory, fraction, "used\n\n#{`ps -eo pmem,pid,comm | sort -nrb -k1 | head -10`.chomp}"
145
+ report_pct :memory, fraction, "used\n\n#{reverse_numeric_sort_with_header(`ps -eo pmem,pid,comm`)}"
130
146
  end
131
147
 
132
148
  def freebsd_cpu
@@ -139,13 +155,53 @@ class Riemann::Tools::Health
139
155
  total = used + i2-i1
140
156
  fraction = used.to_f / total
141
157
 
142
- report_pct :cpu, fraction, "user+nice+sytem+interrupt\n\n#{`ps -axo pcpu,pid,comm | sort -nrb -k1 | head -10`.chomp}"
158
+ report_pct :cpu, fraction, "user+nice+sytem+interrupt\n\n#{reverse_numeric_sort_with_header(`ps -axo pcpu,pid,comm`)}"
159
+ end
160
+
161
+ @old_cpu = [u2, n2, s2, t2, i2]
162
+ end
163
+
164
+ def openbsd_cpu
165
+ u2, n2, s2, t2, i2 = `sysctl -n kern.cp_time 2>/dev/null`.split(',').map{ |e| e.to_i } #OpenBSD separates with ,
166
+
167
+ if @old_cpu
168
+ u1, n1, s1, t1, i1 = @old_cpu
169
+
170
+ used = (u2+n2+s2+t2) - (u1+n1+s1+t1)
171
+ total = used + i2-i1
172
+ fraction = used.to_f / total
173
+
174
+ report_pct :cpu, fraction, "user+nice+sytem+interrupt\n\n#{reverse_numeric_sort_with_header(`ps -axo pcpu,pid,comm`)}"
143
175
  end
144
176
 
145
177
  @old_cpu = [u2, n2, s2, t2, i2]
146
178
  end
147
179
 
148
- def freebsd_load
180
+ def sunos_cpu
181
+ mpstats = `mpstat -a 2>/dev/null`.split
182
+ u2 = mpstats[29].to_i
183
+ s2 = mpstats[30].to_i
184
+ t2 = mpstats[31].to_i
185
+ i2 = mpstats[32].to_i
186
+
187
+ if @old_cpu
188
+ u1, s1, t1, i1 = @old_cpu
189
+
190
+ used = (u2+s2+t2) - (u1+s1+t1)
191
+ total = used + i2-i1
192
+ if i2 == i1 && used == 0 #If the system is <1% used in both samples then total will be 0 + (99 - 99), avoid a div by 0
193
+ fraction = 0
194
+ else
195
+ fraction = used.to_f / total
196
+ end
197
+
198
+ report_pct :cpu, fraction, "user+sytem+interrupt\n\n#{reverse_numeric_sort_with_header(`ps -ao pcpu,pid,comm`)}"
199
+ end
200
+
201
+ @old_cpu = [u2, s2, t2, i2]
202
+ end
203
+
204
+ def bsd_load
149
205
  m = `uptime`.split(':')[-1].chomp.gsub(/\s+/,'').split(',')
150
206
  load = m[0].to_f / @cores
151
207
  if load > @limits[:load][:critical]
@@ -161,7 +217,22 @@ class Riemann::Tools::Health
161
217
  meminfo = `sysctl -n vm.stats.vm.v_page_count vm.stats.vm.v_wire_count vm.stats.vm.v_active_count 2>/dev/null`.chomp.split
162
218
  fraction = (meminfo[1].to_f + meminfo[2].to_f) / meminfo[0].to_f
163
219
 
164
- report_pct :memory, fraction, "used\n\n#{`ps -axo pmem,pid,comm | sort -nrb -k1 | head -10`.chomp}"
220
+ report_pct :memory, fraction, "used\n\n#{reverse_numeric_sort_with_header(`ps -axo pmem,pid,comm`)}"
221
+ end
222
+
223
+ def openbsd_memory
224
+ meminfo = `vmstat 2>/dev/null`.chomp.split
225
+ fraction = meminfo[28].to_f / meminfo[29].to_f #The ratio of active to free memory unlike the others :(
226
+
227
+ report_pct :memory, fraction, "used\n\n#{reverse_numeric_sort_with_header(`ps -axo pmem,pid,comm`)}"
228
+ end
229
+
230
+ def sunos_memory
231
+ meminfo = `vmstat 2>/dev/null`.chomp.split
232
+ total_mem = `prtconf | grep Memory`.split[2].to_f * 1024 # reports in GB but vmstat is in MB
233
+ fraction = ( total_mem - meminfo[32].to_f ) / total_mem
234
+
235
+ report_pct :memory, fraction, "used\n\n#{reverse_numeric_sort_with_header(`ps -ao pmem,pid,comm`)}"
165
236
  end
166
237
 
167
238
  def darwin_top
@@ -197,7 +268,7 @@ class Riemann::Tools::Health
197
268
  alert 'cpu', :unknown, nil, "unable to get CPU stats from top"
198
269
  return false
199
270
  end
200
- report_pct :cpu, @topdata[:cpu], "usage\n\n#{`ps -eo pcpu,pid,comm | sort -nrb -k1 | head -10`.chomp}"
271
+ report_pct :cpu, @topdata[:cpu], "usage\n\n#{reverse_numeric_sort_with_header(`ps -eo pcpu,pid,comm`)}"
201
272
  end
202
273
 
203
274
  def darwin_load
@@ -222,15 +293,21 @@ class Riemann::Tools::Health
222
293
  alert 'memory', :unknown, nil, "unable to get memory data from top"
223
294
  return false
224
295
  end
225
- report_pct :memory, @topdata[:memory], "usage\n\n#{`ps -eo pmem,pid,comm | sort -nrb -k1 | head -10`.chomp}"
296
+ report_pct :memory, @topdata[:memory], "usage\n\n#{reverse_numeric_sort_with_header(`ps -eo pmem,pid,comm`)}"
226
297
  end
227
298
 
228
299
  def df
229
300
  case @ostype
230
- when 'darwin', 'freebsd'
301
+ when 'darwin', 'freebsd', 'openbsd'
231
302
  `df -P -t noiso9660`
303
+ when 'sunos'
304
+ `df -P` # Is there a good way to exlude iso9660 here?
232
305
  else
233
- `df -P --exclude-type=iso9660`
306
+ if @supports_exclude_type
307
+ `df -P --exclude-type=iso9660 --exclude-type=nfs`
308
+ else
309
+ `df -P`
310
+ end
234
311
  end
235
312
  end
236
313
 
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ Process.setproctitle($0)
2
3
 
3
4
  require File.expand_path('../../lib/riemann/tools', __FILE__)
4
5
 
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ Process.setproctitle($0)
2
3
 
3
4
  # Gathers memcached STATS and submits them to Riemann.
4
5
 
data/bin/riemann-net CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ Process.setproctitle($0)
2
3
 
3
4
  # Gathers network interface statistics and submits them to Riemann.
4
5
 
@@ -79,13 +80,13 @@ class Riemann::Tools::Net
79
80
  delta = metric - @old_state[service]
80
81
  svc_state = case service
81
82
  when /drop$/
82
- if metric > 0
83
+ if delta > 0
83
84
  'warning'
84
85
  else
85
86
  'ok'
86
87
  end
87
88
  when /errs$/
88
- if metric > 0
89
+ if delta > 0
89
90
  'warning'
90
91
  else
91
92
  'ok'
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ Process.setproctitle($0)
2
3
 
3
4
  # Gathers nginx status stub statistics and submits them to Riemann.
4
5
  # See http://wiki.nginx.org/HttpStubStatusModule for configuring Nginx appropriately
data/bin/riemann-ntp CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ Process.setproctitle($0)
2
3
 
3
4
  # Reports NTP stats to Riemann.
4
5
 
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+ Process.setproctitle($0)
3
+
4
+ # Checks for open tcp ports.
5
+ # (c) Max Voit 2017
6
+
7
+ require File.expand_path('../../lib/riemann/tools', __FILE__)
8
+
9
+ class Riemann::Tools::Portcheck
10
+ include Riemann::Tools
11
+ require 'socket'
12
+
13
+ opt :hostname, "Host, defaults to localhost", :default => `hostname`.chomp
14
+ opt :ports, "List of ports to check, e.g. '-r 80 443'", :type => :ints
15
+
16
+ def initialize
17
+ @hostname = opts.fetch(:hostname)
18
+ @ports = opts.fetch(:ports)
19
+ end
20
+
21
+ def tick
22
+ for thisport in @ports
23
+ # try opening tcp connection with 5s timeout;
24
+ # if this fails, the port is considered closed
25
+ portopen = Socket.tcp(@hostname, thisport, connect_timeout: 5) { true } rescue false
26
+ if portopen
27
+ state = "ok"
28
+ else
29
+ state = "critical"
30
+ end
31
+ report(
32
+ :host => "#{@hostname}",
33
+ :service => "port #{thisport}",
34
+ :state => "#{state}",
35
+ :tags => ["portcheck"]
36
+ )
37
+ end
38
+ end
39
+
40
+ end
41
+
42
+ Riemann::Tools::Portcheck.run
data/bin/riemann-proc CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ Process.setproctitle($0)
2
3
 
3
4
  # Reports running process count to riemann.
4
5
 
@@ -50,7 +51,7 @@ class Riemann::Tools::Proc
50
51
  # value should be either process RSS, VSIZE, or 1 if running
51
52
  # state is always unknown for the moment
52
53
  #
53
- ps_regex = /([0-9]+)[ ]+([0-9]+)[ ]+([0-9]+)[ ]+([A-Z])[ ]+([0-9:.]+)[ ]+[A-Za-z]{3}[ ]+([A-Za-z]{3} [0-9]+ [0-9:]+ [0-9]+)[ ]+(.*)/
54
+ ps_regex = /([0-9]+)[ ]+([0-9]+)[ ]+([0-9]+)[ ]+([A-Z])[ ]+([0-9:.]+)[ ]+[A-Za-z]{3}[ ]+([A-Za-z]{3}[ ]{1,2}[0-9]+ [0-9:]+ [0-9]+)[ ]+(.*)/
54
55
  found.each_line do |line|
55
56
  m = ps_regex.match(line)
56
57
  if not m.nil?
data/bin/riemann-varnish CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ Process.setproctitle($0)
2
3
 
3
4
  # Reports varnish stats to Riemann.
4
5
 
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ Process.setproctitle($0)
2
3
 
3
4
  # Gathers zookeeper STATS and submits them to Riemann.
4
5
 
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Riemann
4
+ module Tools
5
+ module Utils # :nodoc:
6
+ def reverse_numeric_sort_with_header(data, header: 1, count: 10)
7
+ lines = data.chomp.split("\n")
8
+ header = lines.shift(header)
9
+
10
+ lines.sort_by!(&:to_f)
11
+ lines.reverse!
12
+
13
+ (header + lines[0, count]).join("\n")
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Riemann
4
+ module Tools # :nodoc:
5
+ VERSION = '1.0.0'
6
+ end
7
+ end
data/lib/riemann/tools.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Riemann
2
2
  module Tools
3
- require 'trollop'
3
+ require 'optimist'
4
4
  require 'riemann/client'
5
5
 
6
6
  def self.included(base)
@@ -16,11 +16,11 @@ module Riemann
16
16
  end
17
17
 
18
18
  def options
19
- p = Trollop::Parser.new
19
+ p = Optimist::Parser.new
20
20
  @opts.each do |o|
21
21
  p.send *o
22
22
  end
23
- Trollop::with_standard_exception_handling(p) do
23
+ Optimist::with_standard_exception_handling(p) do
24
24
  p.parse ARGV
25
25
  end
26
26
  end
@@ -34,6 +34,11 @@ module Riemann
34
34
  opt :attribute, "Attribute to add to the event", :type => String, :multi => true
35
35
  opt :timeout, "Timeout (in seconds) when waiting for acknowledgements", :default => 30
36
36
  opt :tcp, "Use TCP transport instead of UDP (improves reliability, slight overhead.", :default => true
37
+ opt :tls, "Use TLS for securing traffic", :default => false
38
+ opt :tls_key, "TLS Key to use when using TLS", :type => String
39
+ opt :tls_cert, "TLS Certificate to use when using TLS", :type => String
40
+ opt :tls_ca_cert, "Trusted CA Certificate when using TLS", :type => String
41
+ opt :tls_verify, "Verify TLS peer when using TLS", :default => true
37
42
  end
38
43
  end
39
44
 
@@ -73,9 +78,14 @@ module Riemann
73
78
  r = Riemann::Client.new(
74
79
  :host => options[:host],
75
80
  :port => options[:port],
76
- :timeout => options[:timeout]
81
+ :timeout => options[:timeout],
82
+ :ssl => options[:tls],
83
+ :key_file => options[:tls_key],
84
+ :cert_file => options[:tls_cert],
85
+ :ca_file => options[:tls_ca_cert],
86
+ :ssl_verify => options[:tls_verify],
77
87
  )
78
- if options[:tcp]
88
+ if options[:tcp] || options[:tls]
79
89
  r.tcp
80
90
  else
81
91
  r
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/riemann/tools/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'riemann-tools'
7
+ spec.version = Riemann::Tools::VERSION
8
+ spec.authors = ['Kyle Kingsbury']
9
+ spec.email = ['aphyr@aphyr.com']
10
+
11
+ spec.summary = 'Utilities which submit events to Riemann.'
12
+ spec.description = 'Collection of utilities which submit events to Riemann,'
13
+ spec.homepage = 'https://github.com/aphyr/riemann-tools'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
16
+
17
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org/'
18
+
19
+ spec.metadata['homepage_uri'] = spec.homepage
20
+ spec.metadata['source_code_uri'] = spec.homepage
21
+ spec.metadata['changelog_uri'] = spec.homepage
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
+ end
28
+ spec.bindir = 'bin'
29
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
30
+ spec.require_paths = ['lib']
31
+
32
+ spec.add_runtime_dependency 'json', '>= 1.8'
33
+ spec.add_runtime_dependency 'optimist', '~> 3.0', '>= 3.0.0'
34
+ spec.add_runtime_dependency 'riemann-client', '~> 1.0'
35
+
36
+ spec.add_development_dependency 'github_changelog_generator'
37
+ spec.add_development_dependency 'rake'
38
+ spec.add_development_dependency 'rspec'
39
+ end
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2011 Kyle Kingsbury
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,54 @@
1
+ # Riemann AWS tools
2
+
3
+ Gathers various AWS services statistics and submits them to Riemann.
4
+
5
+ ## Getting started
6
+
7
+ ```
8
+ gem install riemann-aws
9
+ ```
10
+
11
+ ## AWS Commands
12
+
13
+
14
+ ### Riemann AWS Billing
15
+
16
+ ```
17
+ riemann-aws-billing --help
18
+ ```
19
+
20
+ ### Riemann AWS RDS Status
21
+
22
+ ```
23
+ riemann-aws-rds-status --help
24
+ ```
25
+
26
+ ### Riemann AWS SQS Status
27
+
28
+ ```
29
+ riemann-aws-sqs-status --help
30
+ ```
31
+
32
+ ### Riemann AWS Status
33
+
34
+ ```
35
+ riemann-aws-status --help
36
+ ```
37
+
38
+ ### Riemann ELB Metrics
39
+
40
+ ```
41
+ riemann-elb-metrics --help
42
+ ```
43
+
44
+ ### Riemann S3 Status by asking Cloudwatch
45
+
46
+ ```
47
+ riemann-s3-status --help
48
+ ```
49
+
50
+ ### Riemann S3 Count by listing objects
51
+
52
+ ```
53
+ riemann-s3-list --help
54
+ ```
@@ -0,0 +1,35 @@
1
+ require 'rubygems'
2
+ require 'rubygems/package_task'
3
+ require 'rdoc/task'
4
+ require 'find'
5
+
6
+ # Don't include resource forks in tarballs on Mac OS X.
7
+ ENV['COPY_EXTENDED_ATTRIBUTES_DISABLE'] = 'true'
8
+ ENV['COPYFILE_DISABLE'] = 'true'
9
+
10
+ # Gemspec
11
+ gemspec = Gem::Specification.new do |s|
12
+ s.rubyforge_project = 'riemann-aws'
13
+
14
+ s.name = 'riemann-aws'
15
+ s.version = '0.1.4'
16
+ s.author = 'Kyle Kingsbury'
17
+ s.email = 'aphyr@aphyr.com'
18
+ s.homepage = 'https://github.com/riemann/riemann-tools'
19
+ s.platform = Gem::Platform::RUBY
20
+ s.summary = 'Submits AWS stats to riemann.'
21
+ s.license = 'MIT'
22
+
23
+ s.add_dependency 'riemann-tools', '>= 0.2.13'
24
+ s.add_dependency 'fog', '>= 1.4.0'
25
+ s.add_dependency 'json'
26
+
27
+ s.files = FileList['bin/*', 'LICENSE', 'README.md'].to_a
28
+ s.executables |= Dir.entries('bin/')
29
+ s.has_rdoc = false
30
+
31
+ s.required_ruby_version = '>= 1.8.7'
32
+ end
33
+
34
+ Gem::PackageTask.new gemspec do |p|
35
+ end