mongodb-graphite 0.1.0 → 0.1.3
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/README.md +1 -1
- data/bin/mongodb-graphite +19 -14
- data/mongodb-graphite.gemspec +1 -1
- metadata +24 -20
data/README.md
CHANGED
@@ -5,7 +5,7 @@ Install :
|
|
5
5
|
Open the mongodb_graphite file and modify the graphite server variable to your graphite server. For exemple : "mygraphite.mydomain.com:2023"
|
6
6
|
|
7
7
|
Add the mongodb_graphite to your crontab, for instance
|
8
|
-
* * * * mongodb_graphite
|
8
|
+
* * * * mongodb_graphite "graphite.mydomain:2023"
|
9
9
|
|
10
10
|
|
11
11
|
That's all.
|
data/bin/mongodb-graphite
CHANGED
@@ -36,22 +36,12 @@ end
|
|
36
36
|
|
37
37
|
|
38
38
|
|
39
|
-
@conn = Mongo::Connection.new
|
40
39
|
|
41
40
|
|
42
|
-
@isdbgrid = {"isdbgrid" => 1}
|
43
|
-
if @conn["admin"].command(@isdbgrid)["ok"] == 1
|
44
|
-
puts "mongos"
|
45
|
-
else
|
46
|
-
puts "not mongos => you should not run this if you are not in a cluster"
|
47
|
-
end
|
48
41
|
|
49
|
-
shards = Array.new
|
50
42
|
|
51
|
-
puts @conn["config"]["shards"].find().each { |shard| shards << shard["host"] }
|
52
43
|
|
53
|
-
|
54
|
-
host,port = s.split(/,|\//)[1].split(':')
|
44
|
+
def treat_replicaset(g,to_ignore,to_convert, output_average, output_sum ,prefix_common,host,port)
|
55
45
|
#puts "shard : ", host,port
|
56
46
|
connHost = Mongo::Connection.new(host, port)
|
57
47
|
slaves = Array.new
|
@@ -75,8 +65,23 @@ shards.peach { |s|
|
|
75
65
|
output_average.each { |key| metrics[prefix+key] = metrics[prefix+key].inject(0.0) {|sum,el| sum+(el.to_i) } / metrics[prefix+key].size }
|
76
66
|
output_sum.each { |key| metrics[prefix+key] = metrics[prefix+key].inject(0) {|sum,el| sum+(el.to_i)} }
|
77
67
|
g.log(timestamp, metrics)
|
78
|
-
|
79
68
|
}
|
80
|
-
|
81
|
-
|
69
|
+
end
|
82
70
|
|
71
|
+
host='localhost'
|
72
|
+
port=27017
|
73
|
+
@conn = Mongo::Connection.new(host,port)
|
74
|
+
@isdbgrid = {"isdbgrid" => 1}
|
75
|
+
begin
|
76
|
+
@conn["admin"].command(@isdbgrid)["ok"] == 1
|
77
|
+
puts "mongos"
|
78
|
+
shards = Array.new
|
79
|
+
puts @conn["config"]["shards"].find().each { |shard| shards << shard["host"] }
|
80
|
+
shards.peach { |s|
|
81
|
+
host,port = s.split(/,|\//)[1].split(':')
|
82
|
+
treat_replicaset(g,to_ignore,to_convert, output_average, output_sum ,prefix_common,host,port)
|
83
|
+
}
|
84
|
+
rescue
|
85
|
+
puts "not mongos"
|
86
|
+
treat_replicaset(g,to_ignore,to_convert, output_average, output_sum ,prefix_common,host,port)
|
87
|
+
end
|
data/mongodb-graphite.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongodb-graphite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.3
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- "Gr\xC3\xA9goire Seux"
|
@@ -9,39 +10,41 @@ autorequire:
|
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
12
|
|
12
|
-
date: 2012-
|
13
|
-
default_executable:
|
13
|
+
date: 2012-03-09 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: mongo
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 1.5.2
|
24
|
-
|
24
|
+
type: :runtime
|
25
|
+
version_requirements: *id001
|
25
26
|
- !ruby/object:Gem::Dependency
|
26
27
|
name: graphite
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
30
31
|
requirements:
|
31
32
|
- - ">="
|
32
33
|
- !ruby/object:Gem::Version
|
33
34
|
version: 0.2.0
|
34
|
-
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id002
|
35
37
|
- !ruby/object:Gem::Dependency
|
36
38
|
name: peach
|
37
|
-
|
38
|
-
|
39
|
-
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
40
42
|
requirements:
|
41
43
|
- - ">="
|
42
44
|
- !ruby/object:Gem::Version
|
43
45
|
version: "0.4"
|
44
|
-
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id003
|
45
48
|
description: ""
|
46
49
|
email:
|
47
50
|
- g.seux@criteo.com
|
@@ -57,31 +60,32 @@ files:
|
|
57
60
|
- README.md
|
58
61
|
- bin/mongodb-graphite
|
59
62
|
- mongodb-graphite.gemspec
|
60
|
-
has_rdoc: false
|
61
63
|
homepage: https://github.com/kamaradclimber/mongodb-graphite
|
64
|
+
licenses: []
|
65
|
+
|
62
66
|
post_install_message:
|
63
67
|
rdoc_options: []
|
64
68
|
|
65
69
|
require_paths:
|
66
70
|
- lib
|
67
71
|
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
68
73
|
requirements:
|
69
74
|
- - ">="
|
70
75
|
- !ruby/object:Gem::Version
|
71
76
|
version: "0"
|
72
|
-
version:
|
73
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
74
79
|
requirements:
|
75
80
|
- - ">="
|
76
81
|
- !ruby/object:Gem::Version
|
77
82
|
version: "0"
|
78
|
-
version:
|
79
83
|
requirements: []
|
80
84
|
|
81
85
|
rubyforge_project:
|
82
|
-
rubygems_version: 1.
|
86
|
+
rubygems_version: 1.8.11
|
83
87
|
signing_key:
|
84
|
-
specification_version:
|
88
|
+
specification_version: 3
|
85
89
|
summary: ""
|
86
90
|
test_files: []
|
87
91
|
|