1
0
mirror of https://github.com/Luzifer/mondash.git synced 2024-09-19 17:02:58 +00:00

Add option to hide value on dashboard

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2017-11-24 18:23:32 +01:00
parent 5fcd6587ef
commit d3413f99bb
Signed by: luzifer
GPG Key ID: DC2729FDD34BE99E
3 changed files with 5 additions and 0 deletions

View File

@ -74,6 +74,7 @@ This API controls the metrics on your dashboard
+ freshness: 3600 (optional, number) - Time in seconds when to switch to `Unkown` state of there is no update (Valid: `0 < x < 604800`)
+ ignore_mad: false (optional, boolean) - If set to true the status passed in the update will be used instead of the median absolute deviation
+ hide_mad: false (optional, boolean) - If set to true the median absolute deviation is hidden on the dashboard for this metric
+ hide_value: false (optional, boolean) - If set to true the current value will not be shown on the dashboard (useful for checks not having values)
+ Response 200 (text/plain)

View File

@ -63,6 +63,7 @@ type dashboardMetric struct {
Freshness int64 `json:"freshness,omitifempty"`
IgnoreMAD bool `json:"ignore_mad"`
HideMAD bool `json:"hide_mad"`
HideValue bool `json:"hide_value"`
HistoricalData dashboardMetricHistory `json:"history,omitifempty"`
Meta dashboardMetricMeta `json:"meta,omitifempty"`
}
@ -217,6 +218,7 @@ func (dm *dashboardMetric) Update(m *dashboardMetric) {
dm.Value = m.Value
dm.IgnoreMAD = m.IgnoreMAD
dm.HideMAD = m.HideMAD
dm.HideValue = m.HideValue
if m.Expires != 0 {
dm.Expires = m.Expires
}

View File

@ -98,6 +98,7 @@
<div class="col-md-9">
<h4>{{ metric.Title }}</h4>
<p>{{ metric.Description }}</p>
{% if !metric.HideValue %}
<span>
{% if metric.Status == "OK" %}
<span class="label label-success">Current Value: {{ metric.Value }}</span>
@ -112,6 +113,7 @@
<abbr title="Median Absolute Deviation">MAD</abbr>: {{ metric.MadMultiplier }} above the Median ({{ metric.Median }})
{% endif %}
</span>
{% endif %}
{% if !metric.HideMAD %}
<div class="ct-chart {{metric.MetricID}} .ct-double-octave"></div>
<script>