← Back to team overview

graphite-dev team mailing list archive

Re: [Question #237433]: Ability to extend Graphite with alerts/hooks system

 

Question #237433 on Graphite changed:
https://answers.launchpad.net/graphite/+question/237433

Brian Lalor proposed the following answer:
On Oct 16, 2013, at 7:26 AM, Yury Smolsky
<question237433@xxxxxxxxxxxxxxxxxxxxx> wrote:

> Can you please provide more details how you have implemented the proxy
> for carbon-cache? Any chances to see sources snippets for that? :)

Rather than having clients sending directly to carbon-cache on port
2003, I moved carbon-cache to 2002, started my proxy on 2003, and have
the proxy send data to carbon-cache on 2002.

I wrote this module for Node.js: https://npmjs.org/package/carbon-
streams

The sample code looks something like this:

var carbon = require("carbon");

var carbonListener = new carbon.TCP(2003);
var carbonWriter = new carbon.Writer("127.0.0.1", 2002);

// pass the data straight through
carbonListener.pipe(carbonWriter);

// capture metrics so they can be sent elsewhere
carbonListener.on("data", function(metricFrame) {
    var metric    = metricFrame[0];
    var value     = metricFrame[1];
    var timestamp = metricFrame[2];

    // do something with the metric value
});

-- 
You received this question notification because you are a member of
graphite-dev, which is an answer contact for Graphite.