0
votes

I was using the following instructions to install and configure StatsD on a Graphite server:

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

Now that I have a server with StatsD running, I do not see the metrics being logged under /var/log/statsd/statsd.log when I am testing sending them from the command line. Here is what I see:

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

The log stays at the last entry of 'numStats: 3', even though I keep entering different metrics at the command line.

Here are a sample of the metrics I entered:

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

Of interest, I see this under /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)

Here is what my localConfig.js file looks like:

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

Would anybody be able to shed some light as to where the problem lies?

Thanks!

1
The error says that the statsd address is already in use. Can you verify this with netstat -l before trying to start statsd? You can also benefit from trying to start statsd manually instead of the upstart ubuntu script to debug.dukebody
When I run netstat, I see 8126 twice, one TCP and listening state, the other UDP with no state listed.chrisd

1 Answers

0
votes

There is a management interface available by default on port 8126: https://github.com/etsy/statsd/blob/master/docs/admin_interface.md

You likely have another service listening on that port in the same system.

Try this:

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

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