Skip to content

Conversation

@JarleB
Copy link

@JarleB JarleB commented Dec 18, 2014

This makes it possible to find metrics based on graphite calculations. This is not possible through the "/find" endpoint and "graphite.metric" expects one specific time series metric. The following example will return the 50 highest ICMP RTT times towards a central server (collected by collectd):

var graph_regex = "highestCurrent(collectd.*.ping.icmp-beacon_example_com,50)";

graphite.find_from_metrics(graph_regex, function(error, results) {
   metrics = results.sort().map(function(i) {
       var s = i.split(".");
       return graphite.metric(i)
              .alias(s[1])
              .summarize("avg");
   });
   for (var i=0;i<metrics.length;i++) { 
     d3.select("#graphs").call(function(div) {
     div.append("div").selectAll(".horizon")
        .data([metrics[i]])
       .enter().append("div")
       .attr("class", "horizon")
       .call(context.horizon());
     });
   };
});

to find metrics based on graphite calculations, f. ex.
highestCurrent(exclude(collectd.*.ping.ping-responder_example_com,50)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant