Intended for slightly more advanced users, the pickle protocol is a more efficient take on the plaintext protocol, and supports sending metrics to Hosted Graphite in batches.
Pickled data forms a list of multi-level tuples:
[(path, (timestamp, value)), ...]
You’ll need to pack your pickled data into a packet containing a simple header:
Once you’ve formed a list of sufficient size and pickled it, like message above, send the data over a TCP socket to carbon.hostedgraphite.com:2004.
Your API Key is prefixed to the metricname as per regular Python methods:
"YOUR-API-KEY.my.metric.name"
If you have any trouble or any questions, contact us.
Carbon Relay
If you would prefer to use a carbon-relay daemon to send metric data to Hosted Graphite, just configure it to use carbon.hostedgraphite.com:2004 as a DESTINATION in your carbon.conf and relay-rules.conf files.
If you’re currently using the carbon-cache daemon and would like to utilize carbon-relay to send your metrics to us and also to your own carbon instance, you will have to send metrics to carbon-relay instead of carbon.
To do this, you have to configure carbon-relay to listen on the port that your current carbon-cache is listening. Then you will need to configure carbon-cache to listen on a new port.
You can then add your carbon-cache instance as a DESTINATION to have carbon-relay forward all metrics to Hosted Graphite AND your local carbon-cache
current carbon.conf:
This should be changed to:
new carbon.conf:
relay-rules.conf
If you’re doing this and you’d like to avoid prefixing every metric with your API key, please contact us to discuss alternatives, including IP whitelisting, reach out for our live chat support.
Carbon Relay Secured With Stunnel
If you want to encrypt the metric data from your Carbon Relay, you can use Stunnel. Carbon-Relay should be configured to send metrics to Stunnel over localhost
To install Stunnel:
Configuring Stunnel
Stunnel will need a configuration file. By default, Stunnel will look at /etc/stunnel/stunnel.conf. You may need to create this file yourself.
Put the following lines inside /etc/stunnel/stunnel.conf:
foreground = yes
This shows the degbug logs. You may want to remove this line once Stunnel is configured and running correctly.
accept = <port>
Carbon relay must be configured to send metrics to <port>.