46 lines
1.5 KiB
HTML
46 lines
1.5 KiB
HTML
<table id="statsd"
|
|
data-graphite="{{ graphite }}"
|
|
data-roots="{% for root in roots %}{{ root }}{% if not forloop.last %}|{% endif %}{% endfor %}">
|
|
<thead>
|
|
<tr>
|
|
<th>Stat</th>
|
|
<th>Value</th>
|
|
<th>Count</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for record in statsd %}
|
|
<tr>
|
|
<td><a href="#" class="statsd" data-key="{{ record.0 }}">{{ record.0 }}</a></td>
|
|
<td>{{ record.1 }}</td>
|
|
<td>{{ record.2 }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
|
|
<div id="graphs" img="graphite?width=586&height=308&target=root.key.lower&target=root.key.mean&target=root.key.upper_90&target=scale(root.key.count,0.1)&from=-24hours&title=24 hours" />
|
|
|
|
<script type="text/javascript">
|
|
// TODO: inlining is bad, this should be external.
|
|
|
|
$(document).ready(function() {
|
|
var graphite = $('#statsd').attr('data-graphite'),
|
|
roots = $('#statsd').attr('data-roots').split('|'),
|
|
target = $('#graphs'),
|
|
img = target.attr('img');
|
|
|
|
$('a.statsd').click(function() {
|
|
var that = $(this);
|
|
target.html('');
|
|
$.each(roots, function(root) {
|
|
var custom = img.replace('graphite', graphite, 'g')
|
|
.replace('root', roots[root], 'g')
|
|
.replace('key', that.attr('data-key'), 'g');
|
|
target.append('<p><b>' + roots[root] + '.' + that.attr('data-key') + '</b></p><img src="' + custom + '">');
|
|
})
|
|
});
|
|
})
|
|
</script>
|
|
|