mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
e83f14210d
* vmalert: use group's ID in UI to avoid collisions Identical group names are allowed. So we should used IDs for various groupings and aggregations in UI. Signed-off-by: hagen1778 <roman@victoriametrics.com> * vmalert: prevent disabling state updates tracking The minimum number of update states to track is now set to 1. Signed-off-by: hagen1778 <roman@victoriametrics.com> * vmalert: properly update `debug` and `update_entries_limit` params on hot-reload Signed-off-by: hagen1778 <roman@victoriametrics.com> * vmalert: display `debug` field for rule in UI Signed-off-by: hagen1778 <roman@victoriametrics.com> * vmalert: exclude `updates` field from json marhsaling This field isn't correctly marshaled right now. And implementing the correct marshaling for it doesn't seem right, since json representation is mostly used by systems like Grafana. And Grafana doesn't expect this field to be present. Signed-off-by: hagen1778 <roman@victoriametrics.com> * fix test for disabled state Signed-off-by: hagen1778 <roman@victoriametrics.com> * fix test for disabled state Signed-off-by: hagen1778 <roman@victoriametrics.com> --------- Signed-off-by: hagen1778 <roman@victoriametrics.com>
1578 lines
44 KiB
Go
1578 lines
44 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 (
|
|
"net/http"
|
|
"sort"
|
|
"time"
|
|
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/notifier"
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/tpl"
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/utils"
|
|
)
|
|
|
|
//line app/vmalert/web.qtpl:14
|
|
import (
|
|
qtio422016 "io"
|
|
|
|
qt422016 "github.com/valyala/quicktemplate"
|
|
)
|
|
|
|
//line app/vmalert/web.qtpl:14
|
|
var (
|
|
_ = qtio422016.Copy
|
|
_ = qt422016.AcquireByteBuffer
|
|
)
|
|
|
|
//line app/vmalert/web.qtpl:14
|
|
func StreamWelcome(qw422016 *qt422016.Writer, r *http.Request) {
|
|
//line app/vmalert/web.qtpl:14
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:15
|
|
tpl.StreamHeader(qw422016, r, navItems, "vmalert")
|
|
//line app/vmalert/web.qtpl:15
|
|
qw422016.N().S(`
|
|
<p>
|
|
API:<br>
|
|
`)
|
|
//line app/vmalert/web.qtpl:18
|
|
for _, p := range apiLinks {
|
|
//line app/vmalert/web.qtpl:18
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:19
|
|
p, doc := p[0], p[1]
|
|
|
|
//line app/vmalert/web.qtpl:19
|
|
qw422016.N().S(`
|
|
<a href="`)
|
|
//line app/vmalert/web.qtpl:20
|
|
qw422016.E().S(p)
|
|
//line app/vmalert/web.qtpl:20
|
|
qw422016.N().S(`">`)
|
|
//line app/vmalert/web.qtpl:20
|
|
qw422016.E().S(p)
|
|
//line app/vmalert/web.qtpl:20
|
|
qw422016.N().S(`</a> - `)
|
|
//line app/vmalert/web.qtpl:20
|
|
qw422016.E().S(doc)
|
|
//line app/vmalert/web.qtpl:20
|
|
qw422016.N().S(`<br/>
|
|
`)
|
|
//line app/vmalert/web.qtpl:21
|
|
}
|
|
//line app/vmalert/web.qtpl:21
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:22
|
|
if r.Header.Get("X-Forwarded-For") == "" {
|
|
//line app/vmalert/web.qtpl:22
|
|
qw422016.N().S(`
|
|
System:<br>
|
|
`)
|
|
//line app/vmalert/web.qtpl:24
|
|
for _, p := range systemLinks {
|
|
//line app/vmalert/web.qtpl:24
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:25
|
|
p, doc := p[0], p[1]
|
|
|
|
//line app/vmalert/web.qtpl:25
|
|
qw422016.N().S(`
|
|
<a href="`)
|
|
//line app/vmalert/web.qtpl:26
|
|
qw422016.E().S(p)
|
|
//line app/vmalert/web.qtpl:26
|
|
qw422016.N().S(`">`)
|
|
//line app/vmalert/web.qtpl:26
|
|
qw422016.E().S(p)
|
|
//line app/vmalert/web.qtpl:26
|
|
qw422016.N().S(`</a> - `)
|
|
//line app/vmalert/web.qtpl:26
|
|
qw422016.E().S(doc)
|
|
//line app/vmalert/web.qtpl:26
|
|
qw422016.N().S(`<br/>
|
|
`)
|
|
//line app/vmalert/web.qtpl:27
|
|
}
|
|
//line app/vmalert/web.qtpl:27
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:28
|
|
}
|
|
//line app/vmalert/web.qtpl:28
|
|
qw422016.N().S(`
|
|
</p>
|
|
`)
|
|
//line app/vmalert/web.qtpl:30
|
|
tpl.StreamFooter(qw422016, r)
|
|
//line app/vmalert/web.qtpl:30
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:31
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:31
|
|
func WriteWelcome(qq422016 qtio422016.Writer, r *http.Request) {
|
|
//line app/vmalert/web.qtpl:31
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line app/vmalert/web.qtpl:31
|
|
StreamWelcome(qw422016, r)
|
|
//line app/vmalert/web.qtpl:31
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line app/vmalert/web.qtpl:31
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:31
|
|
func Welcome(r *http.Request) string {
|
|
//line app/vmalert/web.qtpl:31
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line app/vmalert/web.qtpl:31
|
|
WriteWelcome(qb422016, r)
|
|
//line app/vmalert/web.qtpl:31
|
|
qs422016 := string(qb422016.B)
|
|
//line app/vmalert/web.qtpl:31
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line app/vmalert/web.qtpl:31
|
|
return qs422016
|
|
//line app/vmalert/web.qtpl:31
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:33
|
|
func StreamListGroups(qw422016 *qt422016.Writer, r *http.Request, groups []APIGroup) {
|
|
//line app/vmalert/web.qtpl:33
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:34
|
|
prefix := utils.Prefix(r.URL.Path)
|
|
|
|
//line app/vmalert/web.qtpl:34
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:35
|
|
tpl.StreamHeader(qw422016, r, navItems, "Groups")
|
|
//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.Rules {
|
|
if r.LastError != "" {
|
|
rNotOk[g.ID]++
|
|
} else {
|
|
rOk[g.ID]++
|
|
}
|
|
}
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:49
|
|
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:52
|
|
for _, g := range groups {
|
|
//line app/vmalert/web.qtpl:52
|
|
qw422016.N().S(`
|
|
<div class="group-heading`)
|
|
//line app/vmalert/web.qtpl:53
|
|
if rNotOk[g.ID] > 0 {
|
|
//line app/vmalert/web.qtpl:53
|
|
qw422016.N().S(` alert-danger`)
|
|
//line app/vmalert/web.qtpl:53
|
|
}
|
|
//line app/vmalert/web.qtpl:53
|
|
qw422016.N().S(`" data-bs-target="rules-`)
|
|
//line app/vmalert/web.qtpl:53
|
|
qw422016.E().S(g.ID)
|
|
//line app/vmalert/web.qtpl:53
|
|
qw422016.N().S(`">
|
|
<span class="anchor" id="group-`)
|
|
//line app/vmalert/web.qtpl:54
|
|
qw422016.E().S(g.ID)
|
|
//line app/vmalert/web.qtpl:54
|
|
qw422016.N().S(`"></span>
|
|
<a href="#group-`)
|
|
//line app/vmalert/web.qtpl:55
|
|
qw422016.E().S(g.ID)
|
|
//line app/vmalert/web.qtpl:55
|
|
qw422016.N().S(`">`)
|
|
//line app/vmalert/web.qtpl:55
|
|
qw422016.E().S(g.Name)
|
|
//line app/vmalert/web.qtpl:55
|
|
if g.Type != "prometheus" {
|
|
//line app/vmalert/web.qtpl:55
|
|
qw422016.N().S(` (`)
|
|
//line app/vmalert/web.qtpl:55
|
|
qw422016.E().S(g.Type)
|
|
//line app/vmalert/web.qtpl:55
|
|
qw422016.N().S(`)`)
|
|
//line app/vmalert/web.qtpl:55
|
|
}
|
|
//line app/vmalert/web.qtpl:55
|
|
qw422016.N().S(` (every `)
|
|
//line app/vmalert/web.qtpl:55
|
|
qw422016.N().FPrec(g.Interval, 0)
|
|
//line app/vmalert/web.qtpl:55
|
|
qw422016.N().S(`s)</a>
|
|
`)
|
|
//line app/vmalert/web.qtpl:56
|
|
if rNotOk[g.ID] > 0 {
|
|
//line app/vmalert/web.qtpl:56
|
|
qw422016.N().S(`<span class="badge bg-danger" title="Number of rules with status Error">`)
|
|
//line app/vmalert/web.qtpl:56
|
|
qw422016.N().D(rNotOk[g.ID])
|
|
//line app/vmalert/web.qtpl:56
|
|
qw422016.N().S(`</span> `)
|
|
//line app/vmalert/web.qtpl:56
|
|
}
|
|
//line app/vmalert/web.qtpl:56
|
|
qw422016.N().S(`
|
|
<span class="badge bg-success" title="Number of rules withs status Ok">`)
|
|
//line app/vmalert/web.qtpl:57
|
|
qw422016.N().D(rOk[g.ID])
|
|
//line app/vmalert/web.qtpl:57
|
|
qw422016.N().S(`</span>
|
|
<p class="fs-6 fw-lighter">`)
|
|
//line app/vmalert/web.qtpl:58
|
|
qw422016.E().S(g.File)
|
|
//line app/vmalert/web.qtpl:58
|
|
qw422016.N().S(`</p>
|
|
`)
|
|
//line app/vmalert/web.qtpl:59
|
|
if len(g.Params) > 0 {
|
|
//line app/vmalert/web.qtpl:59
|
|
qw422016.N().S(`
|
|
<div class="fs-6 fw-lighter">Extra params
|
|
`)
|
|
//line app/vmalert/web.qtpl:61
|
|
for _, param := range g.Params {
|
|
//line app/vmalert/web.qtpl:61
|
|
qw422016.N().S(`
|
|
<span class="float-left badge bg-primary">`)
|
|
//line app/vmalert/web.qtpl:62
|
|
qw422016.E().S(param)
|
|
//line app/vmalert/web.qtpl:62
|
|
qw422016.N().S(`</span>
|
|
`)
|
|
//line app/vmalert/web.qtpl:63
|
|
}
|
|
//line app/vmalert/web.qtpl:63
|
|
qw422016.N().S(`
|
|
</div>
|
|
`)
|
|
//line app/vmalert/web.qtpl:65
|
|
}
|
|
//line app/vmalert/web.qtpl:65
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:66
|
|
if len(g.Headers) > 0 {
|
|
//line app/vmalert/web.qtpl:66
|
|
qw422016.N().S(`
|
|
<div class="fs-6 fw-lighter">Extra headers
|
|
`)
|
|
//line app/vmalert/web.qtpl:68
|
|
for _, header := range g.Headers {
|
|
//line app/vmalert/web.qtpl:68
|
|
qw422016.N().S(`
|
|
<span class="float-left badge bg-primary">`)
|
|
//line app/vmalert/web.qtpl:69
|
|
qw422016.E().S(header)
|
|
//line app/vmalert/web.qtpl:69
|
|
qw422016.N().S(`</span>
|
|
`)
|
|
//line app/vmalert/web.qtpl:70
|
|
}
|
|
//line app/vmalert/web.qtpl:70
|
|
qw422016.N().S(`
|
|
</div>
|
|
`)
|
|
//line app/vmalert/web.qtpl:72
|
|
}
|
|
//line app/vmalert/web.qtpl:72
|
|
qw422016.N().S(`
|
|
</div>
|
|
<div class="collapse" id="rules-`)
|
|
//line app/vmalert/web.qtpl:74
|
|
qw422016.E().S(g.ID)
|
|
//line app/vmalert/web.qtpl:74
|
|
qw422016.N().S(`">
|
|
<table class="table table-striped table-hover table-sm">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col" style="width: 60%">Rule</th>
|
|
<th scope="col" style="width: 20%" class="text-center" title="How many samples were produced by the rule">Samples</th>
|
|
<th scope="col" style="width: 20%" class="text-center" title="How many seconds ago rule was executed">Updated</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
`)
|
|
//line app/vmalert/web.qtpl:84
|
|
for _, r := range g.Rules {
|
|
//line app/vmalert/web.qtpl:84
|
|
qw422016.N().S(`
|
|
<tr`)
|
|
//line app/vmalert/web.qtpl:85
|
|
if r.LastError != "" {
|
|
//line app/vmalert/web.qtpl:85
|
|
qw422016.N().S(` class="alert-danger"`)
|
|
//line app/vmalert/web.qtpl:85
|
|
}
|
|
//line app/vmalert/web.qtpl:85
|
|
qw422016.N().S(`>
|
|
<td>
|
|
<div class="row">
|
|
<div class="col-12 mb-2">
|
|
`)
|
|
//line app/vmalert/web.qtpl:89
|
|
if r.Type == "alerting" {
|
|
//line app/vmalert/web.qtpl:89
|
|
qw422016.N().S(`
|
|
<b>alert:</b> `)
|
|
//line app/vmalert/web.qtpl:90
|
|
qw422016.E().S(r.Name)
|
|
//line app/vmalert/web.qtpl:90
|
|
qw422016.N().S(` (for: `)
|
|
//line app/vmalert/web.qtpl:90
|
|
qw422016.E().V(r.Duration)
|
|
//line app/vmalert/web.qtpl:90
|
|
qw422016.N().S(` seconds)
|
|
`)
|
|
//line app/vmalert/web.qtpl:91
|
|
} else {
|
|
//line app/vmalert/web.qtpl:91
|
|
qw422016.N().S(`
|
|
<b>record:</b> `)
|
|
//line app/vmalert/web.qtpl:92
|
|
qw422016.E().S(r.Name)
|
|
//line app/vmalert/web.qtpl:92
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:93
|
|
}
|
|
//line app/vmalert/web.qtpl:93
|
|
qw422016.N().S(`
|
|
| <span><a target="_blank" href="`)
|
|
//line app/vmalert/web.qtpl:94
|
|
qw422016.E().S(prefix + r.WebLink())
|
|
//line app/vmalert/web.qtpl:94
|
|
qw422016.N().S(`">Details</a></span>
|
|
</div>
|
|
<div class="col-12">
|
|
<code><pre>`)
|
|
//line app/vmalert/web.qtpl:97
|
|
qw422016.E().S(r.Query)
|
|
//line app/vmalert/web.qtpl:97
|
|
qw422016.N().S(`</pre></code>
|
|
</div>
|
|
<div class="col-12 mb-2">
|
|
`)
|
|
//line app/vmalert/web.qtpl:100
|
|
if len(r.Labels) > 0 {
|
|
//line app/vmalert/web.qtpl:100
|
|
qw422016.N().S(` <b>Labels:</b>`)
|
|
//line app/vmalert/web.qtpl:100
|
|
}
|
|
//line app/vmalert/web.qtpl:100
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:101
|
|
for k, v := range r.Labels {
|
|
//line app/vmalert/web.qtpl:101
|
|
qw422016.N().S(`
|
|
<span class="ms-1 badge bg-primary">`)
|
|
//line app/vmalert/web.qtpl:102
|
|
qw422016.E().S(k)
|
|
//line app/vmalert/web.qtpl:102
|
|
qw422016.N().S(`=`)
|
|
//line app/vmalert/web.qtpl:102
|
|
qw422016.E().S(v)
|
|
//line app/vmalert/web.qtpl:102
|
|
qw422016.N().S(`</span>
|
|
`)
|
|
//line app/vmalert/web.qtpl:103
|
|
}
|
|
//line app/vmalert/web.qtpl:103
|
|
qw422016.N().S(`
|
|
</div>
|
|
`)
|
|
//line app/vmalert/web.qtpl:105
|
|
if r.LastError != "" {
|
|
//line app/vmalert/web.qtpl:105
|
|
qw422016.N().S(`
|
|
<div class="col-12">
|
|
<b>Error:</b>
|
|
<div class="error-cell">
|
|
`)
|
|
//line app/vmalert/web.qtpl:109
|
|
qw422016.E().S(r.LastError)
|
|
//line app/vmalert/web.qtpl:109
|
|
qw422016.N().S(`
|
|
</div>
|
|
</div>
|
|
`)
|
|
//line app/vmalert/web.qtpl:112
|
|
}
|
|
//line app/vmalert/web.qtpl:112
|
|
qw422016.N().S(`
|
|
</div>
|
|
</td>
|
|
<td class="text-center">`)
|
|
//line app/vmalert/web.qtpl:115
|
|
qw422016.N().D(r.LastSamples)
|
|
//line app/vmalert/web.qtpl:115
|
|
qw422016.N().S(`</td>
|
|
<td class="text-center">`)
|
|
//line app/vmalert/web.qtpl:116
|
|
qw422016.N().FPrec(time.Since(r.LastEvaluation).Seconds(), 3)
|
|
//line app/vmalert/web.qtpl:116
|
|
qw422016.N().S(`s ago</td>
|
|
</tr>
|
|
`)
|
|
//line app/vmalert/web.qtpl:118
|
|
}
|
|
//line app/vmalert/web.qtpl:118
|
|
qw422016.N().S(`
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
`)
|
|
//line app/vmalert/web.qtpl:122
|
|
}
|
|
//line app/vmalert/web.qtpl:122
|
|
qw422016.N().S(`
|
|
|
|
`)
|
|
//line app/vmalert/web.qtpl:124
|
|
} else {
|
|
//line app/vmalert/web.qtpl:124
|
|
qw422016.N().S(`
|
|
<div>
|
|
<p>No groups...</p>
|
|
</div>
|
|
`)
|
|
//line app/vmalert/web.qtpl:128
|
|
}
|
|
//line app/vmalert/web.qtpl:128
|
|
qw422016.N().S(`
|
|
|
|
`)
|
|
//line app/vmalert/web.qtpl:130
|
|
tpl.StreamFooter(qw422016, r)
|
|
//line app/vmalert/web.qtpl:130
|
|
qw422016.N().S(`
|
|
|
|
`)
|
|
//line app/vmalert/web.qtpl:132
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:132
|
|
func WriteListGroups(qq422016 qtio422016.Writer, r *http.Request, groups []APIGroup) {
|
|
//line app/vmalert/web.qtpl:132
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line app/vmalert/web.qtpl:132
|
|
StreamListGroups(qw422016, r, groups)
|
|
//line app/vmalert/web.qtpl:132
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line app/vmalert/web.qtpl:132
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:132
|
|
func ListGroups(r *http.Request, groups []APIGroup) string {
|
|
//line app/vmalert/web.qtpl:132
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line app/vmalert/web.qtpl:132
|
|
WriteListGroups(qb422016, r, groups)
|
|
//line app/vmalert/web.qtpl:132
|
|
qs422016 := string(qb422016.B)
|
|
//line app/vmalert/web.qtpl:132
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line app/vmalert/web.qtpl:132
|
|
return qs422016
|
|
//line app/vmalert/web.qtpl:132
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:135
|
|
func StreamListAlerts(qw422016 *qt422016.Writer, r *http.Request, groupAlerts []GroupAlerts) {
|
|
//line app/vmalert/web.qtpl:135
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:136
|
|
prefix := utils.Prefix(r.URL.Path)
|
|
|
|
//line app/vmalert/web.qtpl:136
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:137
|
|
tpl.StreamHeader(qw422016, r, navItems, "Alerts")
|
|
//line app/vmalert/web.qtpl:137
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:138
|
|
if len(groupAlerts) > 0 {
|
|
//line app/vmalert/web.qtpl:138
|
|
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:141
|
|
for _, ga := range groupAlerts {
|
|
//line app/vmalert/web.qtpl:141
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:142
|
|
g := ga.Group
|
|
|
|
//line app/vmalert/web.qtpl:142
|
|
qw422016.N().S(`
|
|
<div class="group-heading alert-danger" data-bs-target="rules-`)
|
|
//line app/vmalert/web.qtpl:143
|
|
qw422016.E().S(g.ID)
|
|
//line app/vmalert/web.qtpl:143
|
|
qw422016.N().S(`">
|
|
<span class="anchor" id="group-`)
|
|
//line app/vmalert/web.qtpl:144
|
|
qw422016.E().S(g.ID)
|
|
//line app/vmalert/web.qtpl:144
|
|
qw422016.N().S(`"></span>
|
|
<a href="#group-`)
|
|
//line app/vmalert/web.qtpl:145
|
|
qw422016.E().S(g.ID)
|
|
//line app/vmalert/web.qtpl:145
|
|
qw422016.N().S(`">`)
|
|
//line app/vmalert/web.qtpl:145
|
|
qw422016.E().S(g.Name)
|
|
//line app/vmalert/web.qtpl:145
|
|
if g.Type != "prometheus" {
|
|
//line app/vmalert/web.qtpl:145
|
|
qw422016.N().S(` (`)
|
|
//line app/vmalert/web.qtpl:145
|
|
qw422016.E().S(g.Type)
|
|
//line app/vmalert/web.qtpl:145
|
|
qw422016.N().S(`)`)
|
|
//line app/vmalert/web.qtpl:145
|
|
}
|
|
//line app/vmalert/web.qtpl:145
|
|
qw422016.N().S(`</a>
|
|
<span class="badge bg-danger" title="Number of active alerts">`)
|
|
//line app/vmalert/web.qtpl:146
|
|
qw422016.N().D(len(ga.Alerts))
|
|
//line app/vmalert/web.qtpl:146
|
|
qw422016.N().S(`</span>
|
|
<br>
|
|
<p class="fs-6 fw-lighter">`)
|
|
//line app/vmalert/web.qtpl:148
|
|
qw422016.E().S(g.File)
|
|
//line app/vmalert/web.qtpl:148
|
|
qw422016.N().S(`</p>
|
|
</div>
|
|
`)
|
|
//line app/vmalert/web.qtpl:151
|
|
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:160
|
|
qw422016.N().S(`
|
|
<div class="collapse" id="rules-`)
|
|
//line app/vmalert/web.qtpl:161
|
|
qw422016.E().S(g.ID)
|
|
//line app/vmalert/web.qtpl:161
|
|
qw422016.N().S(`">
|
|
`)
|
|
//line app/vmalert/web.qtpl:162
|
|
for _, ruleID := range keys {
|
|
//line app/vmalert/web.qtpl:162
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:164
|
|
defaultAR := alertsByRule[ruleID][0]
|
|
var labelKeys []string
|
|
for k := range defaultAR.Labels {
|
|
labelKeys = append(labelKeys, k)
|
|
}
|
|
sort.Strings(labelKeys)
|
|
|
|
//line app/vmalert/web.qtpl:170
|
|
qw422016.N().S(`
|
|
<br>
|
|
<b>alert:</b> `)
|
|
//line app/vmalert/web.qtpl:172
|
|
qw422016.E().S(defaultAR.Name)
|
|
//line app/vmalert/web.qtpl:172
|
|
qw422016.N().S(` (`)
|
|
//line app/vmalert/web.qtpl:172
|
|
qw422016.N().D(len(alertsByRule[ruleID]))
|
|
//line app/vmalert/web.qtpl:172
|
|
qw422016.N().S(`)
|
|
| <span><a target="_blank" href="`)
|
|
//line app/vmalert/web.qtpl:173
|
|
qw422016.E().S(defaultAR.SourceLink)
|
|
//line app/vmalert/web.qtpl:173
|
|
qw422016.N().S(`">Source</a></span>
|
|
<br>
|
|
<b>expr:</b><code><pre>`)
|
|
//line app/vmalert/web.qtpl:175
|
|
qw422016.E().S(defaultAR.Expression)
|
|
//line app/vmalert/web.qtpl:175
|
|
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:187
|
|
for _, ar := range alertsByRule[ruleID] {
|
|
//line app/vmalert/web.qtpl:187
|
|
qw422016.N().S(`
|
|
<tr>
|
|
<td>
|
|
`)
|
|
//line app/vmalert/web.qtpl:190
|
|
for _, k := range labelKeys {
|
|
//line app/vmalert/web.qtpl:190
|
|
qw422016.N().S(`
|
|
<span class="ms-1 badge bg-primary">`)
|
|
//line app/vmalert/web.qtpl:191
|
|
qw422016.E().S(k)
|
|
//line app/vmalert/web.qtpl:191
|
|
qw422016.N().S(`=`)
|
|
//line app/vmalert/web.qtpl:191
|
|
qw422016.E().S(ar.Labels[k])
|
|
//line app/vmalert/web.qtpl:191
|
|
qw422016.N().S(`</span>
|
|
`)
|
|
//line app/vmalert/web.qtpl:192
|
|
}
|
|
//line app/vmalert/web.qtpl:192
|
|
qw422016.N().S(`
|
|
</td>
|
|
<td>`)
|
|
//line app/vmalert/web.qtpl:194
|
|
streambadgeState(qw422016, ar.State)
|
|
//line app/vmalert/web.qtpl:194
|
|
qw422016.N().S(`</td>
|
|
<td>
|
|
`)
|
|
//line app/vmalert/web.qtpl:196
|
|
qw422016.E().S(ar.ActiveAt.Format("2006-01-02T15:04:05Z07:00"))
|
|
//line app/vmalert/web.qtpl:196
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:197
|
|
if ar.Restored {
|
|
//line app/vmalert/web.qtpl:197
|
|
streambadgeRestored(qw422016)
|
|
//line app/vmalert/web.qtpl:197
|
|
}
|
|
//line app/vmalert/web.qtpl:197
|
|
qw422016.N().S(`
|
|
</td>
|
|
<td>`)
|
|
//line app/vmalert/web.qtpl:199
|
|
qw422016.E().S(ar.Value)
|
|
//line app/vmalert/web.qtpl:199
|
|
qw422016.N().S(`</td>
|
|
<td>
|
|
<a href="`)
|
|
//line app/vmalert/web.qtpl:201
|
|
qw422016.E().S(prefix + ar.WebLink())
|
|
//line app/vmalert/web.qtpl:201
|
|
qw422016.N().S(`">Details</a>
|
|
</td>
|
|
</tr>
|
|
`)
|
|
//line app/vmalert/web.qtpl:204
|
|
}
|
|
//line app/vmalert/web.qtpl:204
|
|
qw422016.N().S(`
|
|
</tbody>
|
|
</table>
|
|
`)
|
|
//line app/vmalert/web.qtpl:207
|
|
}
|
|
//line app/vmalert/web.qtpl:207
|
|
qw422016.N().S(`
|
|
</div>
|
|
<br>
|
|
`)
|
|
//line app/vmalert/web.qtpl:210
|
|
}
|
|
//line app/vmalert/web.qtpl:210
|
|
qw422016.N().S(`
|
|
|
|
`)
|
|
//line app/vmalert/web.qtpl:212
|
|
} else {
|
|
//line app/vmalert/web.qtpl:212
|
|
qw422016.N().S(`
|
|
<div>
|
|
<p>No active alerts...</p>
|
|
</div>
|
|
`)
|
|
//line app/vmalert/web.qtpl:216
|
|
}
|
|
//line app/vmalert/web.qtpl:216
|
|
qw422016.N().S(`
|
|
|
|
`)
|
|
//line app/vmalert/web.qtpl:218
|
|
tpl.StreamFooter(qw422016, r)
|
|
//line app/vmalert/web.qtpl:218
|
|
qw422016.N().S(`
|
|
|
|
`)
|
|
//line app/vmalert/web.qtpl:220
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:220
|
|
func WriteListAlerts(qq422016 qtio422016.Writer, r *http.Request, groupAlerts []GroupAlerts) {
|
|
//line app/vmalert/web.qtpl:220
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line app/vmalert/web.qtpl:220
|
|
StreamListAlerts(qw422016, r, groupAlerts)
|
|
//line app/vmalert/web.qtpl:220
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line app/vmalert/web.qtpl:220
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:220
|
|
func ListAlerts(r *http.Request, groupAlerts []GroupAlerts) string {
|
|
//line app/vmalert/web.qtpl:220
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line app/vmalert/web.qtpl:220
|
|
WriteListAlerts(qb422016, r, groupAlerts)
|
|
//line app/vmalert/web.qtpl:220
|
|
qs422016 := string(qb422016.B)
|
|
//line app/vmalert/web.qtpl:220
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line app/vmalert/web.qtpl:220
|
|
return qs422016
|
|
//line app/vmalert/web.qtpl:220
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:222
|
|
func StreamListTargets(qw422016 *qt422016.Writer, r *http.Request, targets map[notifier.TargetType][]notifier.Target) {
|
|
//line app/vmalert/web.qtpl:222
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:223
|
|
tpl.StreamHeader(qw422016, r, navItems, "Notifiers")
|
|
//line app/vmalert/web.qtpl:223
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:224
|
|
if len(targets) > 0 {
|
|
//line app/vmalert/web.qtpl:224
|
|
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:229
|
|
var keys []string
|
|
for key := range targets {
|
|
keys = append(keys, string(key))
|
|
}
|
|
sort.Strings(keys)
|
|
|
|
//line app/vmalert/web.qtpl:234
|
|
qw422016.N().S(`
|
|
|
|
`)
|
|
//line app/vmalert/web.qtpl:236
|
|
for i := range keys {
|
|
//line app/vmalert/web.qtpl:236
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:237
|
|
typeK, ns := keys[i], targets[notifier.TargetType(keys[i])]
|
|
count := len(ns)
|
|
|
|
//line app/vmalert/web.qtpl:239
|
|
qw422016.N().S(`
|
|
<div class="group-heading data-bs-target="rules-`)
|
|
//line app/vmalert/web.qtpl:240
|
|
qw422016.E().S(typeK)
|
|
//line app/vmalert/web.qtpl:240
|
|
qw422016.N().S(`">
|
|
<span class="anchor" id="notifiers-`)
|
|
//line app/vmalert/web.qtpl:241
|
|
qw422016.E().S(typeK)
|
|
//line app/vmalert/web.qtpl:241
|
|
qw422016.N().S(`"></span>
|
|
<a href="#notifiers-`)
|
|
//line app/vmalert/web.qtpl:242
|
|
qw422016.E().S(typeK)
|
|
//line app/vmalert/web.qtpl:242
|
|
qw422016.N().S(`">`)
|
|
//line app/vmalert/web.qtpl:242
|
|
qw422016.E().S(typeK)
|
|
//line app/vmalert/web.qtpl:242
|
|
qw422016.N().S(` (`)
|
|
//line app/vmalert/web.qtpl:242
|
|
qw422016.N().D(count)
|
|
//line app/vmalert/web.qtpl:242
|
|
qw422016.N().S(`)</a>
|
|
</div>
|
|
<div class="collapse show" id="notifiers-`)
|
|
//line app/vmalert/web.qtpl:244
|
|
qw422016.E().S(typeK)
|
|
//line app/vmalert/web.qtpl:244
|
|
qw422016.N().S(`">
|
|
<table class="table table-striped table-hover table-sm">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">Labels</th>
|
|
<th scope="col">Address</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
`)
|
|
//line app/vmalert/web.qtpl:253
|
|
for _, n := range ns {
|
|
//line app/vmalert/web.qtpl:253
|
|
qw422016.N().S(`
|
|
<tr>
|
|
<td>
|
|
`)
|
|
//line app/vmalert/web.qtpl:256
|
|
for _, l := range n.Labels.GetLabels() {
|
|
//line app/vmalert/web.qtpl:256
|
|
qw422016.N().S(`
|
|
<span class="ms-1 badge bg-primary">`)
|
|
//line app/vmalert/web.qtpl:257
|
|
qw422016.E().S(l.Name)
|
|
//line app/vmalert/web.qtpl:257
|
|
qw422016.N().S(`=`)
|
|
//line app/vmalert/web.qtpl:257
|
|
qw422016.E().S(l.Value)
|
|
//line app/vmalert/web.qtpl:257
|
|
qw422016.N().S(`</span>
|
|
`)
|
|
//line app/vmalert/web.qtpl:258
|
|
}
|
|
//line app/vmalert/web.qtpl:258
|
|
qw422016.N().S(`
|
|
</td>
|
|
<td>`)
|
|
//line app/vmalert/web.qtpl:260
|
|
qw422016.E().S(n.Notifier.Addr())
|
|
//line app/vmalert/web.qtpl:260
|
|
qw422016.N().S(`</td>
|
|
</tr>
|
|
`)
|
|
//line app/vmalert/web.qtpl:262
|
|
}
|
|
//line app/vmalert/web.qtpl:262
|
|
qw422016.N().S(`
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
`)
|
|
//line app/vmalert/web.qtpl:266
|
|
}
|
|
//line app/vmalert/web.qtpl:266
|
|
qw422016.N().S(`
|
|
|
|
`)
|
|
//line app/vmalert/web.qtpl:268
|
|
} else {
|
|
//line app/vmalert/web.qtpl:268
|
|
qw422016.N().S(`
|
|
<div>
|
|
<p>No targets...</p>
|
|
</div>
|
|
`)
|
|
//line app/vmalert/web.qtpl:272
|
|
}
|
|
//line app/vmalert/web.qtpl:272
|
|
qw422016.N().S(`
|
|
|
|
`)
|
|
//line app/vmalert/web.qtpl:274
|
|
tpl.StreamFooter(qw422016, r)
|
|
//line app/vmalert/web.qtpl:274
|
|
qw422016.N().S(`
|
|
|
|
`)
|
|
//line app/vmalert/web.qtpl:276
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:276
|
|
func WriteListTargets(qq422016 qtio422016.Writer, r *http.Request, targets map[notifier.TargetType][]notifier.Target) {
|
|
//line app/vmalert/web.qtpl:276
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line app/vmalert/web.qtpl:276
|
|
StreamListTargets(qw422016, r, targets)
|
|
//line app/vmalert/web.qtpl:276
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line app/vmalert/web.qtpl:276
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:276
|
|
func ListTargets(r *http.Request, targets map[notifier.TargetType][]notifier.Target) string {
|
|
//line app/vmalert/web.qtpl:276
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line app/vmalert/web.qtpl:276
|
|
WriteListTargets(qb422016, r, targets)
|
|
//line app/vmalert/web.qtpl:276
|
|
qs422016 := string(qb422016.B)
|
|
//line app/vmalert/web.qtpl:276
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line app/vmalert/web.qtpl:276
|
|
return qs422016
|
|
//line app/vmalert/web.qtpl:276
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:278
|
|
func StreamAlert(qw422016 *qt422016.Writer, r *http.Request, alert *APIAlert) {
|
|
//line app/vmalert/web.qtpl:278
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:279
|
|
prefix := utils.Prefix(r.URL.Path)
|
|
|
|
//line app/vmalert/web.qtpl:279
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:280
|
|
tpl.StreamHeader(qw422016, r, navItems, "")
|
|
//line app/vmalert/web.qtpl:280
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:282
|
|
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:293
|
|
qw422016.N().S(`
|
|
<div class="display-6 pb-3 mb-3">Alert: `)
|
|
//line app/vmalert/web.qtpl:294
|
|
qw422016.E().S(alert.Name)
|
|
//line app/vmalert/web.qtpl:294
|
|
qw422016.N().S(`<span class="ms-2 badge `)
|
|
//line app/vmalert/web.qtpl:294
|
|
if alert.State == "firing" {
|
|
//line app/vmalert/web.qtpl:294
|
|
qw422016.N().S(`bg-danger`)
|
|
//line app/vmalert/web.qtpl:294
|
|
} else {
|
|
//line app/vmalert/web.qtpl:294
|
|
qw422016.N().S(` bg-warning text-dark`)
|
|
//line app/vmalert/web.qtpl:294
|
|
}
|
|
//line app/vmalert/web.qtpl:294
|
|
qw422016.N().S(`">`)
|
|
//line app/vmalert/web.qtpl:294
|
|
qw422016.E().S(alert.State)
|
|
//line app/vmalert/web.qtpl:294
|
|
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:301
|
|
qw422016.E().S(alert.ActiveAt.Format("2006-01-02T15:04:05Z07:00"))
|
|
//line app/vmalert/web.qtpl:301
|
|
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:311
|
|
qw422016.E().S(alert.Expression)
|
|
//line app/vmalert/web.qtpl:311
|
|
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:321
|
|
for _, k := range labelKeys {
|
|
//line app/vmalert/web.qtpl:321
|
|
qw422016.N().S(`
|
|
<span class="m-1 badge bg-primary">`)
|
|
//line app/vmalert/web.qtpl:322
|
|
qw422016.E().S(k)
|
|
//line app/vmalert/web.qtpl:322
|
|
qw422016.N().S(`=`)
|
|
//line app/vmalert/web.qtpl:322
|
|
qw422016.E().S(alert.Labels[k])
|
|
//line app/vmalert/web.qtpl:322
|
|
qw422016.N().S(`</span>
|
|
`)
|
|
//line app/vmalert/web.qtpl:323
|
|
}
|
|
//line app/vmalert/web.qtpl:323
|
|
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:333
|
|
for _, k := range annotationKeys {
|
|
//line app/vmalert/web.qtpl:333
|
|
qw422016.N().S(`
|
|
<b>`)
|
|
//line app/vmalert/web.qtpl:334
|
|
qw422016.E().S(k)
|
|
//line app/vmalert/web.qtpl:334
|
|
qw422016.N().S(`:</b><br>
|
|
<p>`)
|
|
//line app/vmalert/web.qtpl:335
|
|
qw422016.E().S(alert.Annotations[k])
|
|
//line app/vmalert/web.qtpl:335
|
|
qw422016.N().S(`</p>
|
|
`)
|
|
//line app/vmalert/web.qtpl:336
|
|
}
|
|
//line app/vmalert/web.qtpl:336
|
|
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="`)
|
|
//line app/vmalert/web.qtpl:346
|
|
qw422016.E().S(prefix)
|
|
//line app/vmalert/web.qtpl:346
|
|
qw422016.N().S(`groups#group-`)
|
|
//line app/vmalert/web.qtpl:346
|
|
qw422016.E().S(alert.GroupID)
|
|
//line app/vmalert/web.qtpl:346
|
|
qw422016.N().S(`">`)
|
|
//line app/vmalert/web.qtpl:346
|
|
qw422016.E().S(alert.GroupID)
|
|
//line app/vmalert/web.qtpl:346
|
|
qw422016.N().S(`</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="container border-bottom p-2">
|
|
<div class="row">
|
|
<div class="col-2">
|
|
Source link
|
|
</div>
|
|
<div class="col">
|
|
<a target="_blank" href="`)
|
|
//line app/vmalert/web.qtpl:356
|
|
qw422016.E().S(alert.SourceLink)
|
|
//line app/vmalert/web.qtpl:356
|
|
qw422016.N().S(`">Link</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`)
|
|
//line app/vmalert/web.qtpl:360
|
|
tpl.StreamFooter(qw422016, r)
|
|
//line app/vmalert/web.qtpl:360
|
|
qw422016.N().S(`
|
|
|
|
`)
|
|
//line app/vmalert/web.qtpl:362
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:362
|
|
func WriteAlert(qq422016 qtio422016.Writer, r *http.Request, alert *APIAlert) {
|
|
//line app/vmalert/web.qtpl:362
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line app/vmalert/web.qtpl:362
|
|
StreamAlert(qw422016, r, alert)
|
|
//line app/vmalert/web.qtpl:362
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line app/vmalert/web.qtpl:362
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:362
|
|
func Alert(r *http.Request, alert *APIAlert) string {
|
|
//line app/vmalert/web.qtpl:362
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line app/vmalert/web.qtpl:362
|
|
WriteAlert(qb422016, r, alert)
|
|
//line app/vmalert/web.qtpl:362
|
|
qs422016 := string(qb422016.B)
|
|
//line app/vmalert/web.qtpl:362
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line app/vmalert/web.qtpl:362
|
|
return qs422016
|
|
//line app/vmalert/web.qtpl:362
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:365
|
|
func StreamRuleDetails(qw422016 *qt422016.Writer, r *http.Request, rule APIRule) {
|
|
//line app/vmalert/web.qtpl:365
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:366
|
|
prefix := utils.Prefix(r.URL.Path)
|
|
|
|
//line app/vmalert/web.qtpl:366
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:367
|
|
tpl.StreamHeader(qw422016, r, navItems, "")
|
|
//line app/vmalert/web.qtpl:367
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:369
|
|
var labelKeys []string
|
|
for k := range rule.Labels {
|
|
labelKeys = append(labelKeys, k)
|
|
}
|
|
sort.Strings(labelKeys)
|
|
|
|
var annotationKeys []string
|
|
for k := range rule.Annotations {
|
|
annotationKeys = append(annotationKeys, k)
|
|
}
|
|
sort.Strings(annotationKeys)
|
|
|
|
//line app/vmalert/web.qtpl:380
|
|
qw422016.N().S(`
|
|
<div class="display-6 pb-3 mb-3">Rule: `)
|
|
//line app/vmalert/web.qtpl:381
|
|
qw422016.E().S(rule.Name)
|
|
//line app/vmalert/web.qtpl:381
|
|
qw422016.N().S(`<span class="ms-2 badge `)
|
|
//line app/vmalert/web.qtpl:381
|
|
if rule.Health != "ok" {
|
|
//line app/vmalert/web.qtpl:381
|
|
qw422016.N().S(`bg-danger`)
|
|
//line app/vmalert/web.qtpl:381
|
|
} else {
|
|
//line app/vmalert/web.qtpl:381
|
|
qw422016.N().S(` bg-warning text-dark`)
|
|
//line app/vmalert/web.qtpl:381
|
|
}
|
|
//line app/vmalert/web.qtpl:381
|
|
qw422016.N().S(`">`)
|
|
//line app/vmalert/web.qtpl:381
|
|
qw422016.E().S(rule.Health)
|
|
//line app/vmalert/web.qtpl:381
|
|
qw422016.N().S(`</span></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:388
|
|
qw422016.E().S(rule.Query)
|
|
//line app/vmalert/web.qtpl:388
|
|
qw422016.N().S(`</pre></code>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`)
|
|
//line app/vmalert/web.qtpl:392
|
|
if rule.Type == "alerting" {
|
|
//line app/vmalert/web.qtpl:392
|
|
qw422016.N().S(`
|
|
<div class="container border-bottom p-2">
|
|
<div class="row">
|
|
<div class="col-2">
|
|
For
|
|
</div>
|
|
<div class="col">
|
|
`)
|
|
//line app/vmalert/web.qtpl:399
|
|
qw422016.E().V(rule.Duration)
|
|
//line app/vmalert/web.qtpl:399
|
|
qw422016.N().S(` seconds
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`)
|
|
//line app/vmalert/web.qtpl:403
|
|
}
|
|
//line app/vmalert/web.qtpl:403
|
|
qw422016.N().S(`
|
|
<div class="container border-bottom p-2">
|
|
<div class="row">
|
|
<div class="col-2">
|
|
Labels
|
|
</div>
|
|
<div class="col">
|
|
`)
|
|
//line app/vmalert/web.qtpl:410
|
|
for _, k := range labelKeys {
|
|
//line app/vmalert/web.qtpl:410
|
|
qw422016.N().S(`
|
|
<span class="m-1 badge bg-primary">`)
|
|
//line app/vmalert/web.qtpl:411
|
|
qw422016.E().S(k)
|
|
//line app/vmalert/web.qtpl:411
|
|
qw422016.N().S(`=`)
|
|
//line app/vmalert/web.qtpl:411
|
|
qw422016.E().S(rule.Labels[k])
|
|
//line app/vmalert/web.qtpl:411
|
|
qw422016.N().S(`</span>
|
|
`)
|
|
//line app/vmalert/web.qtpl:412
|
|
}
|
|
//line app/vmalert/web.qtpl:412
|
|
qw422016.N().S(`
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`)
|
|
//line app/vmalert/web.qtpl:416
|
|
if rule.Type == "alerting" {
|
|
//line app/vmalert/web.qtpl:416
|
|
qw422016.N().S(`
|
|
<div class="container border-bottom p-2">
|
|
<div class="row">
|
|
<div class="col-2">
|
|
Annotations
|
|
</div>
|
|
<div class="col">
|
|
`)
|
|
//line app/vmalert/web.qtpl:423
|
|
for _, k := range annotationKeys {
|
|
//line app/vmalert/web.qtpl:423
|
|
qw422016.N().S(`
|
|
<b>`)
|
|
//line app/vmalert/web.qtpl:424
|
|
qw422016.E().S(k)
|
|
//line app/vmalert/web.qtpl:424
|
|
qw422016.N().S(`:</b><br>
|
|
<p>`)
|
|
//line app/vmalert/web.qtpl:425
|
|
qw422016.E().S(rule.Annotations[k])
|
|
//line app/vmalert/web.qtpl:425
|
|
qw422016.N().S(`</p>
|
|
`)
|
|
//line app/vmalert/web.qtpl:426
|
|
}
|
|
//line app/vmalert/web.qtpl:426
|
|
qw422016.N().S(`
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="container border-bottom p-2">
|
|
<div class="row">
|
|
<div class="col-2">
|
|
Debug
|
|
</div>
|
|
<div class="col">
|
|
`)
|
|
//line app/vmalert/web.qtpl:436
|
|
qw422016.E().V(rule.Debug)
|
|
//line app/vmalert/web.qtpl:436
|
|
qw422016.N().S(`
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`)
|
|
//line app/vmalert/web.qtpl:440
|
|
}
|
|
//line app/vmalert/web.qtpl:440
|
|
qw422016.N().S(`
|
|
<div class="container border-bottom p-2">
|
|
<div class="row">
|
|
<div class="col-2">
|
|
Group
|
|
</div>
|
|
<div class="col">
|
|
<a target="_blank" href="`)
|
|
//line app/vmalert/web.qtpl:447
|
|
qw422016.E().S(prefix)
|
|
//line app/vmalert/web.qtpl:447
|
|
qw422016.N().S(`groups#group-`)
|
|
//line app/vmalert/web.qtpl:447
|
|
qw422016.E().S(rule.GroupID)
|
|
//line app/vmalert/web.qtpl:447
|
|
qw422016.N().S(`">`)
|
|
//line app/vmalert/web.qtpl:447
|
|
qw422016.E().S(rule.GroupID)
|
|
//line app/vmalert/web.qtpl:447
|
|
qw422016.N().S(`</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<br>
|
|
<div class="display-6 pb-3">Last `)
|
|
//line app/vmalert/web.qtpl:453
|
|
qw422016.N().D(len(rule.Updates))
|
|
//line app/vmalert/web.qtpl:453
|
|
qw422016.N().S(`/`)
|
|
//line app/vmalert/web.qtpl:453
|
|
qw422016.N().D(rule.MaxUpdates)
|
|
//line app/vmalert/web.qtpl:453
|
|
qw422016.N().S(` updates</span>:</div>
|
|
<table class="table table-striped table-hover table-sm">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col" title="The time when event was created">Updated at</th>
|
|
<th scope="col" style="width: 10%" class="text-center" title="How many samples were returned">Samples</th>
|
|
<th scope="col" style="width: 10%" class="text-center" title="How many seconds request took">Duration</th>
|
|
<th scope="col" class="text-center" title="Time used for rule execution">Executed at</th>
|
|
<th scope="col" class="text-center" title="cURL command with request example">cURL</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
`)
|
|
//line app/vmalert/web.qtpl:466
|
|
for _, u := range rule.Updates {
|
|
//line app/vmalert/web.qtpl:466
|
|
qw422016.N().S(`
|
|
<tr`)
|
|
//line app/vmalert/web.qtpl:467
|
|
if u.err != nil {
|
|
//line app/vmalert/web.qtpl:467
|
|
qw422016.N().S(` class="alert-danger"`)
|
|
//line app/vmalert/web.qtpl:467
|
|
}
|
|
//line app/vmalert/web.qtpl:467
|
|
qw422016.N().S(`>
|
|
<td>
|
|
<span class="badge bg-primary rounded-pill me-3" title="Updated at">`)
|
|
//line app/vmalert/web.qtpl:469
|
|
qw422016.E().S(u.time.Format(time.RFC3339))
|
|
//line app/vmalert/web.qtpl:469
|
|
qw422016.N().S(`</span>
|
|
</td>
|
|
<td class="text-center" wi>`)
|
|
//line app/vmalert/web.qtpl:471
|
|
qw422016.N().D(u.samples)
|
|
//line app/vmalert/web.qtpl:471
|
|
qw422016.N().S(`</td>
|
|
<td class="text-center">`)
|
|
//line app/vmalert/web.qtpl:472
|
|
qw422016.N().FPrec(u.duration.Seconds(), 3)
|
|
//line app/vmalert/web.qtpl:472
|
|
qw422016.N().S(`s</td>
|
|
<td class="text-center">`)
|
|
//line app/vmalert/web.qtpl:473
|
|
qw422016.E().S(u.at.Format(time.RFC3339))
|
|
//line app/vmalert/web.qtpl:473
|
|
qw422016.N().S(`</td>
|
|
<td>
|
|
<textarea class="curl-area" rows="1" onclick="this.focus();this.select()">`)
|
|
//line app/vmalert/web.qtpl:475
|
|
qw422016.E().S(u.curl)
|
|
//line app/vmalert/web.qtpl:475
|
|
qw422016.N().S(`</textarea>
|
|
</td>
|
|
</tr>
|
|
</li>
|
|
`)
|
|
//line app/vmalert/web.qtpl:479
|
|
if u.err != nil {
|
|
//line app/vmalert/web.qtpl:479
|
|
qw422016.N().S(`
|
|
<tr`)
|
|
//line app/vmalert/web.qtpl:480
|
|
if u.err != nil {
|
|
//line app/vmalert/web.qtpl:480
|
|
qw422016.N().S(` class="alert-danger"`)
|
|
//line app/vmalert/web.qtpl:480
|
|
}
|
|
//line app/vmalert/web.qtpl:480
|
|
qw422016.N().S(`>
|
|
<td colspan="5">
|
|
<span class="alert-danger">`)
|
|
//line app/vmalert/web.qtpl:482
|
|
qw422016.E().V(u.err)
|
|
//line app/vmalert/web.qtpl:482
|
|
qw422016.N().S(`</span>
|
|
</td>
|
|
</tr>
|
|
`)
|
|
//line app/vmalert/web.qtpl:485
|
|
}
|
|
//line app/vmalert/web.qtpl:485
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:486
|
|
}
|
|
//line app/vmalert/web.qtpl:486
|
|
qw422016.N().S(`
|
|
|
|
`)
|
|
//line app/vmalert/web.qtpl:488
|
|
tpl.StreamFooter(qw422016, r)
|
|
//line app/vmalert/web.qtpl:488
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:489
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:489
|
|
func WriteRuleDetails(qq422016 qtio422016.Writer, r *http.Request, rule APIRule) {
|
|
//line app/vmalert/web.qtpl:489
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line app/vmalert/web.qtpl:489
|
|
StreamRuleDetails(qw422016, r, rule)
|
|
//line app/vmalert/web.qtpl:489
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line app/vmalert/web.qtpl:489
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:489
|
|
func RuleDetails(r *http.Request, rule APIRule) string {
|
|
//line app/vmalert/web.qtpl:489
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line app/vmalert/web.qtpl:489
|
|
WriteRuleDetails(qb422016, r, rule)
|
|
//line app/vmalert/web.qtpl:489
|
|
qs422016 := string(qb422016.B)
|
|
//line app/vmalert/web.qtpl:489
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line app/vmalert/web.qtpl:489
|
|
return qs422016
|
|
//line app/vmalert/web.qtpl:489
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:493
|
|
func streambadgeState(qw422016 *qt422016.Writer, state string) {
|
|
//line app/vmalert/web.qtpl:493
|
|
qw422016.N().S(`
|
|
`)
|
|
//line app/vmalert/web.qtpl:495
|
|
badgeClass := "bg-warning text-dark"
|
|
if state == "firing" {
|
|
badgeClass = "bg-danger"
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:499
|
|
qw422016.N().S(`
|
|
<span class="badge `)
|
|
//line app/vmalert/web.qtpl:500
|
|
qw422016.E().S(badgeClass)
|
|
//line app/vmalert/web.qtpl:500
|
|
qw422016.N().S(`">`)
|
|
//line app/vmalert/web.qtpl:500
|
|
qw422016.E().S(state)
|
|
//line app/vmalert/web.qtpl:500
|
|
qw422016.N().S(`</span>
|
|
`)
|
|
//line app/vmalert/web.qtpl:501
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:501
|
|
func writebadgeState(qq422016 qtio422016.Writer, state string) {
|
|
//line app/vmalert/web.qtpl:501
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line app/vmalert/web.qtpl:501
|
|
streambadgeState(qw422016, state)
|
|
//line app/vmalert/web.qtpl:501
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line app/vmalert/web.qtpl:501
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:501
|
|
func badgeState(state string) string {
|
|
//line app/vmalert/web.qtpl:501
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line app/vmalert/web.qtpl:501
|
|
writebadgeState(qb422016, state)
|
|
//line app/vmalert/web.qtpl:501
|
|
qs422016 := string(qb422016.B)
|
|
//line app/vmalert/web.qtpl:501
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line app/vmalert/web.qtpl:501
|
|
return qs422016
|
|
//line app/vmalert/web.qtpl:501
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:503
|
|
func streambadgeRestored(qw422016 *qt422016.Writer) {
|
|
//line app/vmalert/web.qtpl:503
|
|
qw422016.N().S(`
|
|
<span class="badge bg-warning text-dark" title="Alert state was restored after the service restart from remote storage">restored</span>
|
|
`)
|
|
//line app/vmalert/web.qtpl:505
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:505
|
|
func writebadgeRestored(qq422016 qtio422016.Writer) {
|
|
//line app/vmalert/web.qtpl:505
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line app/vmalert/web.qtpl:505
|
|
streambadgeRestored(qw422016)
|
|
//line app/vmalert/web.qtpl:505
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line app/vmalert/web.qtpl:505
|
|
}
|
|
|
|
//line app/vmalert/web.qtpl:505
|
|
func badgeRestored() string {
|
|
//line app/vmalert/web.qtpl:505
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line app/vmalert/web.qtpl:505
|
|
writebadgeRestored(qb422016)
|
|
//line app/vmalert/web.qtpl:505
|
|
qs422016 := string(qb422016.B)
|
|
//line app/vmalert/web.qtpl:505
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line app/vmalert/web.qtpl:505
|
|
return qs422016
|
|
//line app/vmalert/web.qtpl:505
|
|
}
|