What does it do?
- dashiki allows you to build dashboards that surface data from graphite, ganglia and other sources of time series data.
bundle install
ln -s cfg-examples cfg
rackup
- configuration files should like under cfg/. See examples in cfg-examples
Configuration files are javascript files, organized in directory trees
under cfg/
. Files starting with underscore are ignored (use this for
defaults and events configurations to be loaded explicitly).
The default data source is a graphite server reachable at
http://graphite/
, so to add a project with two graphite metrics:
Dash.stats()
.add(
{
title: 'Current Foo Bar',
target: 'stats_counts.production.foo.bar',
display: 'last'
},
{
title: 'Mean Barf Count',
target: 'stats_counts.production.barf.count',
display: 'mean'
}
)
See public/js/Dash.Source.*.js
. To use an alternative data source,
such as ganglia:
Dash.stats()
.add({
title: 'Web server Current CPU',
type: 'ganglia',
source: 'http://ganglia-01',
graph: 'cpu_report',
cluster: 'WebServers',
aggregate: 'sum',
format: function(x) { return x.toFixed(0) + '%' },
display: 'last'
})
Note the format function, which takes the display value and can
return a string to display in its place (in this case set precision
and append percent sign). The default format function is the supplied
Dash.Format.Metric, which converts e.g. '1000' to '1K', etc. See
public/Dash.Format.js
for some more useful format functions.
- Graphite: default data source
- Ganglia: extracts cluster time series data from e.g. cpu_report, load_report, etc
- Ganglia_events: event lines for data stored using ganglia events API
- Logstash: timeseries data on occurrence of a search pattern, as in the kibana histogram
- Opscenter: any cassandra cluster metric exposed by opscenter
- Pingdom: uptime or responsetime metrics from pingdom
- Google analytics: hourly metric data retrieved using GA API
- Errplane: count and times data by method
- Sendgrid: daily stats
- Test: fake time series data generated by dashiki for your testing pleasure
A consistent config can be applied to multiple stats as follows:
Dash.stats()
.config(
{
type: 'ganglia',
source: 'http://ganglia-01',
graph: 'cpu_report',
aggregate: 'sum',
format: function(x) { return x.toFixed(0) + '%' },
display: 'last'
}
)
.add(
{
title: 'Web server Current CPU',
cluster: 'WebServers'
},
{
title: 'Database Current CPU',
cluster: 'DbServers'
}
)
Thresholds work in a similar fashion to format functions: they take the display value and if function returns true, apply the given class(es) to the display box.
Dash.stats()
.add({
title: 'Volume',
target: 'stats.gauges.amp.volume',
display: 'last',
thresholds: [
{ class: 'green', test: function(x) { return x<8 } },
{ class: 'red', test: function(x) { return x>=8 && x<=10 } },
{ class: 'spinaltap', test: function(x) { return x==11 } }
]
})
For graphite it is possible to configure stats dynamically using a wildcard metric:
Dash.stats()
.find({
target: 'stats.gauges.amp.*',
done: function(metrics) {
metrics.forEach(function(metric) {
var control = metric.split('.').slice(-1).join();
this.add({
title: Dash.capitalize(control),
target: metric,
display: 'last',
});
}, this);
}
})
There are convenience callbacks that may be used as alternatives to done
:
each: function(metric) {...}
puts an implicit loop over metrics, and
add: function(metric) {...}
is each
with an implicit this.add
on
the object returned.
Say your browser can't reach a given data source with an XHR, because
of firewall restrictions or same-origin policy (which you are unable
to configure around on the source for some reason). Set
proxy: true
for the given stat and dashboard will route the
request through a simple GET proxy on the dashboard server.
Events are sparse data lines that are superimposed on the big graph in
the boxes view. Default events are configured in
cfg/_events_.js
, but can also be added in individual dashboard
cfgs.
For example, we increment a counter via statsd every time a production deploy is done with capistrano, and also use the ganglia events api to store start and end times of nightly backups and DB repairs.
Dash.events()
.add(
{
title: 'Production Deploys',
target: 'stats_counts.events.deploy.production.*',
class: 'production_deploys'
},
{
title: 'Puppet Configuration Changes',
target: 'stats_counts.events.puppet.*',
class: 'puppet_deploys'
},
{
title: 'Ganglia events',
type: 'ganglia_events',
source: 'http://ganglia',
class: 'ganglia_events'
}
);
A CSS class may be applied to give different styling to different
events (see public/css/dashboard.css
).
Dashiki is distributed under the MIT license. See the attached LICENSE file for all the sordid details.