memcache2graphite 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/memcache2graphite +5 -4
- data/conf.yml +1 -1
- metadata +1 -1
data/bin/memcache2graphite
CHANGED
@@ -16,10 +16,10 @@ graphite = Graphite.new({
|
|
16
16
|
memcache_conf = conf["memcache"]
|
17
17
|
options = {}
|
18
18
|
if memcache_conf["username"]
|
19
|
-
options[:username] =
|
19
|
+
options[:username] = memcache_conf["username"]
|
20
20
|
end
|
21
21
|
if memcache_conf["password"]
|
22
|
-
options[:password] =
|
22
|
+
options[:password] = memcache_conf["password"]
|
23
23
|
end
|
24
24
|
memcache = Dalli::Client.new("#{memcache_conf.fetch("host","localhost")}:#{memcache_conf.fetch("port",11211)}", options)
|
25
25
|
|
@@ -40,9 +40,10 @@ def collect(conf, memcache, graphite, state)
|
|
40
40
|
message = {}
|
41
41
|
memcache.stats.each do |node, metrics|
|
42
42
|
metrics.select{|metric, value| metrics_filter.has_key?(metric)}.each do |metric, value|
|
43
|
-
|
43
|
+
type = metrics_filter[metric]
|
44
|
+
to_send = aggregate(metric, value, type, state)
|
44
45
|
if to_send
|
45
|
-
message["#{conf["graphite"]["root-path"]}.#{metrics_filter[metric]}.#{metric}"] = value
|
46
|
+
message["#{conf["graphite"]["root-path"].gsub(/<type>/,type)}.#{metrics_filter[metric]}.#{metric}"] = value
|
46
47
|
end
|
47
48
|
end
|
48
49
|
end
|
data/conf.yml
CHANGED