Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

New find method "find_from_metrics". #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant