require 'statsd'
statsd = Statsd.new('localhost', 8125).tap{|sd| sd.namespace = 'account'}
1.times do
statsd.increment 'hitcount4'
end
sleep 5
5.times do
statsd.increment 'hitcount4'
end
sleep 10
10.times do
statsd.increment 'hitcount4'
end
我正在使用红宝石statsd-ruby
我运行了上面的脚本,它成功执行,图形出现了,但我只能看到 x 轴上的一条线,什么也没有(y 轴没有值),如何获取上面脚本的图形?
我想记录每个增量调用。
/opt/graphite/statsd/local.js 的内容
{
graphitePort: 2003
, graphiteHost: "127.0.0.1"
, port: 8125
, backends: [ "./backends/graphite", "./backends/repeater", "./backends/console" ]
, repeater: [ { host: '10.1.2.15', port: 8125 } ]
, graphite: { legacyNamespace: false, globalPrefix: "rtpg.testing_server_2" }
, flushInterval: 10
}
/opt/graphite/conf/storage-schemas.conf 的内容
[carbon]
pattern = ^carbon\.
retentions = 60:90d
[stats]
pattern = ^stats.*
retentions = 1s:6h,10min:10d,10min:5y
[rtpg]
pattern = ^rtpg.*
retentions = 1s:7d,10s:21d,60s:5y
/opt/graphite/conf/storage-aggregation.conf 的内容
[rtpg]
pattern = .*
xFilesFactor = 0
aggregationMethod = sum
[sum]
pattern = \.count$
xFilesFactor = 0
aggregationMethod = sum
和,
localhost:8090/render?target=rtpg.testing_server_2.counters.account.hitcount4.count&format=raw
浏览器输出=>
..........0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
和
//localhost:8090/render?target=rtpg.testing_server_2.counters.account.hitcount4.count&format=json
输出 =>
.....................[0.0, 1381608024], [0.0, 1381608025], [0.0, 1381608026], [0.0, 1381608027], [0.0, 1381608028], [0.0, 1381608029], [0.0, 1381608030], [0.0, 1381608031], [0.0, 1381608032], [0.0, 1381608033], [0.0, 1381608034], [0.0, 130.6,133816080860.8], [0.0, 1381608033] ,1381608037],[0.0,1381608038],[0.0,1381608039],[0.0,1381608040],[0.0,1381608041],[0.0,1381608041],[0.0,1381608042] ], [0.0, 1381608046], [0.0, 1381608047], [0.0, 1381608048], [0.0, 1381608049], [0.0, 1381608050], [0.0, 1381608051], [0.0, 80816,18102]6. [0.0, 1381608054], [0.0, 1381608055], [0.0, 1381608056]]}]
我将flush intervel(statsd)更新为6000,并更新了
/opt/graphite/conf/storage-schemas.conf
[carbon]
pattern = ^carbon\.
retentions = 60:90d
[rtpg]
pattern = ^rtpg.*
retentions = 1m:6h,1m:7d,10m:5y
并在我的脚本中运行whisper-resize.py并将计数器名称更新为'hitcount6'并再次运行脚本,创建了一个新图形,问题仍然存在,实际上我想要的是石墨显示第一个增量的精确计数,然后睡眠 5 分钟,然后 5 次增量,依此类推,我不想平均我的数据,最后我将创建一个 xml 报告,说明调用了多少次增量方法。$ Whisper-info.py /opt/graphite/storage/whisper/rtpg/testing_server_2/counters/account/hitcount6/count.wsp
maxRetention: 604800
xFilesFactor: 0.0
aggregationMethod: sum
fileSize: 120988
Archive 0
retention: 604800
secondsPerPoint: 60
points: 10080
size: 120960
offset: 28