mirror of
https://github.com/Luzifer/mondash.git
synced 2024-11-09 16:10:01 +00:00
Introduce DetailURL
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
f0fcbe98a7
commit
e566299571
4 changed files with 11 additions and 0 deletions
|
@ -69,6 +69,7 @@ This API controls the metrics on your dashboard
|
||||||
+ Attributes (object)
|
+ Attributes (object)
|
||||||
+ title (required, string) - The title of the metric to display on the dashboard
|
+ title (required, string) - The title of the metric to display on the dashboard
|
||||||
+ description (required, string) - A descriptive text for the current state of the metric
|
+ description (required, string) - A descriptive text for the current state of the metric
|
||||||
|
+ detail_url (optional, string) - An URL with further information of the status
|
||||||
+ status (required, enum[string]) - One of: OK, Warning, Critical, Unknown
|
+ status (required, enum[string]) - One of: OK, Warning, Critical, Unknown
|
||||||
+ 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 stale state of there is no update (Valid: `0 < x < 604800`)
|
+ freshness: 3600 (optional, number) - Time in seconds when to switch to stale state of there is no update (Valid: `0 < x < 604800`)
|
||||||
|
|
|
@ -97,6 +97,9 @@ type PostMetricInput struct {
|
||||||
// A descriptive text for the current state of the metric
|
// A descriptive text for the current state of the metric
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
|
|
||||||
|
// An URL with further information of the status
|
||||||
|
DetailURL string `json:"detail_url"`
|
||||||
|
|
||||||
// One of: OK, Warning, Critical, Unknown
|
// One of: OK, Warning, Critical, Unknown
|
||||||
Status Status `json:"status"`
|
Status Status `json:"status"`
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,7 @@ type dashboardMetric struct {
|
||||||
MetricID string `json:"id"`
|
MetricID string `json:"id"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
|
DetailURL string `json:"detail_url"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
Value float64 `json:"value,omitempty"`
|
Value float64 `json:"value,omitempty"`
|
||||||
Expires int64 `json:"expires,omitempty"`
|
Expires int64 `json:"expires,omitempty"`
|
||||||
|
@ -267,6 +268,10 @@ func (dm *dashboardMetric) Update(m *dashboardMetric) {
|
||||||
dm.HideValue = m.HideValue
|
dm.HideValue = m.HideValue
|
||||||
dm.StalenessStatus = m.StalenessStatus
|
dm.StalenessStatus = m.StalenessStatus
|
||||||
|
|
||||||
|
if m.DetailURL != "" {
|
||||||
|
dm.DetailURL = m.DetailURL
|
||||||
|
}
|
||||||
|
|
||||||
if m.Expires != 0 {
|
if m.Expires != 0 {
|
||||||
dm.Expires = m.Expires
|
dm.Expires = m.Expires
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ type outputMetric struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Config outputMetricConfig `json:"config"`
|
Config outputMetricConfig `json:"config"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
|
DetailURL string `json:"detail_url"`
|
||||||
HistoryBar []historyBarSegment `json:"history_bar,omitempty"`
|
HistoryBar []historyBarSegment `json:"history_bar,omitempty"`
|
||||||
LastOK time.Time `json:"last_ok"`
|
LastOK time.Time `json:"last_ok"`
|
||||||
LastUpdate time.Time `json:"last_update"`
|
LastUpdate time.Time `json:"last_update"`
|
||||||
|
@ -51,6 +52,7 @@ func outputMetricFromMetric(opts outputMetricFromMetricOpts) outputMetric {
|
||||||
out := outputMetric{
|
out := outputMetric{
|
||||||
ID: opts.Metric.MetricID,
|
ID: opts.Metric.MetricID,
|
||||||
Description: opts.Metric.Description,
|
Description: opts.Metric.Description,
|
||||||
|
DetailURL: opts.Metric.DetailURL,
|
||||||
LastOK: opts.Metric.Meta.LastOK,
|
LastOK: opts.Metric.Meta.LastOK,
|
||||||
LastUpdate: opts.Metric.Meta.LastUpdate,
|
LastUpdate: opts.Metric.Meta.LastUpdate,
|
||||||
Median: opts.Metric.Median(),
|
Median: opts.Metric.Median(),
|
||||||
|
|
Loading…
Reference in a new issue