graphiterb 0.1.3 → 0.1.4
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.
- data/CHANGELOG +1 -0
- data/VERSION +1 -1
- data/{bin → examples}/file_monitor.rb +0 -0
- data/{bin → examples}/loadavg_graphite_sender.rb +0 -0
- data/{bin → examples}/storage_monitor.rb +0 -0
- data/{bin → examples}/toy.rb +0 -0
- data/graphiterb.gemspec +6 -9
- metadata +13 -16
- data/bin/api_call_monitor.rb +0 -51
- data/bin/run_servers.sh +0 -2
data/CHANGELOG
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
File without changes
|
File without changes
|
File without changes
|
data/{bin → examples}/toy.rb
RENAMED
File without changes
|
data/graphiterb.gemspec
CHANGED
@@ -5,14 +5,13 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{graphiterb}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Philip (flip) Kromer (@mrflip)"]
|
12
12
|
s.date = %q{2010-07-20}
|
13
13
|
s.description = %q{Uses http://github.com/mrflip/configliere and http://graphite.wikidot.com}
|
14
14
|
s.email = %q{info@infochimps.org}
|
15
|
-
s.executables = ["run_servers.sh", "toy.rb", "storage_monitor.rb", "loadavg_graphite_sender.rb", "file_monitor.rb", "api_call_monitor.rb"]
|
16
15
|
s.extra_rdoc_files = [
|
17
16
|
"LICENSE",
|
18
17
|
"README.textile"
|
@@ -25,12 +24,6 @@ Gem::Specification.new do |s|
|
|
25
24
|
"README.textile",
|
26
25
|
"Rakefile",
|
27
26
|
"VERSION",
|
28
|
-
"bin/api_call_monitor.rb",
|
29
|
-
"bin/file_monitor.rb",
|
30
|
-
"bin/loadavg_graphite_sender.rb",
|
31
|
-
"bin/run_servers.sh",
|
32
|
-
"bin/storage_monitor.rb",
|
33
|
-
"bin/toy.rb",
|
34
27
|
"graphiterb.gemspec",
|
35
28
|
"lib/graphiterb.rb",
|
36
29
|
"lib/graphiterb/graphite_logger.rb",
|
@@ -48,7 +41,11 @@ Gem::Specification.new do |s|
|
|
48
41
|
s.summary = %q{Fast Ubiquitous Dashboard Logs with Graphite (http://graphite.wikidot.com)}
|
49
42
|
s.test_files = [
|
50
43
|
"spec/graphiterb_spec.rb",
|
51
|
-
"spec/spec_helper.rb"
|
44
|
+
"spec/spec_helper.rb",
|
45
|
+
"examples/toy.rb",
|
46
|
+
"examples/storage_monitor.rb",
|
47
|
+
"examples/loadavg_graphite_sender.rb",
|
48
|
+
"examples/file_monitor.rb"
|
52
49
|
]
|
53
50
|
|
54
51
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphiterb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Philip (flip) Kromer (@mrflip)
|
@@ -50,13 +50,8 @@ dependencies:
|
|
50
50
|
version_requirements: *id002
|
51
51
|
description: Uses http://github.com/mrflip/configliere and http://graphite.wikidot.com
|
52
52
|
email: info@infochimps.org
|
53
|
-
executables:
|
54
|
-
|
55
|
-
- toy.rb
|
56
|
-
- storage_monitor.rb
|
57
|
-
- loadavg_graphite_sender.rb
|
58
|
-
- file_monitor.rb
|
59
|
-
- api_call_monitor.rb
|
53
|
+
executables: []
|
54
|
+
|
60
55
|
extensions: []
|
61
56
|
|
62
57
|
extra_rdoc_files:
|
@@ -70,12 +65,6 @@ files:
|
|
70
65
|
- README.textile
|
71
66
|
- Rakefile
|
72
67
|
- VERSION
|
73
|
-
- bin/api_call_monitor.rb
|
74
|
-
- bin/file_monitor.rb
|
75
|
-
- bin/loadavg_graphite_sender.rb
|
76
|
-
- bin/run_servers.sh
|
77
|
-
- bin/storage_monitor.rb
|
78
|
-
- bin/toy.rb
|
79
68
|
- graphiterb.gemspec
|
80
69
|
- lib/graphiterb.rb
|
81
70
|
- lib/graphiterb/graphite_logger.rb
|
@@ -85,6 +74,10 @@ files:
|
|
85
74
|
- spec/graphiterb_spec.rb
|
86
75
|
- spec/spec.opts
|
87
76
|
- spec/spec_helper.rb
|
77
|
+
- examples/toy.rb
|
78
|
+
- examples/storage_monitor.rb
|
79
|
+
- examples/loadavg_graphite_sender.rb
|
80
|
+
- examples/file_monitor.rb
|
88
81
|
has_rdoc: true
|
89
82
|
homepage: http://github.com/infochimps/graphiterb
|
90
83
|
licenses: []
|
@@ -122,3 +115,7 @@ summary: Fast Ubiquitous Dashboard Logs with Graphite (http://graphite.wikidot.c
|
|
122
115
|
test_files:
|
123
116
|
- spec/graphiterb_spec.rb
|
124
117
|
- spec/spec_helper.rb
|
118
|
+
- examples/toy.rb
|
119
|
+
- examples/storage_monitor.rb
|
120
|
+
- examples/loadavg_graphite_sender.rb
|
121
|
+
- examples/file_monitor.rb
|
data/bin/api_call_monitor.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
$: << File.dirname(__FILE__)+'/../lib/'
|
3
|
-
require 'graphiterb'
|
4
|
-
require 'graphiterb/graphite_script'
|
5
|
-
|
6
|
-
WC_EXEC = '/usr/bin/wc'
|
7
|
-
|
8
|
-
class ApiCallMonitor < Graphiterb::GraphiteLogger
|
9
|
-
API_CALLS_TO_MONITOR = %w[trstrank wordbag influence conversation]
|
10
|
-
ERROR_CODES_TO_MONITOR = %w[4.. 5.. 200]
|
11
|
-
|
12
|
-
def initialize *args
|
13
|
-
super *args
|
14
|
-
@current_total = Hash.new
|
15
|
-
@prev_total = Hash.new
|
16
|
-
end
|
17
|
-
|
18
|
-
def calls api
|
19
|
-
total_calls = `cat /var/www/apeyeye/shared/log/apeyeye-access.log | egrep 'GET /soc/net/tw/#{api}' | #{WC_EXEC} -l` rescue 0
|
20
|
-
@current_total[api] = total_calls.to_i
|
21
|
-
end
|
22
|
-
|
23
|
-
def errors error_code
|
24
|
-
log_cat = `cat /var/www/apeyeye/shared/log/apeyeye-access.log | egrep 'GET /soc/net/tw/.*HTTP/1\.[0-1]..#{error_code}' | #{WC_EXEC} -l` rescue 0
|
25
|
-
@current_total[error_code] = log_cat.to_i
|
26
|
-
end
|
27
|
-
|
28
|
-
def rate item
|
29
|
-
@prev_total[item] ||= @current_total[item]
|
30
|
-
rate = @current_total[item].to_i - @prev_total[item].to_i
|
31
|
-
@prev_total[item] = @current_total[item]
|
32
|
-
[0, rate].max
|
33
|
-
end
|
34
|
-
|
35
|
-
def get_metrics metrics, iter, since
|
36
|
-
API_CALLS_TO_MONITOR.each do |api|
|
37
|
-
metrics << [scope_name(hostname, api, 'total_accesses'), calls(api)]
|
38
|
-
metrics << [scope_name(hostname, api, 'accesses'), rate(api)]
|
39
|
-
end
|
40
|
-
ERROR_CODES_TO_MONITOR.each do |code|
|
41
|
-
metrics << [scope_name(hostname, code.gsub('.','x'), 'total_errors'), errors(code)]
|
42
|
-
metrics << [scope_name(hostname, code.gsub('.','x'), 'errors'), rate(code)]
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
|
48
|
-
warn "Update delay is #{Settings.update_delay} seconds. You probably want something larger: some of these checks are data-intensive" if Settings.update_delay < 60
|
49
|
-
Settings.die "Update delay is #{Settings.update_delay} seconds. You need to radio in at least as often as /usr/local/share/graphite/conf/storage-schemas says -- this is typically 5 minutes." if Settings.update_delay >= 300
|
50
|
-
|
51
|
-
ApiCallMonitor.new('apeyeye', :iters => nil, :time => Settings.update_delay).run!
|
data/bin/run_servers.sh
DELETED