{{ define "test.html" }}html
{{- if gt (len .Alerts.Firing) 0 -}}ide
@告警code
<table border="5">htm
<tr><td>報警項</td> <td>實例</td> <td>報警詳情</td> <td>報警閥值</td> <td>開始時間</td> </tr> {{ range $i, $alert := .Alerts }} <tr><td>{{ index $alert.Labels "alertname" }}</td> <td>{{ index $alert.Labels "instance" }}</td> <td>{{ index $alert.Annotations "description" }}</td> <td>{{ index $alert.Annotations "value" }}</td> <td>{{ $alert.StartsAt }}</td> </tr> {{ end }}
</table>ip
{{ end }}it
{{- if gt (len .Alerts.Resolved) 0 -}}io
@恢復table
<table border="5">class
<tr><td>報警項</td> <td>實例</td> <td>報警詳情</td> <td>報警閥值</td> <td>開始時間</td> </tr> {{ range $i, $alert := .Alerts }} <tr><td>{{ index $alert.Labels "alertname" }}</td> <td>{{ index $alert.Labels "instance" }}</td> <td>{{ index $alert.Annotations "description" }}</td> <td>{{ index $alert.Annotations "value" }}</td> <td>{{ $alert.StartsAt }}</td> </tr> {{ end }}
</table>test
{{ end }}{{- end }}