Shell

How to send metrics using Shell

Contents

Using the netcat utility

echo "YOUR-API-KEY.foo 1.2" | nc carbon.hostedgraphite.com 2003

Using the netcat utility

echo "YOUR-API-KEY.foo 1.2" | nc -uw0 carbon.hostedgraphite.com 2003

Using the Ncat utility

echo "YOUR-API-KEY.con_users 1.3" | ncat --ssl carbon.hostedgraphite.com 20030

Alternatively, the following example using OpenSSL should work out of the box in OS X:

echo "YOUR-API-KEY.con_users 1.3" |  openssl s_client -connect carbon.hostedgraphite.com:20030

Using the Curl utility

curl https://YOUR-API-KEY@www.hostedgraphite.com/api/v1/sink --data-binary "foo 1.2"

Using the Ncat utility:

echo "YOUR-API-KEY.foo.statsd:1.2|c" | nc -u -w1 statsd.hostedgraphite.com 8125

For StatsD, make sure to specify counters (c), gauges (g), or timers (ms).

curl https://YOUR-API-KEY@www.hostedgraphite.com/api/v1/sink --data-binary @data.txt

where data.txt contains multiple metrics and values on a separate line:

Your API key can be found on your account home page.

Last updated