StatusHandler renders build info

This commit is contained in:
Bernerd Schaefer 2013-04-25 11:57:08 +02:00
parent 033533c4c5
commit a2a4f94aae
4 changed files with 27 additions and 11 deletions

View file

@ -28,4 +28,5 @@ type ApplicationState struct {
RuleManager rules.RuleManager
Storage metric.Storage
TargetManager retrieval.TargetManager
BuildInfo map[string]string
}

View file

@ -91,6 +91,7 @@ func main() {
RuleManager: ruleManager,
Storage: ts,
TargetManager: targetManager,
BuildInfo: BuildInfo,
}
web.StartServing(appState)

View file

@ -24,6 +24,7 @@ type PrometheusStatus struct {
Rules string
Status string
TargetPools map[string]*retrieval.TargetPool
BuildInfo map[string]string
}
type StatusHandler struct {
@ -36,6 +37,7 @@ func (h *StatusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
Rules: "TODO: list rules here",
Status: "TODO: add status information here",
TargetPools: h.appState.TargetManager.Pools(),
BuildInfo: h.appState.BuildInfo,
}
executeTemplate(w, "status", status)
}

View file

@ -2,23 +2,23 @@
{{define "content"}}
<h2>Status</h2>
<div class="grouping_box">
<div class="grouping_box">
{{.Status}}
</div>
</div>
<h2>Configuration</h2>
<div class="grouping_box">
<pre>
<h2>Configuration</h2>
<div class="grouping_box">
<pre>
{{.Config}}
</pre>
</div>
</pre>
</div>
<h2>Rules</h2>
<div class="grouping_box">
<div class="grouping_box">
{{.Rules}}
</div>
</div>
<h2>Targets</h2>
<h2>Targets</h2>
<div class="grouping_box">
<ul>
{{range $job, $pool := .TargetPools}}
@ -33,5 +33,17 @@
</li>
{{end}}
</ul>
</div>
</div>
<h2>Build Info</h2>
<div class="grouping_box">
<table>
{{range $key, $value := .BuildInfo}}
<tr>
<th scope="row">{{$key}}</th>
<td>{{$value}}</td>
</tr>
{{end}}
</table>
</div>
{{end}}