mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 20:37:12 +01:00
890 lines
25 KiB
Go
890 lines
25 KiB
Go
|
// Code generated by qtc from "web.qtpl". DO NOT EDIT.
|
||
|
// See https://github.com/valyala/quicktemplate for details.
|
||
|
|
||
|
//line app/vmalert/web.qtpl:1
|
||
|
package main
|
||
|
|
||
|
//line app/vmalert/web.qtpl:3
|
||
|
import (
|
||
|
"sort"
|
||
|
"time"
|
||
|
|
||
|
"github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/tpl"
|
||
|
)
|
||
|
|
||
|
//line app/vmalert/web.qtpl:11
|
||
|
import (
|
||
|
qtio422016 "io"
|
||
|
|
||
|
qt422016 "github.com/valyala/quicktemplate"
|
||
|
)
|
||
|
|
||
|
//line app/vmalert/web.qtpl:11
|
||
|
var (
|
||
|
_ = qtio422016.Copy
|
||
|
_ = qt422016.AcquireByteBuffer
|
||
|
)
|
||
|
|
||
|
//line app/vmalert/web.qtpl:12
|
||
|
var navItems = []tpl.NavItem{
|
||
|
{Name: "vmalert", Url: "/"},
|
||
|
{Name: "Groups", Url: "/groups"},
|
||
|
{Name: "Alerts", Url: "/alerts"},
|
||
|
{Name: "Docs", Url: "https://docs.victoriametrics.com/vmalert.html"},
|
||
|
}
|
||
|
|
||
|
//line app/vmalert/web.qtpl:20
|
||
|
func StreamWelcome(qw422016 *qt422016.Writer, pathList [][2]string) {
|
||
|
//line app/vmalert/web.qtpl:20
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:21
|
||
|
tpl.StreamHeader(qw422016, "vmalert", navItems)
|
||
|
//line app/vmalert/web.qtpl:21
|
||
|
qw422016.N().S(`
|
||
|
<p>
|
||
|
API:<br>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:24
|
||
|
for _, p := range pathList {
|
||
|
//line app/vmalert/web.qtpl:24
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:26
|
||
|
p, doc := p[0], p[1]
|
||
|
|
||
|
//line app/vmalert/web.qtpl:27
|
||
|
qw422016.N().S(`
|
||
|
<a href="`)
|
||
|
//line app/vmalert/web.qtpl:28
|
||
|
qw422016.E().S(p)
|
||
|
//line app/vmalert/web.qtpl:28
|
||
|
qw422016.N().S(`">`)
|
||
|
//line app/vmalert/web.qtpl:28
|
||
|
qw422016.E().S(p)
|
||
|
//line app/vmalert/web.qtpl:28
|
||
|
qw422016.N().S(`</a> - `)
|
||
|
//line app/vmalert/web.qtpl:28
|
||
|
qw422016.E().S(doc)
|
||
|
//line app/vmalert/web.qtpl:28
|
||
|
qw422016.N().S(`<br/>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:29
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:29
|
||
|
qw422016.N().S(`
|
||
|
</p>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:31
|
||
|
tpl.StreamFooter(qw422016)
|
||
|
//line app/vmalert/web.qtpl:31
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:32
|
||
|
}
|
||
|
|
||
|
//line app/vmalert/web.qtpl:32
|
||
|
func WriteWelcome(qq422016 qtio422016.Writer, pathList [][2]string) {
|
||
|
//line app/vmalert/web.qtpl:32
|
||
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||
|
//line app/vmalert/web.qtpl:32
|
||
|
StreamWelcome(qw422016, pathList)
|
||
|
//line app/vmalert/web.qtpl:32
|
||
|
qt422016.ReleaseWriter(qw422016)
|
||
|
//line app/vmalert/web.qtpl:32
|
||
|
}
|
||
|
|
||
|
//line app/vmalert/web.qtpl:32
|
||
|
func Welcome(pathList [][2]string) string {
|
||
|
//line app/vmalert/web.qtpl:32
|
||
|
qb422016 := qt422016.AcquireByteBuffer()
|
||
|
//line app/vmalert/web.qtpl:32
|
||
|
WriteWelcome(qb422016, pathList)
|
||
|
//line app/vmalert/web.qtpl:32
|
||
|
qs422016 := string(qb422016.B)
|
||
|
//line app/vmalert/web.qtpl:32
|
||
|
qt422016.ReleaseByteBuffer(qb422016)
|
||
|
//line app/vmalert/web.qtpl:32
|
||
|
return qs422016
|
||
|
//line app/vmalert/web.qtpl:32
|
||
|
}
|
||
|
|
||
|
//line app/vmalert/web.qtpl:34
|
||
|
func StreamListGroups(qw422016 *qt422016.Writer, groups []APIGroup) {
|
||
|
//line app/vmalert/web.qtpl:34
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:35
|
||
|
tpl.StreamHeader(qw422016, "Groups", navItems)
|
||
|
//line app/vmalert/web.qtpl:35
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:36
|
||
|
if len(groups) > 0 {
|
||
|
//line app/vmalert/web.qtpl:36
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:38
|
||
|
rOk := make(map[string]int)
|
||
|
rNotOk := make(map[string]int)
|
||
|
for _, g := range groups {
|
||
|
for _, r := range g.AlertingRules {
|
||
|
if r.LastError != "" {
|
||
|
rNotOk[g.Name]++
|
||
|
} else {
|
||
|
rOk[g.Name]++
|
||
|
}
|
||
|
}
|
||
|
for _, r := range g.RecordingRules {
|
||
|
if r.LastError != "" {
|
||
|
rNotOk[g.Name]++
|
||
|
} else {
|
||
|
rOk[g.Name]++
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//line app/vmalert/web.qtpl:56
|
||
|
qw422016.N().S(`
|
||
|
<a class="btn btn-primary" role="button" onclick="collapseAll()">Collapse All</a>
|
||
|
<a class="btn btn-primary" role="button" onclick="expandAll()">Expand All</a>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:59
|
||
|
for _, g := range groups {
|
||
|
//line app/vmalert/web.qtpl:59
|
||
|
qw422016.N().S(`
|
||
|
<div class="group-heading`)
|
||
|
//line app/vmalert/web.qtpl:60
|
||
|
if rNotOk[g.Name] > 0 {
|
||
|
//line app/vmalert/web.qtpl:60
|
||
|
qw422016.N().S(` alert-danger`)
|
||
|
//line app/vmalert/web.qtpl:60
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:60
|
||
|
qw422016.N().S(`" data-bs-target="rules-`)
|
||
|
//line app/vmalert/web.qtpl:60
|
||
|
qw422016.E().S(g.ID)
|
||
|
//line app/vmalert/web.qtpl:60
|
||
|
qw422016.N().S(`">
|
||
|
<span class="anchor" id="group-`)
|
||
|
//line app/vmalert/web.qtpl:61
|
||
|
qw422016.E().S(g.ID)
|
||
|
//line app/vmalert/web.qtpl:61
|
||
|
qw422016.N().S(`"></span>
|
||
|
<a href="#group-`)
|
||
|
//line app/vmalert/web.qtpl:62
|
||
|
qw422016.E().S(g.ID)
|
||
|
//line app/vmalert/web.qtpl:62
|
||
|
qw422016.N().S(`">`)
|
||
|
//line app/vmalert/web.qtpl:62
|
||
|
qw422016.E().S(g.Name)
|
||
|
//line app/vmalert/web.qtpl:62
|
||
|
if g.Type != "prometheus" {
|
||
|
//line app/vmalert/web.qtpl:62
|
||
|
qw422016.N().S(` (`)
|
||
|
//line app/vmalert/web.qtpl:62
|
||
|
qw422016.E().S(g.Type)
|
||
|
//line app/vmalert/web.qtpl:62
|
||
|
qw422016.N().S(`)`)
|
||
|
//line app/vmalert/web.qtpl:62
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:62
|
||
|
qw422016.N().S(` (every `)
|
||
|
//line app/vmalert/web.qtpl:62
|
||
|
qw422016.E().S(g.Interval)
|
||
|
//line app/vmalert/web.qtpl:62
|
||
|
qw422016.N().S(`)</a>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:63
|
||
|
if rNotOk[g.Name] > 0 {
|
||
|
//line app/vmalert/web.qtpl:63
|
||
|
qw422016.N().S(`<span class="badge bg-danger" title="Number of rules withs status Error">`)
|
||
|
//line app/vmalert/web.qtpl:63
|
||
|
qw422016.N().D(rNotOk[g.Name])
|
||
|
//line app/vmalert/web.qtpl:63
|
||
|
qw422016.N().S(`</span> `)
|
||
|
//line app/vmalert/web.qtpl:63
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:63
|
||
|
qw422016.N().S(`
|
||
|
<span class="badge bg-success" title="Number of rules withs status Ok">`)
|
||
|
//line app/vmalert/web.qtpl:64
|
||
|
qw422016.N().D(rOk[g.Name])
|
||
|
//line app/vmalert/web.qtpl:64
|
||
|
qw422016.N().S(`</span>
|
||
|
<p class="fs-6 fw-lighter">`)
|
||
|
//line app/vmalert/web.qtpl:65
|
||
|
qw422016.E().S(g.File)
|
||
|
//line app/vmalert/web.qtpl:65
|
||
|
qw422016.N().S(`</p>
|
||
|
</div>
|
||
|
<div class="collapse" id="rules-`)
|
||
|
//line app/vmalert/web.qtpl:67
|
||
|
qw422016.E().S(g.ID)
|
||
|
//line app/vmalert/web.qtpl:67
|
||
|
qw422016.N().S(`">
|
||
|
<table class="table table-striped table-hover table-sm">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th scope="col">Rule</th>
|
||
|
<th scope="col" title="Shows if rule's execution ended with error">Error</th>
|
||
|
<th scope="col" title="How many samples were produced by the rule">Samples</th>
|
||
|
<th scope="col" title="How many seconds ago rule was executed">Updated</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:78
|
||
|
for _, ar := range g.AlertingRules {
|
||
|
//line app/vmalert/web.qtpl:78
|
||
|
qw422016.N().S(`
|
||
|
<tr`)
|
||
|
//line app/vmalert/web.qtpl:79
|
||
|
if ar.LastError != "" {
|
||
|
//line app/vmalert/web.qtpl:79
|
||
|
qw422016.N().S(` class="alert-danger"`)
|
||
|
//line app/vmalert/web.qtpl:79
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:79
|
||
|
qw422016.N().S(`>
|
||
|
<td>
|
||
|
<b>alert:</b> `)
|
||
|
//line app/vmalert/web.qtpl:81
|
||
|
qw422016.E().S(ar.Name)
|
||
|
//line app/vmalert/web.qtpl:81
|
||
|
qw422016.N().S(` (for: `)
|
||
|
//line app/vmalert/web.qtpl:81
|
||
|
qw422016.E().V(ar.For)
|
||
|
//line app/vmalert/web.qtpl:81
|
||
|
qw422016.N().S(`)<br>
|
||
|
<code><pre>`)
|
||
|
//line app/vmalert/web.qtpl:82
|
||
|
qw422016.E().S(ar.Expression)
|
||
|
//line app/vmalert/web.qtpl:82
|
||
|
qw422016.N().S(`</pre></code><br>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:83
|
||
|
if len(ar.Labels) > 0 {
|
||
|
//line app/vmalert/web.qtpl:83
|
||
|
qw422016.N().S(` <b>Labels:</b>`)
|
||
|
//line app/vmalert/web.qtpl:83
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:83
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:84
|
||
|
for k, v := range ar.Labels {
|
||
|
//line app/vmalert/web.qtpl:84
|
||
|
qw422016.N().S(`
|
||
|
<span class="ms-1 badge bg-primary">`)
|
||
|
//line app/vmalert/web.qtpl:85
|
||
|
qw422016.E().S(k)
|
||
|
//line app/vmalert/web.qtpl:85
|
||
|
qw422016.N().S(`=`)
|
||
|
//line app/vmalert/web.qtpl:85
|
||
|
qw422016.E().S(v)
|
||
|
//line app/vmalert/web.qtpl:85
|
||
|
qw422016.N().S(`</span>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:86
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:86
|
||
|
qw422016.N().S(`
|
||
|
</td>
|
||
|
<td><div class="error-cell">`)
|
||
|
//line app/vmalert/web.qtpl:88
|
||
|
qw422016.E().S(ar.LastError)
|
||
|
//line app/vmalert/web.qtpl:88
|
||
|
qw422016.N().S(`</div></td>
|
||
|
<td>`)
|
||
|
//line app/vmalert/web.qtpl:89
|
||
|
qw422016.N().D(ar.LastSamples)
|
||
|
//line app/vmalert/web.qtpl:89
|
||
|
qw422016.N().S(`</td>
|
||
|
<td>`)
|
||
|
//line app/vmalert/web.qtpl:90
|
||
|
qw422016.N().FPrec(time.Since(ar.LastExec).Seconds(), 3)
|
||
|
//line app/vmalert/web.qtpl:90
|
||
|
qw422016.N().S(`s ago</td>
|
||
|
</tr>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:92
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:92
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:93
|
||
|
for _, rr := range g.RecordingRules {
|
||
|
//line app/vmalert/web.qtpl:93
|
||
|
qw422016.N().S(`
|
||
|
<tr>
|
||
|
<td>
|
||
|
<b>record:</b> `)
|
||
|
//line app/vmalert/web.qtpl:96
|
||
|
qw422016.E().S(rr.Name)
|
||
|
//line app/vmalert/web.qtpl:96
|
||
|
qw422016.N().S(`<br>
|
||
|
<code><pre>`)
|
||
|
//line app/vmalert/web.qtpl:97
|
||
|
qw422016.E().S(rr.Expression)
|
||
|
//line app/vmalert/web.qtpl:97
|
||
|
qw422016.N().S(`</pre></code>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:98
|
||
|
if len(rr.Labels) > 0 {
|
||
|
//line app/vmalert/web.qtpl:98
|
||
|
qw422016.N().S(` <b>Labels:</b>`)
|
||
|
//line app/vmalert/web.qtpl:98
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:98
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:99
|
||
|
for k, v := range rr.Labels {
|
||
|
//line app/vmalert/web.qtpl:99
|
||
|
qw422016.N().S(`
|
||
|
<span class="ms-1 badge bg-primary">`)
|
||
|
//line app/vmalert/web.qtpl:100
|
||
|
qw422016.E().S(k)
|
||
|
//line app/vmalert/web.qtpl:100
|
||
|
qw422016.N().S(`=`)
|
||
|
//line app/vmalert/web.qtpl:100
|
||
|
qw422016.E().S(v)
|
||
|
//line app/vmalert/web.qtpl:100
|
||
|
qw422016.N().S(`</span>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:101
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:101
|
||
|
qw422016.N().S(`
|
||
|
</td>
|
||
|
<td><div class="error-cell">`)
|
||
|
//line app/vmalert/web.qtpl:103
|
||
|
qw422016.E().S(rr.LastError)
|
||
|
//line app/vmalert/web.qtpl:103
|
||
|
qw422016.N().S(`</div></td>
|
||
|
<td>`)
|
||
|
//line app/vmalert/web.qtpl:104
|
||
|
qw422016.N().D(rr.LastSamples)
|
||
|
//line app/vmalert/web.qtpl:104
|
||
|
qw422016.N().S(`</td>
|
||
|
<td>`)
|
||
|
//line app/vmalert/web.qtpl:105
|
||
|
qw422016.N().FPrec(time.Since(rr.LastExec).Seconds(), 3)
|
||
|
//line app/vmalert/web.qtpl:105
|
||
|
qw422016.N().S(`s ago</td>
|
||
|
</tr>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:107
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:107
|
||
|
qw422016.N().S(`
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:111
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:111
|
||
|
qw422016.N().S(`
|
||
|
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:113
|
||
|
} else {
|
||
|
//line app/vmalert/web.qtpl:113
|
||
|
qw422016.N().S(`
|
||
|
<div>
|
||
|
<p>No items...</p>
|
||
|
</div>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:117
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:117
|
||
|
qw422016.N().S(`
|
||
|
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:119
|
||
|
tpl.StreamFooter(qw422016)
|
||
|
//line app/vmalert/web.qtpl:119
|
||
|
qw422016.N().S(`
|
||
|
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:121
|
||
|
}
|
||
|
|
||
|
//line app/vmalert/web.qtpl:121
|
||
|
func WriteListGroups(qq422016 qtio422016.Writer, groups []APIGroup) {
|
||
|
//line app/vmalert/web.qtpl:121
|
||
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||
|
//line app/vmalert/web.qtpl:121
|
||
|
StreamListGroups(qw422016, groups)
|
||
|
//line app/vmalert/web.qtpl:121
|
||
|
qt422016.ReleaseWriter(qw422016)
|
||
|
//line app/vmalert/web.qtpl:121
|
||
|
}
|
||
|
|
||
|
//line app/vmalert/web.qtpl:121
|
||
|
func ListGroups(groups []APIGroup) string {
|
||
|
//line app/vmalert/web.qtpl:121
|
||
|
qb422016 := qt422016.AcquireByteBuffer()
|
||
|
//line app/vmalert/web.qtpl:121
|
||
|
WriteListGroups(qb422016, groups)
|
||
|
//line app/vmalert/web.qtpl:121
|
||
|
qs422016 := string(qb422016.B)
|
||
|
//line app/vmalert/web.qtpl:121
|
||
|
qt422016.ReleaseByteBuffer(qb422016)
|
||
|
//line app/vmalert/web.qtpl:121
|
||
|
return qs422016
|
||
|
//line app/vmalert/web.qtpl:121
|
||
|
}
|
||
|
|
||
|
//line app/vmalert/web.qtpl:124
|
||
|
func StreamListAlerts(qw422016 *qt422016.Writer, groupAlerts []GroupAlerts) {
|
||
|
//line app/vmalert/web.qtpl:124
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:125
|
||
|
tpl.StreamHeader(qw422016, "Alerts", navItems)
|
||
|
//line app/vmalert/web.qtpl:125
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:126
|
||
|
if len(groupAlerts) > 0 {
|
||
|
//line app/vmalert/web.qtpl:126
|
||
|
qw422016.N().S(`
|
||
|
<a class="btn btn-primary" role="button" onclick="collapseAll()">Collapse All</a>
|
||
|
<a class="btn btn-primary" role="button" onclick="expandAll()">Expand All</a>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:129
|
||
|
for _, ga := range groupAlerts {
|
||
|
//line app/vmalert/web.qtpl:129
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:130
|
||
|
g := ga.Group
|
||
|
|
||
|
//line app/vmalert/web.qtpl:130
|
||
|
qw422016.N().S(`
|
||
|
<div class="group-heading alert-danger" data-bs-target="rules-`)
|
||
|
//line app/vmalert/web.qtpl:131
|
||
|
qw422016.E().S(g.ID)
|
||
|
//line app/vmalert/web.qtpl:131
|
||
|
qw422016.N().S(`">
|
||
|
<span class="anchor" id="group-`)
|
||
|
//line app/vmalert/web.qtpl:132
|
||
|
qw422016.E().S(g.ID)
|
||
|
//line app/vmalert/web.qtpl:132
|
||
|
qw422016.N().S(`"></span>
|
||
|
<a href="#group-`)
|
||
|
//line app/vmalert/web.qtpl:133
|
||
|
qw422016.E().S(g.ID)
|
||
|
//line app/vmalert/web.qtpl:133
|
||
|
qw422016.N().S(`">`)
|
||
|
//line app/vmalert/web.qtpl:133
|
||
|
qw422016.E().S(g.Name)
|
||
|
//line app/vmalert/web.qtpl:133
|
||
|
if g.Type != "prometheus" {
|
||
|
//line app/vmalert/web.qtpl:133
|
||
|
qw422016.N().S(` (`)
|
||
|
//line app/vmalert/web.qtpl:133
|
||
|
qw422016.E().S(g.Type)
|
||
|
//line app/vmalert/web.qtpl:133
|
||
|
qw422016.N().S(`)`)
|
||
|
//line app/vmalert/web.qtpl:133
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:133
|
||
|
qw422016.N().S(`</a>
|
||
|
<span class="badge bg-danger" title="Number of active alerts">`)
|
||
|
//line app/vmalert/web.qtpl:134
|
||
|
qw422016.N().D(len(ga.Alerts))
|
||
|
//line app/vmalert/web.qtpl:134
|
||
|
qw422016.N().S(`</span>
|
||
|
<br>
|
||
|
<p class="fs-6 fw-lighter">`)
|
||
|
//line app/vmalert/web.qtpl:136
|
||
|
qw422016.E().S(g.File)
|
||
|
//line app/vmalert/web.qtpl:136
|
||
|
qw422016.N().S(`</p>
|
||
|
</div>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:139
|
||
|
var keys []string
|
||
|
alertsByRule := make(map[string][]*APIAlert)
|
||
|
for _, alert := range ga.Alerts {
|
||
|
if len(alertsByRule[alert.RuleID]) < 1 {
|
||
|
keys = append(keys, alert.RuleID)
|
||
|
}
|
||
|
alertsByRule[alert.RuleID] = append(alertsByRule[alert.RuleID], alert)
|
||
|
}
|
||
|
sort.Strings(keys)
|
||
|
|
||
|
//line app/vmalert/web.qtpl:148
|
||
|
qw422016.N().S(`
|
||
|
<div class="collapse" id="rules-`)
|
||
|
//line app/vmalert/web.qtpl:149
|
||
|
qw422016.E().S(g.ID)
|
||
|
//line app/vmalert/web.qtpl:149
|
||
|
qw422016.N().S(`">
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:150
|
||
|
for _, ruleID := range keys {
|
||
|
//line app/vmalert/web.qtpl:150
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:152
|
||
|
defaultAR := alertsByRule[ruleID][0]
|
||
|
var labelKeys []string
|
||
|
for k := range defaultAR.Labels {
|
||
|
labelKeys = append(labelKeys, k)
|
||
|
}
|
||
|
sort.Strings(labelKeys)
|
||
|
|
||
|
//line app/vmalert/web.qtpl:158
|
||
|
qw422016.N().S(`
|
||
|
<br>
|
||
|
<b>alert:</b> `)
|
||
|
//line app/vmalert/web.qtpl:160
|
||
|
qw422016.E().S(defaultAR.Name)
|
||
|
//line app/vmalert/web.qtpl:160
|
||
|
qw422016.N().S(` (`)
|
||
|
//line app/vmalert/web.qtpl:160
|
||
|
qw422016.N().D(len(alertsByRule[ruleID]))
|
||
|
//line app/vmalert/web.qtpl:160
|
||
|
qw422016.N().S(`)<br>
|
||
|
<b>expr:</b><code><pre>`)
|
||
|
//line app/vmalert/web.qtpl:161
|
||
|
qw422016.E().S(defaultAR.Expression)
|
||
|
//line app/vmalert/web.qtpl:161
|
||
|
qw422016.N().S(`</pre></code>
|
||
|
<table class="table table-striped table-hover table-sm">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th scope="col">Labels</th>
|
||
|
<th scope="col">State</th>
|
||
|
<th scope="col">Active at</th>
|
||
|
<th scope="col">Value</th>
|
||
|
<th scope="col">Link</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:173
|
||
|
for _, ar := range alertsByRule[ruleID] {
|
||
|
//line app/vmalert/web.qtpl:173
|
||
|
qw422016.N().S(`
|
||
|
<tr>
|
||
|
<td>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:176
|
||
|
for _, k := range labelKeys {
|
||
|
//line app/vmalert/web.qtpl:176
|
||
|
qw422016.N().S(`
|
||
|
<span class="ms-1 badge bg-primary">`)
|
||
|
//line app/vmalert/web.qtpl:177
|
||
|
qw422016.E().S(k)
|
||
|
//line app/vmalert/web.qtpl:177
|
||
|
qw422016.N().S(`=`)
|
||
|
//line app/vmalert/web.qtpl:177
|
||
|
qw422016.E().S(ar.Labels[k])
|
||
|
//line app/vmalert/web.qtpl:177
|
||
|
qw422016.N().S(`</span>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:178
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:178
|
||
|
qw422016.N().S(`
|
||
|
</td>
|
||
|
<td><span class="badge `)
|
||
|
//line app/vmalert/web.qtpl:180
|
||
|
if ar.State == "firing" {
|
||
|
//line app/vmalert/web.qtpl:180
|
||
|
qw422016.N().S(`bg-danger`)
|
||
|
//line app/vmalert/web.qtpl:180
|
||
|
} else {
|
||
|
//line app/vmalert/web.qtpl:180
|
||
|
qw422016.N().S(` bg-warning text-dark`)
|
||
|
//line app/vmalert/web.qtpl:180
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:180
|
||
|
qw422016.N().S(`">`)
|
||
|
//line app/vmalert/web.qtpl:180
|
||
|
qw422016.E().S(ar.State)
|
||
|
//line app/vmalert/web.qtpl:180
|
||
|
qw422016.N().S(`</span></td>
|
||
|
<td>`)
|
||
|
//line app/vmalert/web.qtpl:181
|
||
|
qw422016.E().S(ar.ActiveAt.Format("2006-01-02T15:04:05Z07:00"))
|
||
|
//line app/vmalert/web.qtpl:181
|
||
|
qw422016.N().S(`</td>
|
||
|
<td>`)
|
||
|
//line app/vmalert/web.qtpl:182
|
||
|
qw422016.E().S(ar.Value)
|
||
|
//line app/vmalert/web.qtpl:182
|
||
|
qw422016.N().S(`</td>
|
||
|
<td>
|
||
|
<a href="/`)
|
||
|
//line app/vmalert/web.qtpl:184
|
||
|
qw422016.E().S(g.ID)
|
||
|
//line app/vmalert/web.qtpl:184
|
||
|
qw422016.N().S(`/`)
|
||
|
//line app/vmalert/web.qtpl:184
|
||
|
qw422016.E().S(ar.ID)
|
||
|
//line app/vmalert/web.qtpl:184
|
||
|
qw422016.N().S(`/status">Details</a>
|
||
|
</td>
|
||
|
</tr>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:187
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:187
|
||
|
qw422016.N().S(`
|
||
|
</tbody>
|
||
|
</table>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:190
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:190
|
||
|
qw422016.N().S(`
|
||
|
</div>
|
||
|
<br>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:193
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:193
|
||
|
qw422016.N().S(`
|
||
|
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:195
|
||
|
} else {
|
||
|
//line app/vmalert/web.qtpl:195
|
||
|
qw422016.N().S(`
|
||
|
<div>
|
||
|
<p>No items...</p>
|
||
|
</div>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:199
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:199
|
||
|
qw422016.N().S(`
|
||
|
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:201
|
||
|
tpl.StreamFooter(qw422016)
|
||
|
//line app/vmalert/web.qtpl:201
|
||
|
qw422016.N().S(`
|
||
|
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:203
|
||
|
}
|
||
|
|
||
|
//line app/vmalert/web.qtpl:203
|
||
|
func WriteListAlerts(qq422016 qtio422016.Writer, groupAlerts []GroupAlerts) {
|
||
|
//line app/vmalert/web.qtpl:203
|
||
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||
|
//line app/vmalert/web.qtpl:203
|
||
|
StreamListAlerts(qw422016, groupAlerts)
|
||
|
//line app/vmalert/web.qtpl:203
|
||
|
qt422016.ReleaseWriter(qw422016)
|
||
|
//line app/vmalert/web.qtpl:203
|
||
|
}
|
||
|
|
||
|
//line app/vmalert/web.qtpl:203
|
||
|
func ListAlerts(groupAlerts []GroupAlerts) string {
|
||
|
//line app/vmalert/web.qtpl:203
|
||
|
qb422016 := qt422016.AcquireByteBuffer()
|
||
|
//line app/vmalert/web.qtpl:203
|
||
|
WriteListAlerts(qb422016, groupAlerts)
|
||
|
//line app/vmalert/web.qtpl:203
|
||
|
qs422016 := string(qb422016.B)
|
||
|
//line app/vmalert/web.qtpl:203
|
||
|
qt422016.ReleaseByteBuffer(qb422016)
|
||
|
//line app/vmalert/web.qtpl:203
|
||
|
return qs422016
|
||
|
//line app/vmalert/web.qtpl:203
|
||
|
}
|
||
|
|
||
|
//line app/vmalert/web.qtpl:205
|
||
|
func StreamAlert(qw422016 *qt422016.Writer, alert *APIAlert) {
|
||
|
//line app/vmalert/web.qtpl:205
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:206
|
||
|
tpl.StreamHeader(qw422016, "", navItems)
|
||
|
//line app/vmalert/web.qtpl:206
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:208
|
||
|
var labelKeys []string
|
||
|
for k := range alert.Labels {
|
||
|
labelKeys = append(labelKeys, k)
|
||
|
}
|
||
|
sort.Strings(labelKeys)
|
||
|
|
||
|
var annotationKeys []string
|
||
|
for k := range alert.Annotations {
|
||
|
annotationKeys = append(annotationKeys, k)
|
||
|
}
|
||
|
sort.Strings(annotationKeys)
|
||
|
|
||
|
//line app/vmalert/web.qtpl:219
|
||
|
qw422016.N().S(`
|
||
|
<div class="display-6 pb-3 mb-3">`)
|
||
|
//line app/vmalert/web.qtpl:220
|
||
|
qw422016.E().S(alert.Name)
|
||
|
//line app/vmalert/web.qtpl:220
|
||
|
qw422016.N().S(`<span class="ms-2 badge `)
|
||
|
//line app/vmalert/web.qtpl:220
|
||
|
if alert.State == "firing" {
|
||
|
//line app/vmalert/web.qtpl:220
|
||
|
qw422016.N().S(`bg-danger`)
|
||
|
//line app/vmalert/web.qtpl:220
|
||
|
} else {
|
||
|
//line app/vmalert/web.qtpl:220
|
||
|
qw422016.N().S(` bg-warning text-dark`)
|
||
|
//line app/vmalert/web.qtpl:220
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:220
|
||
|
qw422016.N().S(`">`)
|
||
|
//line app/vmalert/web.qtpl:220
|
||
|
qw422016.E().S(alert.State)
|
||
|
//line app/vmalert/web.qtpl:220
|
||
|
qw422016.N().S(`</span></div>
|
||
|
<div class="container border-bottom p-2">
|
||
|
<div class="row">
|
||
|
<div class="col-2">
|
||
|
Active at
|
||
|
</div>
|
||
|
<div class="col">
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:227
|
||
|
qw422016.E().S(alert.ActiveAt.Format("2006-01-02T15:04:05Z07:00"))
|
||
|
//line app/vmalert/web.qtpl:227
|
||
|
qw422016.N().S(`
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="container border-bottom p-2">
|
||
|
<div class="row">
|
||
|
<div class="col-2">
|
||
|
Expr
|
||
|
</div>
|
||
|
<div class="col">
|
||
|
<code><pre>`)
|
||
|
//line app/vmalert/web.qtpl:237
|
||
|
qw422016.E().S(alert.Expression)
|
||
|
//line app/vmalert/web.qtpl:237
|
||
|
qw422016.N().S(`</pre></code>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="container border-bottom p-2">
|
||
|
<div class="row">
|
||
|
<div class="col-2">
|
||
|
Labels
|
||
|
</div>
|
||
|
<div class="col">
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:247
|
||
|
for _, k := range labelKeys {
|
||
|
//line app/vmalert/web.qtpl:247
|
||
|
qw422016.N().S(`
|
||
|
<span class="m-1 badge bg-primary">`)
|
||
|
//line app/vmalert/web.qtpl:248
|
||
|
qw422016.E().S(k)
|
||
|
//line app/vmalert/web.qtpl:248
|
||
|
qw422016.N().S(`=`)
|
||
|
//line app/vmalert/web.qtpl:248
|
||
|
qw422016.E().S(alert.Labels[k])
|
||
|
//line app/vmalert/web.qtpl:248
|
||
|
qw422016.N().S(`</span>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:249
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:249
|
||
|
qw422016.N().S(`
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="container border-bottom p-2">
|
||
|
<div class="row">
|
||
|
<div class="col-2">
|
||
|
Annotations
|
||
|
</div>
|
||
|
<div class="col">
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:259
|
||
|
for _, k := range annotationKeys {
|
||
|
//line app/vmalert/web.qtpl:259
|
||
|
qw422016.N().S(`
|
||
|
<b>`)
|
||
|
//line app/vmalert/web.qtpl:260
|
||
|
qw422016.E().S(k)
|
||
|
//line app/vmalert/web.qtpl:260
|
||
|
qw422016.N().S(`:</b><br>
|
||
|
<p>`)
|
||
|
//line app/vmalert/web.qtpl:261
|
||
|
qw422016.E().S(alert.Annotations[k])
|
||
|
//line app/vmalert/web.qtpl:261
|
||
|
qw422016.N().S(`</p>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:262
|
||
|
}
|
||
|
//line app/vmalert/web.qtpl:262
|
||
|
qw422016.N().S(`
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="container border-bottom p-2">
|
||
|
<div class="row">
|
||
|
<div class="col-2">
|
||
|
Group
|
||
|
</div>
|
||
|
<div class="col">
|
||
|
<a target="_blank" href="/groups#group-`)
|
||
|
//line app/vmalert/web.qtpl:272
|
||
|
qw422016.E().S(alert.GroupID)
|
||
|
//line app/vmalert/web.qtpl:272
|
||
|
qw422016.N().S(`">`)
|
||
|
//line app/vmalert/web.qtpl:272
|
||
|
qw422016.E().S(alert.GroupID)
|
||
|
//line app/vmalert/web.qtpl:272
|
||
|
qw422016.N().S(`</a>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:276
|
||
|
tpl.StreamFooter(qw422016)
|
||
|
//line app/vmalert/web.qtpl:276
|
||
|
qw422016.N().S(`
|
||
|
|
||
|
`)
|
||
|
//line app/vmalert/web.qtpl:278
|
||
|
}
|
||
|
|
||
|
//line app/vmalert/web.qtpl:278
|
||
|
func WriteAlert(qq422016 qtio422016.Writer, alert *APIAlert) {
|
||
|
//line app/vmalert/web.qtpl:278
|
||
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||
|
//line app/vmalert/web.qtpl:278
|
||
|
StreamAlert(qw422016, alert)
|
||
|
//line app/vmalert/web.qtpl:278
|
||
|
qt422016.ReleaseWriter(qw422016)
|
||
|
//line app/vmalert/web.qtpl:278
|
||
|
}
|
||
|
|
||
|
//line app/vmalert/web.qtpl:278
|
||
|
func Alert(alert *APIAlert) string {
|
||
|
//line app/vmalert/web.qtpl:278
|
||
|
qb422016 := qt422016.AcquireByteBuffer()
|
||
|
//line app/vmalert/web.qtpl:278
|
||
|
WriteAlert(qb422016, alert)
|
||
|
//line app/vmalert/web.qtpl:278
|
||
|
qs422016 := string(qb422016.B)
|
||
|
//line app/vmalert/web.qtpl:278
|
||
|
qt422016.ReleaseByteBuffer(qb422016)
|
||
|
//line app/vmalert/web.qtpl:278
|
||
|
return qs422016
|
||
|
//line app/vmalert/web.qtpl:278
|
||
|
}
|