diff --git a/puppetboard/app.py b/puppetboard/app.py
index c25b78d..0294710 100644
--- a/puppetboard/app.py
+++ b/puppetboard/app.py
@@ -101,40 +101,35 @@ def index():
'avg_resources_node': "{0:10.6f}".format(avg_resources_node['Value']),
}
- latest_event_count = puppetdb._query(
- 'aggregate-event-counts',
- query='["=", "latest-report?", true]',
- summarize_by='certname')
+ nodes = puppetdb.nodes(with_status=True)
- latest_event_count['noopskip'] = (
- latest_event_count['noops'] + latest_event_count['skips'])
+ nodes_overview = []
+ stats = {
+ 'changed': 0,
+ 'unchanged': 0,
+ 'failed': 0,
+ 'unreported': 0,
+ }
- latest_events = puppetdb._query(
- 'event-counts',
- query='["=", "latest-report?", true]',
- summarize_by='certname')
+ for node in list(nodes):
+ if node.status == 'unreported':
+ stats['unreported'] += 1
+ elif node.status == 'changed':
+ stats['changed'] += 1
+ elif node.status == 'failed':
+ stats['failed'] += 1
+ else:
+ stats['unchanged'] += 1
- unreported = []
- unresponsive_window = datetime.utcnow() - (
- timedelta(hours=app.config['UNRESPONSIVE_HOURS']))
- for node in puppetdb.nodes():
- try:
- node_last_seen = node.report_timestamp.replace(tzinfo=None)
- if node_last_seen < unresponsive_window:
- delta = (datetime.utcnow() - node_last_seen)
- node.noresponse = str(delta.days) + "d "
- node.noresponse += str(int(delta.seconds / 3600)) + "h "
- node.noresponse += str(int((delta.seconds % 3600) / 60)) + "m"
- unreported.append(node)
- except AttributeError:
- unreported.append(node)
+ if node.status != 'unchanged':
+ nodes_overview.append(node)
return render_template(
'index.html',
metrics=metrics,
- latest_event_count=latest_event_count,
- latest_events=latest_events,
- unreported=unreported)
+ nodes=nodes_overview,
+ stats=stats
+ )
@app.route('/nodes')
@@ -169,7 +164,7 @@ def nodes():
nodes.append(node)
else:
nodes.append(node)
-
+ nodes = puppetdb.nodes(with_status=True)
return Response(stream_with_context(
stream_template('nodes.html', nodes=nodes)))
diff --git a/puppetboard/static/css/puppetboard.css b/puppetboard/static/css/puppetboard.css
index 49d18d1..3e54c34 100644
--- a/puppetboard/static/css/puppetboard.css
+++ b/puppetboard/static/css/puppetboard.css
@@ -61,12 +61,29 @@ h1.success {
h1.noop {
color:#aaa;
}
-.numtag {
- width:20px;
+.label-count {
+ width:25px;
+ text-align:center;
+}
+.label-time {
+ width:73px;
+ text-align:center;
+}
+.label-status {
+ width:100px;
text-align:center;
}
.label-nothing {
background-color:#ddd;
- width:20px;
color:#ddd;
}
+.label.label-failed {
+ background-color: rgb(231, 76, 60);
+}
+.label.label-changed {
+ background-color: rgb(24, 188, 156);
+}
+.label.label-unreported {
+ background-color: rgb(231, 76, 60);
+ background-color: rgb(129, 145, 146);
+}
diff --git a/puppetboard/static/js/tables.js b/puppetboard/static/js/tables.js
index 7fb44b8..a449ddd 100644
--- a/puppetboard/static/js/tables.js
+++ b/puppetboard/static/js/tables.js
@@ -19,6 +19,13 @@
sortList: [[0, 0]]
});
+ $('.dashboard').tablesorter({
+ headers: {
+ 2: { sorter: false }
+ },
+ sortList: [[0, 0]]
+ });
+
$('input.filter-table').parent('div').removeClass('hide');
$("input.filter-table").on("keyup", function(e) {
diff --git a/puppetboard/templates/index.html b/puppetboard/templates/index.html
index d2a0afa..cc8fc9e 100644
--- a/puppetboard/templates/index.html
+++ b/puppetboard/templates/index.html
@@ -1,25 +1,31 @@
{% extends 'layout.html' %}
{% block row_fluid %}
+
-
{{ unreported|length }} unreported
+ {{ stats['unreported'] }}
+ {% if stats['unreported']== 1 %} node {% else %} nodes {% endif %}
+
- {% if unreported|length == 1 %} node {% else %} nodes {% endif %}
- in the last {{ config.UNRESPONSIVE_HOURS }} hours
+ unreported in the last {{ config.UNRESPONSIVE_HOURS }} hours
@@ -44,34 +50,38 @@
-
Nodes unresponsive in the last {{ config.UNRESPONSIVE_HOURS }} hours
-