1
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, 1381608035], [0,60,6.3.3] 、1381608037]、[0.0、1381608038]、[0.0、1381608039]、[0.0、1381608040]、[0.0、1381608041]、[0.0、1381608042]、[0.0、1381608042]、[0.0、13816043]、0.0160160160160160160160160162 ]、[0.0、1381608046]、[0.0、1381608047]、[0.0、1381608048]、[0.0、1381608049]、[0.0、1381608050]、[0.0、1381608051]、[0.0、1381608032] [0.0、1381608054]、[0.0、1381608055]、[0.0、1381608056]]}]

フラッシュ間隔(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

ここに画像の説明を入力

ここに画像の説明を入力

4

1 に答える 1