From 45243ac2da10c138ad9ca5e22c3f4fb5d47f6d46 Mon Sep 17 00:00:00 2001 From: Bernerd Schaefer Date: Thu, 25 Apr 2013 12:11:21 +0200 Subject: [PATCH] Print flags on status page. --- web/static/css/prometheus.css | 4 ++++ web/status.go | 9 +++++++++ web/templates/status.html | 28 ++++++++++++++++++++++------ 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/web/static/css/prometheus.css b/web/static/css/prometheus.css index d46ae56b8..7e76a5b32 100644 --- a/web/static/css/prometheus.css +++ b/web/static/css/prometheus.css @@ -35,6 +35,10 @@ input:not([type=submit]):not([type=file]):not([type=button]) { float: right; } +table tbody th { + text-align: left; +} + input { margin: 0; border: 1px solid gray; diff --git a/web/status.go b/web/status.go index b20bb9b4f..fb60905f4 100644 --- a/web/status.go +++ b/web/status.go @@ -14,6 +14,7 @@ package web import ( + "flag" "github.com/prometheus/prometheus/appstate" "github.com/prometheus/prometheus/retrieval" "net/http" @@ -25,6 +26,7 @@ type PrometheusStatus struct { Status string TargetPools map[string]*retrieval.TargetPool BuildInfo map[string]string + Flags map[string]string } type StatusHandler struct { @@ -32,12 +34,19 @@ type StatusHandler struct { } func (h *StatusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + flags := map[string]string{} + + flag.VisitAll(func(f *flag.Flag) { + flags[f.Name] = f.Value.String() + }) + status := &PrometheusStatus{ Config: h.appState.Config.ToString(0), Rules: "TODO: list rules here", Status: "TODO: add status information here", TargetPools: h.appState.TargetManager.Pools(), BuildInfo: h.appState.BuildInfo, + Flags: flags, } executeTemplate(w, "status", status) } diff --git a/web/templates/status.html b/web/templates/status.html index e1a239eb1..b8a63a69c 100644 --- a/web/templates/status.html +++ b/web/templates/status.html @@ -38,12 +38,28 @@

Build Info

- {{range $key, $value := .BuildInfo}} - - - - - {{end}} + + {{range $key, $value := .BuildInfo}} + + + + + {{end}} + +
{{$key}}{{$value}}
{{$key}}{{$value}}
+
+ +

Startup Flags

+
+ + + {{range $key, $value := .Flags}} + + + + + {{end}} +
{{$key}}{{$value}}
{{end}}