Additional & custom metrics

The Hosted Graphite Agent ships with local Carbon endpoints: you can send Graphite metrics to it as usual via udp and tcp on localhost and port 2003 (by default).

As your agent is configured to use your Hosted Graphite API key, it can accept metrics locally without any API key prefixing, and will handle authentication for you.


A quick example in Python, sending a metric via UDP:

import socket

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(" 1.2\n", ("localhost", 2003))


Any of our examples found on our language guide contain API key prefixing, and they send to <something>, so all you need to do is send to localhost instead. The API key prefixing for your metric names is optional.


You can also drop files containing metrics into /var/opt/hg-agent/drop, e.g.

my.metric 1.2
my.other.metric 3.4


which will be picked up and forwarded by the agent. This is useful particularly if you want to collect data that requires privileged access, e.g. via a small cron job.