Compare commits
No commits in common. "b33c8497a217f7d939f75817a077fb7d196064f6" and "a1e33e90f736d4935cf4c270aca9666d60e0bae8" have entirely different histories.
b33c8497a2
...
a1e33e90f7
3 changed files with 48 additions and 75 deletions
|
|
@ -256,32 +256,6 @@ func (p *srvProvider) GetHTMLReport(ctx sdk.ReportContext) (string, error) {
|
||||||
rd.Records = append(rd.Records, rec)
|
rd.Records = append(rd.Records, rec)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build alerts from rule states when available; fall back to raw-data
|
|
||||||
// analysis when the host hasn't threaded rule output through yet.
|
|
||||||
states := ctx.States()
|
|
||||||
if len(states) > 0 {
|
|
||||||
for _, st := range states {
|
|
||||||
sev := ""
|
|
||||||
switch st.Status {
|
|
||||||
case sdk.StatusCrit, sdk.StatusError:
|
|
||||||
sev = "crit"
|
|
||||||
case sdk.StatusWarn:
|
|
||||||
sev = "warn"
|
|
||||||
case sdk.StatusInfo:
|
|
||||||
sev = "info"
|
|
||||||
default:
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
alert := reportAlert{
|
|
||||||
Severity: sev,
|
|
||||||
Title: st.Message,
|
|
||||||
}
|
|
||||||
if fix, ok := st.Meta["fix"].(string); ok && fix != "" {
|
|
||||||
alert.Body = template.HTML(template.HTMLEscapeString(fix))
|
|
||||||
}
|
|
||||||
rd.Alerts = append(rd.Alerts, alert)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if len(resolveFails) > 0 {
|
if len(resolveFails) > 0 {
|
||||||
rd.Alerts = append(rd.Alerts, reportAlert{
|
rd.Alerts = append(rd.Alerts, reportAlert{
|
||||||
Severity: "crit",
|
Severity: "crit",
|
||||||
|
|
@ -329,7 +303,6 @@ func (p *srvProvider) GetHTMLReport(ctx sdk.ReportContext) (string, error) {
|
||||||
"If you expected clients to reach this service, replace the null target with a real hostname."),
|
"If you expected clients to reach this service, replace the null target with a real hostname."),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var buf strings.Builder
|
var buf strings.Builder
|
||||||
if err := htmlTpl.Execute(&buf, rd); err != nil {
|
if err := htmlTpl.Execute(&buf, rd); err != nil {
|
||||||
|
|
|
||||||
2
go.mod
2
go.mod
|
|
@ -4,7 +4,7 @@ go 1.25.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.happydns.org/checker-sdk-go v1.7.0
|
git.happydns.org/checker-sdk-go v1.7.0
|
||||||
git.happydns.org/checker-tls v0.7.0
|
git.happydns.org/checker-tls v0.6.2
|
||||||
git.happydns.org/happyDomain v0.7.0
|
git.happydns.org/happyDomain v0.7.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
4
go.sum
4
go.sum
|
|
@ -1,7 +1,7 @@
|
||||||
git.happydns.org/checker-sdk-go v1.7.0 h1:dSgo2js5mfXluLc6x0WWZ0MQULd9XV2GI9z0Usk+Qgw=
|
git.happydns.org/checker-sdk-go v1.7.0 h1:dSgo2js5mfXluLc6x0WWZ0MQULd9XV2GI9z0Usk+Qgw=
|
||||||
git.happydns.org/checker-sdk-go v1.7.0/go.mod h1:aNAcfYFfbhvH9kJhE0Njp5GX0dQbxdRB0rJ0KvSC5nI=
|
git.happydns.org/checker-sdk-go v1.7.0/go.mod h1:aNAcfYFfbhvH9kJhE0Njp5GX0dQbxdRB0rJ0KvSC5nI=
|
||||||
git.happydns.org/checker-tls v0.7.0 h1:mfNHYbHMGS40y+N2rudC2svT/xLK7KCiSa7V8/RhcTM=
|
git.happydns.org/checker-tls v0.6.2 h1:8oKia1XlD+tklyqrwzmUgFH1Kw8VLSLLF9suZ7Qr14E=
|
||||||
git.happydns.org/checker-tls v0.7.0/go.mod h1:wlY4UI3owvqMAtOcXLmskpTpZ7xPjuiV6M42+rFZDQo=
|
git.happydns.org/checker-tls v0.6.2/go.mod h1:9tpnxg0iOwS+7If64DRG1jqYonUAgxOBuxwfF5mVkL4=
|
||||||
git.happydns.org/happyDomain v0.7.0 h1:NV82/NbcSeRm0+IUZqaK3Vu9Ovl5+vv4AigUJZMdwws=
|
git.happydns.org/happyDomain v0.7.0 h1:NV82/NbcSeRm0+IUZqaK3Vu9Ovl5+vv4AigUJZMdwws=
|
||||||
git.happydns.org/happyDomain v0.7.0/go.mod h1:5tgkmqFE65kK359rY49V++49wgZ0gco+Gh9X6tbL+bY=
|
git.happydns.org/happyDomain v0.7.0/go.mod h1:5tgkmqFE65kK359rY49V++49wgZ0gco+Gh9X6tbL+bY=
|
||||||
github.com/bytedance/gopkg v0.1.4 h1:oZnQwnX82KAIWb7033bEwtxvTqXcYMxDBaQxo5JJHWM=
|
github.com/bytedance/gopkg v0.1.4 h1:oZnQwnX82KAIWb7033bEwtxvTqXcYMxDBaQxo5JJHWM=
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue