Make counters configureable

This commit is contained in:
redref
2017-02-02 10:05:49 +01:00
parent bb26c5bbea
commit 16b197e0ce
4 changed files with 16 additions and 15 deletions

View File

@@ -537,7 +537,7 @@ def reports_ajax(env, node_name):
if total is None: if total is None:
total = puppetdb.total total = puppetdb.total
metrics[report.hash_] = {'resources': {}, 'events': {}} metrics[report.hash_] = {}
for m in report.metrics: for m in report.metrics:
if m['category'] not in metrics[report.hash_]: if m['category'] not in metrics[report.hash_]:
metrics[report.hash_][m['category']] = {} metrics[report.hash_][m['category']] = {}

View File

@@ -18,6 +18,11 @@ LOGLEVEL = 'info'
NORMAL_TABLE_COUNT = 100 NORMAL_TABLE_COUNT = 100
LITTLE_TABLE_COUNT = 10 LITTLE_TABLE_COUNT = 10
TABLE_COUNT_SELECTOR = [10, 20, 50, 100, 500] TABLE_COUNT_SELECTOR = [10, 20, 50, 100, 500]
DISPLAYED_METRICS = ['resources.total',
'events.failure',
'events.success',
'resources.skipped',
'events.noop']
OFFLINE_MODE = False OFFLINE_MODE = False
ENABLE_CATALOG = False ENABLE_CATALOG = False
OVERVIEW_FILTER = None OVERVIEW_FILTER = None

View File

@@ -44,7 +44,7 @@ h1.ui.header.no-margin-bottom {
color: #AA4643; color: #AA4643;
} }
.ui.label.failed { .ui.label.failed, .ui.label.events.failure {
background-color: #AA4643; background-color: #AA4643;
} }
@@ -52,7 +52,7 @@ h1.ui.header.no-margin-bottom {
color: #4572A7; color: #4572A7;
} }
.ui.label.changed { .ui.label.changed, .ui.label.events.success {
background-color: #4572A7; background-color: #4572A7;
} }
@@ -68,15 +68,11 @@ h1.ui.header.no-margin-bottom {
color: #DB843D; color: #DB843D;
} }
.ui.label.noop { .ui.label.noop, .ui.label.events.noop {
background-color: #DB843D; background-color: #DB843D;
} }
.ui.header.total { .ui.label.resources.total {
color: #989898;
}
.ui.label.total {
background-color: #989898; background-color: #989898;
} }
@@ -88,7 +84,7 @@ h1.ui.header.no-margin-bottom {
color: orange; color: orange;
} }
.ui.label.skipped { .ui.label.skipped, .ui.label.resources.skipped {
background-color: orange; background-color: orange;
} }

View File

@@ -62,11 +62,11 @@
{% if status == 'unreported' %} {% if status == 'unreported' %}
<span class="ui label status"> {{ unreported_time|upper }} </span> <span class="ui label status"> {{ unreported_time|upper }} </span>
{% else %} {% else %}
<span title="Total resources" class="ui small count label{% if metrics.resources.total %} total">{{ metrics.resources.total }}{% else %}">0{% endif%}</span> {% for metric in config.DISPLAYED_METRICS %}
<span title="Failure events" class="ui small count label{% if metrics.events.failure %} failed">{{ metrics.events.failure }}{% else %}">0{% endif%}</span> {% set path = metric.split('.') %}
<span title="Success events" class="ui small count label{% if metrics.events.success %} changed">{{ metrics.events.success }}{% else %}">0{% endif%}</span> {% set title = ' '.join(path) %}
<span title="Skipped resources" class="ui small count label{% if metrics.resources.skipped %} skipped">{{ metrics.resources.skipped }}{% else %}">0{% endif%}</span> <span title="{{ title }}" class="ui small count label{% if metrics[path[0]] and metrics[path[0]][path[1]] %} {{ title }}">{{ "%.2g"|format(metrics[path[0]][path[1]]) }}{% else %}">0{% endif%}</span>
<span title="Noop events" class="ui small count label{% if metrics.events.noop %} noop">{{ metrics.events.noop }}{% else %}">0{% endif%}</span> {% endfor %}
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}