簡體   English   中英

使用statsd發送指標

[英]Issue sending metrics with statsd

我按照以下說明在Graphite服務器上安裝和配置StatsD:

https://www.digitalocean.com/community/tutorials/how-to-configure-statsd-to-collect-arbitrary-stats-for-graphite-on-ubuntu-14-04

現在,我有一台運行StatsD的服務器,在測試從命令行發送度量時,在/var/log/statsd/statsd.log下看不到度量記錄。 這是我看到的:

29 Oct 02:30:39 - server is up
29 Oct 02:47:49 - reading config file: /etc/statsd/localConfig.js
29 Oct 02:47:49 - server is up
29 Oct 14:16:45 - reading config file: /etc/statsd/localConfig.js
29 Oct 14:16:45 - server is up
29 Oct 15:36:47 - reading config file: /etc/statsd/localConfig.js
29 Oct 15:36:47 - DEBUG: Loading server: ./servers/udp
29 Oct 15:36:47 - server is up
29 Oct 15:36:47 - DEBUG: Loading backend: ./backends/graphite
29 Oct 15:36:47 - DEBUG: numStats: 3

即使我一直在命令行中輸入不同的指標,日志仍停留在“ numStats:3”的最后一項。

以下是我輸入的指標示例:

echo "sample.gauge:14|g" | nc -u -w0 127.0.0.1 8125
echo "sample.gauge:10|g" | nc -u -w0 127.0.0.1 8125
echo "sample.count:1|c" | nc -u -w0 127.0.0.1 8125
echo "sample.set:50|s" | nc -u -w0 127.0.0.1 8125

有趣的是,我在/var/log/statsd/stderr.log下看到以下內容:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EADDRINUSE
    at errnoException (net.js:901:11)
    at Server._listen2 (net.js:1039:14)
    at listen (net.js:1061:10)
    at Server.listen (net.js:1135:5)
    at /usr/share/statsd/stats.js:383:16
    at null.<anonymous> (/usr/share/statsd/lib/config.js:40:5)
    at EventEmitter.emit (events.js:95:17)
    at /usr/share/statsd/lib/config.js:20:12
    at fs.js:268:14
    at Object.oncomplete (fs.js:107:15)

這是我的localConfig.js文件的樣子:

{
  graphitePort: 2003
, graphiteHost: "localhost"
, port: 8125
, graphite: {
    legacyNamespace: false
  },
debug: true,
dumpMessages: true
}

有人能夠闡明問題的根源嗎?

謝謝!

默認情況下,端口8126上有一個管理界面可用: https : //github.com/etsy/statsd/blob/master/docs/admin_interface.md

您可能有另一個服務在同一系統中的該端口上偵聽。

嘗試這個:

# localConfig.js
{
  graphitePort: 2003
, graphiteHost: "localhost"
, port: 8125
, mgmt_port: 8127
, graphite: {
    legacyNamespace: false
  },
  debug: true,
  dumpMessages: true
}

參見https://github.com/etsy/statsd/blob/master/exampleConfig.js#L28

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM