Monitoring statsd

Sensor (Data Collection)

The Instana agent doubles as a statsd collector daemon and can be used instead of a real statsd daemon. Using the standard statsd protocol of any client library, when data is sent to the sensor, all reported custom metrics are displayed on the host dashboard. This is the host that the agent is receiving data on.

Configuration

By default, the statsd sensor is disabled. To enable the sensor, edit the agent configuration file <agent_install_dir>/etc/instana/configuration.yaml:

com.instana.plugin.statsd:
  enabled: true
  ports:
    udp: 8125
    mgmt: 8126
  bind-ip: "0.0.0.0" # all IPs by default
  flush-interval: 10 # in seconds

Note: Do not run the regular statsd service, it will prevent the agent from listening on these ports. Run only the agent, which will act as statsd server.

Metrics transmission

Via UDP, metrics are sent to the configured UDP port in the statsd format. For information about the format, see the statsd documentation.

For example, the following script increments a counter called hits by one:

echo "hits:1|c" | nc -u -w0 127.0.0.1 8125

Using \n as a separator, multiple metrics are sent via UDP to the configured UDP port in the statsd format:

echo "hits:1|c\nlatency:320|ms\nvisits:333|g\nresponse time:765|s" | nc -u -w0 127.0.0.1 8125