riemann-tools 0.2.14 → 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.
- 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 +14 -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 +1 -0
- 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 +19 -11
- data/bin/riemann-kvminstance +1 -0
- data/bin/riemann-memcached +1 -0
- data/bin/riemann-net +1 -0
- data/bin/riemann-nginx-status +1 -0
- data/bin/riemann-ntp +1 -0
- data/bin/riemann-portcheck +1 -0
- data/bin/riemann-proc +1 -0
- 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 +12 -2
- 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 +134 -34
@@ -0,0 +1,147 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
Process.setproctitle($0)
|
3
|
+
|
4
|
+
require 'riemann/tools'
|
5
|
+
|
6
|
+
class Riemann::Tools::Marathon
|
7
|
+
include Riemann::Tools
|
8
|
+
|
9
|
+
require 'faraday'
|
10
|
+
require 'json'
|
11
|
+
require 'uri'
|
12
|
+
|
13
|
+
opt :read_timeout, 'Faraday read timeout', type: :int, default: 2
|
14
|
+
opt :open_timeout, 'Faraday open timeout', type: :int, default: 1
|
15
|
+
opt :path_prefix, 'Marathon path prefix for proxied installations e.g. "marathon" for target http://localhost/marathon/metrics', default: "/"
|
16
|
+
opt :marathon_host, 'Marathon host', default: "localhost"
|
17
|
+
opt :marathon_port, 'Marathon port', type: :int, default: 8080
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
options[:interval] = 60
|
21
|
+
options[:ttl] = 120
|
22
|
+
end
|
23
|
+
|
24
|
+
# Handles HTTP connections and GET requests safely
|
25
|
+
def safe_get(uri)
|
26
|
+
# Handle connection timeouts
|
27
|
+
response = nil
|
28
|
+
begin
|
29
|
+
connection = Faraday.new(uri)
|
30
|
+
response = connection.get do |req|
|
31
|
+
req.options[:timeout] = options[:read_timeout]
|
32
|
+
req.options[:open_timeout] = options[:open_timeout]
|
33
|
+
end
|
34
|
+
rescue => e
|
35
|
+
report(:host => uri.host,
|
36
|
+
:service => "marathon health",
|
37
|
+
:state => "critical",
|
38
|
+
:description => "HTTP connection error: #{e.class} - #{e.message}"
|
39
|
+
)
|
40
|
+
end
|
41
|
+
response
|
42
|
+
end
|
43
|
+
|
44
|
+
def health_url
|
45
|
+
path_prefix = options[:path_prefix]
|
46
|
+
path_prefix[0] = '' if path_prefix[0]=='/'
|
47
|
+
path_prefix[path_prefix.length-1] = '' if path_prefix[path_prefix.length-1]=='/'
|
48
|
+
"http://#{options[:marathon_host]}:#{options[:marathon_port]}#{path_prefix.length>0?'/':''}#{path_prefix}/metrics"
|
49
|
+
end
|
50
|
+
|
51
|
+
def apps_url
|
52
|
+
path_prefix = options[:path_prefix]
|
53
|
+
path_prefix[0] = '' if path_prefix[0]=='/'
|
54
|
+
path_prefix[path_prefix.length-1] = '' if path_prefix[path_prefix.length-1]=='/'
|
55
|
+
"http://#{options[:marathon_host]}:#{options[:marathon_port]}#{path_prefix.length>0?'/':''}#{path_prefix}/v2/apps"
|
56
|
+
end
|
57
|
+
|
58
|
+
def tick
|
59
|
+
tick_health
|
60
|
+
tick_apps
|
61
|
+
end
|
62
|
+
|
63
|
+
def tick_health
|
64
|
+
uri = URI(health_url)
|
65
|
+
response = safe_get(uri)
|
66
|
+
|
67
|
+
return if response.nil?
|
68
|
+
|
69
|
+
if response.status != 200
|
70
|
+
report(:host => uri.host,
|
71
|
+
:service => "marathon health",
|
72
|
+
:state => "critical",
|
73
|
+
:description => "HTTP connection error: #{response.status} - #{response.body}"
|
74
|
+
)
|
75
|
+
else
|
76
|
+
# Assuming that a 200 will give json
|
77
|
+
json = JSON.parse(response.body)
|
78
|
+
state = "ok"
|
79
|
+
|
80
|
+
report(:host => uri.host,
|
81
|
+
:service => "marathon health",
|
82
|
+
:state => state)
|
83
|
+
|
84
|
+
json.each_pair do |t, d|
|
85
|
+
if d.respond_to? :each_pair
|
86
|
+
d.each_pair do |service, counters|
|
87
|
+
report(:host => uri.host,
|
88
|
+
:service => "marathon_metric #{t} #{service}",
|
89
|
+
:metric => 1,
|
90
|
+
:tags => ["metric_name"],
|
91
|
+
:ttl => 600
|
92
|
+
)
|
93
|
+
if counters.respond_to? :each_pair
|
94
|
+
counters.each_pair do |k, v|
|
95
|
+
if v.is_a? Numeric
|
96
|
+
report(:host => uri.host,
|
97
|
+
:service => "marathon #{service} #{k}",
|
98
|
+
:metric => v,
|
99
|
+
:tags => ["metric", "#{t}"],
|
100
|
+
:ttl => 600
|
101
|
+
)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def tick_apps
|
112
|
+
uri = URI(apps_url)
|
113
|
+
response = safe_get(uri)
|
114
|
+
|
115
|
+
return if response.nil?
|
116
|
+
|
117
|
+
if response.status != 200
|
118
|
+
report(:host => uri.host,
|
119
|
+
:service => "marathon health",
|
120
|
+
:state => "critical",
|
121
|
+
:description => "HTTP connection error: #{response.status} - #{response.body}"
|
122
|
+
)
|
123
|
+
else
|
124
|
+
# Assuming that a 200 will give json
|
125
|
+
json = JSON.parse(response.body)
|
126
|
+
state = "ok"
|
127
|
+
|
128
|
+
report(:host => uri.host,
|
129
|
+
:service => "marathon health",
|
130
|
+
:state => state)
|
131
|
+
|
132
|
+
json["apps"].each do |app|
|
133
|
+
app.each_pair do |k, v|
|
134
|
+
if v.is_a? Numeric
|
135
|
+
report(:host => uri.host,
|
136
|
+
:service => "marathon apps#{app["id"]}/#{k}",
|
137
|
+
:metric => v,
|
138
|
+
:ttl => 120
|
139
|
+
)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
Riemann::Tools::Marathon.run
|
147
|
+
|
@@ -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,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-mesos'
|
13
|
+
|
14
|
+
s.name = 'riemann-mesos'
|
15
|
+
s.version = '0.1.2'
|
16
|
+
s.author = 'Giulio Eulisse'
|
17
|
+
s.email = 'giulio.eulisse@cern.ch'
|
18
|
+
s.homepage = 'https://github.com/riemann/riemann-tools'
|
19
|
+
s.platform = Gem::Platform::RUBY
|
20
|
+
s.summary = 'Submits mesos stats to riemann.'
|
21
|
+
s.license = 'MIT'
|
22
|
+
|
23
|
+
s.add_dependency 'riemann-tools', '>= 0.2.13'
|
24
|
+
s.add_dependency 'faraday', '>= 0.8.5'
|
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
|
@@ -0,0 +1,131 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
Process.setproctitle($0)
|
3
|
+
|
4
|
+
require 'riemann/tools'
|
5
|
+
|
6
|
+
class Riemann::Tools::Mesos
|
7
|
+
include Riemann::Tools
|
8
|
+
|
9
|
+
require 'faraday'
|
10
|
+
require 'json'
|
11
|
+
require 'uri'
|
12
|
+
|
13
|
+
opt :read_timeout, 'Faraday read timeout', type: :int, default: 2
|
14
|
+
opt :open_timeout, 'Faraday open timeout', type: :int, default: 1
|
15
|
+
opt :path_prefix, 'Mesos path prefix for proxied installations e.g. "mesos" for target http://localhost/mesos/metrics/snapshot', default: "/"
|
16
|
+
opt :mesos_host, 'Mesos host', default: "localhost"
|
17
|
+
opt :mesos_port, 'Mesos port', type: :int, default: 5050
|
18
|
+
|
19
|
+
# Handles HTTP connections and GET requests safely
|
20
|
+
def safe_get(uri)
|
21
|
+
# Handle connection timeouts
|
22
|
+
response = nil
|
23
|
+
begin
|
24
|
+
connection = Faraday.new(uri)
|
25
|
+
response = connection.get do |req|
|
26
|
+
req.options[:timeout] = options[:read_timeout]
|
27
|
+
req.options[:open_timeout] = options[:open_timeout]
|
28
|
+
end
|
29
|
+
rescue => e
|
30
|
+
report(:host => uri.host,
|
31
|
+
:service => "mesos health",
|
32
|
+
:state => "critical",
|
33
|
+
:description => "HTTP connection error: #{e.class} - #{e.message}"
|
34
|
+
)
|
35
|
+
end
|
36
|
+
response
|
37
|
+
end
|
38
|
+
|
39
|
+
def health_url
|
40
|
+
path_prefix = options[:path_prefix]
|
41
|
+
path_prefix[0] = '' if path_prefix[0]=='/'
|
42
|
+
path_prefix[path_prefix.length-1] = '' if path_prefix[path_prefix.length-1]=='/'
|
43
|
+
"http://#{options[:mesos_host]}:#{options[:mesos_port]}#{path_prefix.length>0?'/':''}#{path_prefix}/metrics/snapshot"
|
44
|
+
end
|
45
|
+
|
46
|
+
def slaves_url
|
47
|
+
path_prefix = options[:path_prefix]
|
48
|
+
path_prefix[0] = '' if path_prefix[0]=='/'
|
49
|
+
path_prefix[path_prefix.length-1] = '' if path_prefix[path_prefix.length-1]=='/'
|
50
|
+
"http://#{options[:mesos_host]}:#{options[:mesos_port]}#{path_prefix.length>0?'/':''}#{path_prefix}/master/slaves"
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
def tick
|
55
|
+
tick_slaves
|
56
|
+
uri = URI(health_url)
|
57
|
+
response = safe_get(uri)
|
58
|
+
|
59
|
+
return if response.nil?
|
60
|
+
|
61
|
+
if response.status != 200
|
62
|
+
report(:host => uri.host,
|
63
|
+
:service => "mesos health",
|
64
|
+
:state => "critical",
|
65
|
+
:description => "HTTP connection error: #{response.status} - #{response.body}"
|
66
|
+
)
|
67
|
+
else
|
68
|
+
# Assuming that a 200 will give json
|
69
|
+
json = JSON.parse(response.body)
|
70
|
+
state = "ok"
|
71
|
+
|
72
|
+
report(:host => uri.host,
|
73
|
+
:service => "mesos health",
|
74
|
+
:state => state)
|
75
|
+
|
76
|
+
json.each_pair do |k,v|
|
77
|
+
report(:host => uri.host,
|
78
|
+
:service => "mesos #{k}",
|
79
|
+
:metric => v
|
80
|
+
)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def tick_slaves
|
86
|
+
uri = URI(slaves_url)
|
87
|
+
response = safe_get(uri)
|
88
|
+
|
89
|
+
return if response.nil?
|
90
|
+
|
91
|
+
if response.status != 200
|
92
|
+
report(:host => uri.host,
|
93
|
+
:service => "mesos health",
|
94
|
+
:state => "critical",
|
95
|
+
:description => "HTTP connection error: #{response.status} - #{response.body}"
|
96
|
+
)
|
97
|
+
else
|
98
|
+
# Assuming that a 200 will give json
|
99
|
+
json = JSON.parse(response.body)
|
100
|
+
state = "ok"
|
101
|
+
|
102
|
+
report(:host => uri.host,
|
103
|
+
:service => "mesos health",
|
104
|
+
:state => state)
|
105
|
+
|
106
|
+
json["slaves"].each do |slave|
|
107
|
+
if slave.respond_to? "each_pair"
|
108
|
+
slave.each_pair do |k,v|
|
109
|
+
if v.respond_to? "each_pair"
|
110
|
+
v.each_pair do |k1,v1|
|
111
|
+
if v1.is_a? Numeric
|
112
|
+
report(:host => slave["hostname"],
|
113
|
+
:service => "mesos slave/#{k}/#{k1}",
|
114
|
+
:metric => v1
|
115
|
+
)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
elsif v.is_a? Numeric
|
119
|
+
report(:host => slave["hostname"],
|
120
|
+
:service => "mesos slave/#{k}",
|
121
|
+
:metric => v
|
122
|
+
)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
Riemann::Tools::Mesos.run
|
131
|
+
|
@@ -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,34 @@
|
|
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-munin'
|
13
|
+
|
14
|
+
s.name = 'riemann-munin'
|
15
|
+
s.version = '0.1.2'
|
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 munin stats to riemann.'
|
21
|
+
s.license = 'MIT'
|
22
|
+
|
23
|
+
s.add_dependency 'riemann-tools', '>= 0.2.13'
|
24
|
+
s.add_dependency 'munin-ruby', '>= 0.2.1'
|
25
|
+
|
26
|
+
s.files = FileList['bin/*', 'LICENSE', 'README.md'].to_a
|
27
|
+
s.executables |= Dir.entries('bin/')
|
28
|
+
s.has_rdoc = false
|
29
|
+
|
30
|
+
s.required_ruby_version = '>= 1.8.7'
|
31
|
+
end
|
32
|
+
|
33
|
+
Gem::PackageTask.new gemspec do |p|
|
34
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
Process.setproctitle($0)
|
3
|
+
|
4
|
+
# Gathers munin statistics and submits them to Riemann.
|
5
|
+
|
6
|
+
require 'riemann/tools'
|
7
|
+
|
8
|
+
class Riemann::Tools::Munin
|
9
|
+
include Riemann::Tools
|
10
|
+
require 'munin-ruby'
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@munin = ::Munin::Node.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def tick
|
17
|
+
services = opts[:services] || @munin.list
|
18
|
+
services.each do |service|
|
19
|
+
@munin.fetch(service).each do |service, parts|
|
20
|
+
parts.each do |part, metric|
|
21
|
+
report(
|
22
|
+
:service => "#{service} #{part}",
|
23
|
+
:metric => metric.to_f,
|
24
|
+
:state => 'ok',
|
25
|
+
:tags => ['munin']
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
opt :munin_host, "Munin hostname", :default => 'localhost'
|
33
|
+
opt :munin_port, "Munin port", :default => 4949
|
34
|
+
opt :services, "Munin services to translate (if not specified, all services are relayed)", :type => :strings
|
35
|
+
end
|
36
|
+
|
37
|
+
Riemann::Tools::Munin.run
|
@@ -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,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-rabbitmq'
|
13
|
+
|
14
|
+
s.name = 'riemann-rabbitmq'
|
15
|
+
s.version = '0.1.3'
|
16
|
+
s.author = 'Gavin Sandie'
|
17
|
+
s.email = 'beach@vicecity.co.uk'
|
18
|
+
s.homepage = 'https://github.com/riemann/riemann-tools'
|
19
|
+
s.platform = Gem::Platform::RUBY
|
20
|
+
s.summary = 'Submits RabbitMQ stats to riemann.'
|
21
|
+
s.license = 'MIT'
|
22
|
+
|
23
|
+
s.add_dependency 'riemann-tools', '>= 0.2.13'
|
24
|
+
s.add_dependency 'faraday', '>= 0.8.5'
|
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
|