gmon/analyse/analyse.go

37 lines
819 B
Go
Raw Permalink Normal View History

2020-11-10 11:28:59 +01:00
package analyse
import (
"github.com/hamburghammer/gmon/stats"
)
// AlertStatus represents the result of an analyses.
2020-11-10 11:28:59 +01:00
type AlertStatus int
const (
// StatusOK if the result is ok.
2020-11-10 11:28:59 +01:00
StatusOK = AlertStatus(iota)
// StatusWarning if the result should produce a warning.
2020-11-10 11:28:59 +01:00
StatusWarning
// StatusAlert if the result should produce an alert.
2020-11-10 11:28:59 +01:00
StatusAlert
)
// Status representation of the result of an analysis with a status message and a status.
2020-11-10 11:28:59 +01:00
type Status struct {
StatusMessage string
AlertStatus
}
// Result holds all information of an analysis.
2020-11-10 11:28:59 +01:00
type Result struct {
Title string
Description string
Status
}
// Analyser is an interface that should be implemented by actors that analyse data based on some rules.
2020-11-10 11:28:59 +01:00
type Analyser interface {
Analyse(stats.Data) (Result, error)
2020-11-14 18:39:46 +01:00
IsDeactivated() bool
2020-11-10 11:28:59 +01:00
}