From 52ce3599c9b5f43cc3e8ab12d6aa561288caeab4 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Sat, 7 Mar 2015 22:27:39 +0100 Subject: [PATCH] Nicer formatting of target health table on /status. --- web/static/css/prometheus.css | 2 +- web/status.go | 8 ++++++++ web/templates/status.html | 15 +++++++++------ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/web/static/css/prometheus.css b/web/static/css/prometheus.css index 086bd7f9e..d801925ac 100644 --- a/web/static/css/prometheus.css +++ b/web/static/css/prometheus.css @@ -10,7 +10,7 @@ th.job_header { padding-bottom: 10px; } -.error_text { +.target_status_alert { padding: 0 4px 0 4px; } diff --git a/web/status.go b/web/status.go index 27f718ac5..a0175fa89 100644 --- a/web/status.go +++ b/web/status.go @@ -35,6 +35,14 @@ type PrometheusStatusHandler struct { Birth time.Time } +func (h *PrometheusStatusHandler) TargetStateToClass() map[retrieval.TargetState]string { + return map[retrieval.TargetState]string{ + retrieval.Unknown: "warning", + retrieval.Healthy: "success", + retrieval.Unhealthy: "danger", + } +} + func (h *PrometheusStatusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { executeTemplate(w, "status", h) } diff --git a/web/templates/status.html b/web/templates/status.html index 9fd4ed936..cf3586d7d 100644 --- a/web/templates/status.html +++ b/web/templates/status.html @@ -31,8 +31,9 @@
{{range .RuleManager.Rules}}{{.HTMLSnippet}}
{{end}}

Targets

- {{range $job, $pool := .TargetPools}} - +
+ {{$stateToClass := .TargetStateToClass}} + {{range $job, $pool := .TargetPools}} @@ -50,7 +51,9 @@ {{.URL}} {{end}} -
{{$job}}
- {{.State}} + + {{.State}} + {{.BaseLabels}} @@ -60,14 +63,14 @@ {{if .LastError}} - {{.LastError}} + {{.LastError}} {{end}}
- {{end}} + {{end}} +

Startup Flags