1
0
Fork 0
mirror of https://github.com/Luzifer/mondash.git synced 2024-12-23 04:21:18 +00:00

Allow hiding of MAD by flag

This commit is contained in:
Knut Ahlers 2016-03-27 21:13:36 +02:00
parent 593f0f9b17
commit b63007d8b1
3 changed files with 33 additions and 26 deletions

View file

@ -73,6 +73,7 @@ This API controls the metrics on your dashboard
+ expires: 604800 (optional, number) - Time in seconds when to remove the metric if there is no update (Valid: `0 < x < 604800`) + expires: 604800 (optional, number) - Time in seconds when to remove the metric if there is no update (Valid: `0 < x < 604800`)
+ freshness: 3600 (optional, number) - Time in seconds when to switch to `Unkown` state of there is no update (Valid: `0 < x < 604800`) + 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 + 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
+ Response 200 (text/plain) + Response 200 (text/plain)

View file

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

View file

@ -103,9 +103,12 @@
{% else %} {% else %}
<span class="label label-info">Current Value: {{ metric.Value }}</span> <span class="label label-info">Current Value: {{ metric.Value }}</span>
{% endif %} {% endif %}
{% if !metric.HideMAD %}
{{ metric.MadMultiplier }} <abbr title="Median Absolute Deviation">MAD</abbr> {{ metric.MadMultiplier }} <abbr title="Median Absolute Deviation">MAD</abbr>
above the Median ({{ metric.Median }}) above the Median ({{ metric.Median }})
{% endif %}
</span> </span>
{% if !metric.HideMAD %}
<div class="ct-chart {{metric.MetricID}} .ct-double-octave"></div> <div class="ct-chart {{metric.MetricID}} .ct-double-octave"></div>
<script> <script>
var data = { var data = {
@ -121,6 +124,7 @@
new Chartist.Line('.{{metric.MetricID}}', data); new Chartist.Line('.{{metric.MetricID}}', data);
</script> </script>
{% endif %}
<small> <small>
Updated {{ metric.Meta.LastUpdate|naturaltime}} Updated {{ metric.Meta.LastUpdate|naturaltime}}
{% if metric.Status != "OK" %} {% if metric.Status != "OK" %}