alrm/check/check.go

20 lines
327 B
Go
Raw Normal View History

package check
2020-08-20 08:44:56 -08:00
import (
"fmt"
)
type AlrmCheck interface {
Parse(string) (bool, error)
Check() error
}
2020-08-20 08:44:56 -08:00
func NewCheck(name string, addr string) (AlrmCheck, error) {
switch name {
case "ping":
return &CheckPing{Type: "ping", Address: addr}, nil
2020-08-20 08:44:56 -08:00
default:
return nil, fmt.Errorf("unknown check name \"%s\"", name)
}
}