riemann-tools 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 603ad6a76396ab1ac722944ae07ec949dd2c4a89
4
+ data.tar.gz: 0e58d12f1010c6cea9ef3025bb10b89366e7e58f
5
+ SHA512:
6
+ metadata.gz: bd29968ed635f6c6c81760cdc8160a12b0066609a2c01a63381020787a30a2d3ae16d69e7c53889d1025f6713b3ea75a35f369c2a7c526f5244fe1aa22609993
7
+ data.tar.gz: 174f7b2263f26edfb15b38a82fc1b47ace907f1cfa2eda2e74115e46483f04039fd306ba61512f714cc46183e88d49b8268645a9f0cb2617fa8033e5bbdbcd23
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Collects Apache metrics and submits them to Riemann
4
+ # More information can be found at http://httpd.apache.org/docs/2.4/mod/mod_status.html
5
+
6
+ # Removes whitespace from 'Total Accesses' and 'Total kBytes' for output to graphite
7
+
8
+ require File.expand_path('../../lib/riemann/tools', __FILE__)
9
+
10
+ class Riemann::Tools::ApacheStatus
11
+ include Riemann::Tools
12
+ require 'net/http'
13
+ require 'uri'
14
+
15
+ opt :uri, 'Apache Server Status URI', :default => 'http://localhost/server-status'
16
+
17
+ def initialize
18
+ @uri = URI.parse(opts[:uri]) + '?auto'
19
+ # Sample Response with ExtendedStatus On
20
+ # Total Accesses: 20643
21
+ # Total kBytes: 36831
22
+ # CPULoad: .0180314
23
+ # Uptime: 43868
24
+ # ReqPerSec: .470571
25
+ # BytesPerSec: 859.737
26
+ # BytesPerReq: 1827.01
27
+ # BusyWorkers: 6
28
+ # IdleWorkers: 94
29
+ # Scoreboard: ___K_____K____________W_
30
+
31
+ @scoreboard_map = { '_' => 'waiting', 'S' => 'starting', 'R' => 'reading', 'W' => 'sending',
32
+ 'K' => 'keepalive', 'D' => 'dns', 'C' => 'closing', 'L' => 'logging', 'G' => 'graceful',
33
+ 'I' => 'idle', '.' => 'open' }
34
+ end
35
+
36
+
37
+ def get_scoreboard_metrics(response)
38
+ results = Hash.new(0)
39
+
40
+ response.slice! 'Scoreboard: '
41
+ response.each_char do |char|
42
+ results[char] += 1
43
+ end
44
+ Hash[results.map { |k, v| [@scoreboard_map[k], v] }]
45
+ end
46
+
47
+ def report_metrics(metrics)
48
+ metrics.each do |k, v|
49
+ report(
50
+ :service => "httpd #{k}",
51
+ :metric => v.to_f,
52
+ :state => 'ok',
53
+ :tags => ['httpd']
54
+ )
55
+ end
56
+ end
57
+
58
+ def get_connection
59
+ response = nil
60
+ begin
61
+ response = Net::HTTP.get(@uri)
62
+ rescue => e
63
+ report(
64
+ :service => 'httpd health',
65
+ :state => 'critical',
66
+ :description => 'Httpd connection error: #{e.class} - #{e.message}',
67
+ :tags => ['httpd']
68
+ )
69
+ else
70
+ report(
71
+ :service => 'httpd health',
72
+ :state => 'ok',
73
+ :description => 'Httpd connection status ok',
74
+ :tags => ['httpd']
75
+ )
76
+ end
77
+ response
78
+ end
79
+
80
+ def tick
81
+ unless (response = get_connection).nil?
82
+ response.each_line do |line|
83
+ metrics = Hash.new
84
+
85
+ if line =~ /Scoreboard/
86
+ metrics = get_scoreboard_metrics(line.strip)
87
+ else
88
+ key, value = line.strip.split(':')
89
+ metrics[key.gsub(/\s/, '')] = value
90
+ end
91
+ report_metrics(metrics)
92
+ end
93
+ end
94
+ end
95
+
96
+ end
97
+
98
+ Riemann::Tools::ApacheStatus.run
data/bin/riemann-riak CHANGED
@@ -114,7 +114,7 @@ class Riemann::Tools::Riak
114
114
  end
115
115
 
116
116
  def check_disk
117
- gb = `du -s #{opts[:data_dir]}`.split(/\s+/).first.to_i / (1024.0**2)
117
+ gb = `du -Ls #{opts[:data_dir]}`.split(/\s+/).first.to_i / (1024.0**2)
118
118
  report(
119
119
  :host => opts[:riak_host],
120
120
  :service => 'riak disk',
metadata CHANGED
@@ -1,142 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riemann-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Kyle Kingsbury
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-12-10 00:00:00.000000000 Z
11
+ date: 2014-01-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: riemann-client
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.2.2
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.2.2
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: trollop
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: 1.16.2
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: 1.16.2
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: munin-ruby
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: 0.2.1
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: 0.2.1
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: yajl-ruby
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: 1.1.0
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: 1.1.0
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: redis
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: 3.0.2
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: 3.0.2
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: fog
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: 1.4.0
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: 1.4.0
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: faraday
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: 0.8.5
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: 0.8.5
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: nokogiri
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - '>='
132
116
  - !ruby/object:Gem::Version
133
117
  version: 1.5.6
134
118
  type: :runtime
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - '>='
140
123
  - !ruby/object:Gem::Version
141
124
  version: 1.5.6
142
125
  description: Utilities which submit events to Riemann.
@@ -150,6 +133,7 @@ executables:
150
133
  - riemann-bench
151
134
  - riemann-proc
152
135
  - riemann-fd
136
+ - riemann-apache-status
153
137
  - riemann-cloudant
154
138
  - riemann-resmon
155
139
  - riemann-elasticsearch
@@ -169,54 +153,54 @@ extensions: []
169
153
  extra_rdoc_files: []
170
154
  files:
171
155
  - lib/riemann/tools.rb
172
- - bin/riemann-riak-ring
173
- - bin/riemann-riak-keys
174
- - bin/riemann-memcached
175
- - bin/riemann-elb-metrics
176
- - bin/riemann-net
156
+ - bin/riemann-apache-status
157
+ - bin/riemann-aws-status
177
158
  - bin/riemann-bench
178
- - bin/riemann-proc
179
- - bin/riemann-fd
180
159
  - bin/riemann-cloudant
181
- - bin/riemann-resmon
160
+ - bin/riemann-diskstats
182
161
  - bin/riemann-elasticsearch
162
+ - bin/riemann-elb-metrics
163
+ - bin/riemann-fd
164
+ - bin/riemann-freeswitch
165
+ - bin/riemann-haproxy
166
+ - bin/riemann-health
183
167
  - bin/riemann-kvminstance
184
- - bin/riemann-rabbitmq
168
+ - bin/riemann-memcached
185
169
  - bin/riemann-munin
186
- - bin/riemann-riak
187
- - bin/riemann-redis-slowlog
188
- - bin/riemann-haproxy
189
- - bin/riemann-freeswitch
190
- - bin/riemann-aws-status
170
+ - bin/riemann-net
191
171
  - bin/riemann-nginx-status
172
+ - bin/riemann-proc
173
+ - bin/riemann-rabbitmq
192
174
  - bin/riemann-redis
193
- - bin/riemann-diskstats
194
- - bin/riemann-health
175
+ - bin/riemann-redis-slowlog
176
+ - bin/riemann-resmon
177
+ - bin/riemann-riak
178
+ - bin/riemann-riak-keys
179
+ - bin/riemann-riak-ring
195
180
  - LICENSE
196
181
  - README.markdown
197
182
  homepage: https://github.com/aphyr/riemann-tools
198
183
  licenses:
199
184
  - MIT
185
+ metadata: {}
200
186
  post_install_message:
201
187
  rdoc_options: []
202
188
  require_paths:
203
189
  - lib
204
190
  required_ruby_version: !ruby/object:Gem::Requirement
205
- none: false
206
191
  requirements:
207
- - - ! '>='
192
+ - - '>='
208
193
  - !ruby/object:Gem::Version
209
194
  version: 1.8.7
210
195
  required_rubygems_version: !ruby/object:Gem::Requirement
211
- none: false
212
196
  requirements:
213
- - - ! '>='
197
+ - - '>='
214
198
  - !ruby/object:Gem::Version
215
199
  version: '0'
216
200
  requirements: []
217
201
  rubyforge_project: riemann-tools
218
- rubygems_version: 1.8.23
202
+ rubygems_version: 2.1.11
219
203
  signing_key:
220
- specification_version: 3
204
+ specification_version: 4
221
205
  summary: Utilities which submit events to Riemann.
222
206
  test_files: []