Print flags on status page.
This commit is contained in:
parent
862054e88b
commit
45243ac2da
|
@ -35,6 +35,10 @@ input:not([type=submit]):not([type=file]):not([type=button]) {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table tbody th {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border: 1px solid gray;
|
border: 1px solid gray;
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
package web
|
package web
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"github.com/prometheus/prometheus/appstate"
|
"github.com/prometheus/prometheus/appstate"
|
||||||
"github.com/prometheus/prometheus/retrieval"
|
"github.com/prometheus/prometheus/retrieval"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -25,6 +26,7 @@ type PrometheusStatus struct {
|
||||||
Status string
|
Status string
|
||||||
TargetPools map[string]*retrieval.TargetPool
|
TargetPools map[string]*retrieval.TargetPool
|
||||||
BuildInfo map[string]string
|
BuildInfo map[string]string
|
||||||
|
Flags map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
type StatusHandler struct {
|
type StatusHandler struct {
|
||||||
|
@ -32,12 +34,19 @@ type StatusHandler struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *StatusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
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{
|
status := &PrometheusStatus{
|
||||||
Config: h.appState.Config.ToString(0),
|
Config: h.appState.Config.ToString(0),
|
||||||
Rules: "TODO: list rules here",
|
Rules: "TODO: list rules here",
|
||||||
Status: "TODO: add status information here",
|
Status: "TODO: add status information here",
|
||||||
TargetPools: h.appState.TargetManager.Pools(),
|
TargetPools: h.appState.TargetManager.Pools(),
|
||||||
BuildInfo: h.appState.BuildInfo,
|
BuildInfo: h.appState.BuildInfo,
|
||||||
|
Flags: flags,
|
||||||
}
|
}
|
||||||
executeTemplate(w, "status", status)
|
executeTemplate(w, "status", status)
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,12 +38,28 @@
|
||||||
<h2>Build Info</h2>
|
<h2>Build Info</h2>
|
||||||
<div class="grouping_box">
|
<div class="grouping_box">
|
||||||
<table>
|
<table>
|
||||||
|
<tbody>
|
||||||
{{range $key, $value := .BuildInfo}}
|
{{range $key, $value := .BuildInfo}}
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{{$key}}</th>
|
<th scope="row">{{$key}}</th>
|
||||||
<td>{{$value}}</td>
|
<td>{{$value}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
{{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>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
Loading…
Reference in New Issue