Search code examples
javascriptelasticsearchcubism.js

Cubism and metrics in Elasticsearch (statsd/diamond)


In a test environment setup, I'm using diamond to send server stats and metrics to statsd and then using statsd's elasticsearch backend to send them to elasticsearch.

The elasticsearch data looks like this:

{
  "hits" : {
    "hits" : [ {
      "_source":{"ns":"servers","grp":"server1","tgt":"vmstat","act":"pswpout","val":"0","@timestamp":"1438565055000"}
    }, {
      "_source":{"ns":"servers","grp":"server1","tgt":"vmstat","act":"pgpgin","val":"0","@timestamp":"1438565055000"}
    }, {
      "_source":{"ns":"servers","grp":"server1","tgt":"vmstat","act":"pswpin","val":"0","@timestamp":"1438565055000"}
    }, {
      "_source":{"ns":"servers","grp":"server1","tgt":"cpu","act":"total.nice","val":"0","@timestamp":"1438565055000"}
    }, {
      "_source":{"ns":"servers","grp":"server1","tgt":"cpu","act":"total.irq","val":"0","@timestamp":"1438565055000"}
    }, {
      "_source":{"ns":"servers","grp":"server1","tgt":"cpu","act":"total.guest","val":"0","@timestamp":"1438565055000"}
    }, {
      "_source":{"ns":"servers","grp":"server1","tgt":"diskspace","act":"_logs.byte_used","val":"209944576","@timestamp":"1438565055000"}
    }, {
      "_source":{"ns":"servers","grp":"server1","tgt":"diskspace","act":"_logs.byte_free","val":"887513440256","@timestamp":"1438565055000"}
    }, {
      "_source":{"ns":"servers","grp":"server1","tgt":"diskspace","act":"_logs.byte_avail","val":"842419666944","@timestamp":"1438565055000"}
    }, {
      "_source":{"ns":"servers","grp":"server1","tgt":"diskspace","act":"_logs.inodes_used","val":"11","@timestamp":"1438565055000"}
    } ]
  }
}

How would I go about having this data rendered using cubism? I can extract the data using elasticsearch.js, but just generally stumped about how I would go about getting this rendered, so that, I can visualize the time-series data for each of the different actions, for instance.


Solution

  • You can try https://github.com/bernd/statsd-influxdb-backend or http://graphite.wikidot.com backend. For those backend http://grafana.org/ provides great visualisation tools.

    If you choose Graphite cubism actually supports it too as a data provider according to their website: https://square.github.io/cubism/