Files
nmon/internal/api/warnings.go

23 lines
565 B
Go

package api
import "github.com/v10networks/nmon/internal/store"
// warningsOf is the device's stored warnings (discovery and poller findings) plus the live ones the
// reachability evaluator adds, such as icmp_unsupported. The result is never nil.
func (s *server) warningsOf(d *store.Device) []string {
out := append([]string{}, d.Warnings...)
if s.DeviceWarnings == nil {
return out
}
for _, w := range s.DeviceWarnings(d.Slug) {
dup := false
for _, x := range out {
dup = dup || x == w
}
if !dup {
out = append(out, w)
}
}
return out
}