Add a Metrics tab.
This gives you access to all metrics.
This commit is contained in:
@@ -196,3 +196,15 @@ def query():
|
||||
query='[{0}]'.format(form.query.data))
|
||||
return render_template('query.html', form=form, result=result)
|
||||
return render_template('query.html', form=form)
|
||||
|
||||
@app.route('/metrics')
|
||||
def metrics():
|
||||
metrics = puppetdb._query('metrics', path='mbeans')
|
||||
for key,value in metrics.iteritems():
|
||||
metrics[key]=value.split('/')[3]
|
||||
return render_template('metrics.html', metrics=metrics)
|
||||
|
||||
@app.route('/metric/<metric>')
|
||||
def metric(metric):
|
||||
metric = puppetdb.metric(metric)
|
||||
return render_template('metric.html', metric=metric)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
('nodes', 'Nodes'),
|
||||
('facts', 'Facts'),
|
||||
('reports', 'Reports'),
|
||||
('metrics', 'Metrics'),
|
||||
('query', 'Query'),
|
||||
] %}
|
||||
<li{% if endpoint == request.endpoint %} class=active{% endif
|
||||
|
||||
14
puppetboard/templates/metric.html
Normal file
14
puppetboard/templates/metric.html
Normal file
@@ -0,0 +1,14 @@
|
||||
{% extends 'layout.html' %}
|
||||
{% block content %}
|
||||
<h1>Metric</h1>
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
{% for key,value in metric.iteritems() %}
|
||||
<tr>
|
||||
<td>{{key}}</td>
|
||||
<td>{{value}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock content %}
|
||||
9
puppetboard/templates/metrics.html
Normal file
9
puppetboard/templates/metrics.html
Normal file
@@ -0,0 +1,9 @@
|
||||
{% extends 'layout.html' %}
|
||||
{% block content %}
|
||||
<h1>Metrics</h1>
|
||||
<ul>
|
||||
{% for key,value in metrics.iteritems() %}
|
||||
<li><a href="{{url_for('metric', metric=value)}}">{{key}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user