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"

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