Print flags on status page.

This commit is contained in:
Bernerd Schaefer 2013-04-25 12:11:21 +02:00
parent 862054e88b
commit 45243ac2da
3 changed files with 35 additions and 6 deletions

View File

@ -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;

View File

@ -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)
}

View File

@ -38,12 +38,28 @@
<h2>Build Info</h2>
<div class="grouping_box">
<table>
{{range $key, $value := .BuildInfo}}
<tr>
<th scope="row">{{$key}}</th>
<td>{{$value}}</td>
</tr>
{{end}}
<tbody>
{{range $key, $value := .BuildInfo}}
<tr>
<th scope="row">{{$key}}</th>
<td>{{$value}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
<h2>Startup Flags</h2>
<div class="grouping_box">
<table>
<tbody>
{{range $key, $value := .Flags}}
<tr>
<th scope="row">{{$key}}</th>
<td>{{$value}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{end}}