2019-12-07 05:14:40 -05:00
|
|
|
package model
|
|
|
|
|
2020-11-06 07:56:46 -05:00
|
|
|
import (
|
2020-11-10 21:07:45 -05:00
|
|
|
pb "github.com/naiba/nezha/proto"
|
2020-11-06 07:56:46 -05:00
|
|
|
)
|
2019-12-07 05:14:40 -05:00
|
|
|
|
2019-12-09 03:02:49 -05:00
|
|
|
const (
|
|
|
|
_ = iota
|
2021-01-18 20:59:04 -05:00
|
|
|
TaskTypeHTTPGET
|
|
|
|
TaskTypeICMPPing
|
|
|
|
TaskTypeTCPPing
|
|
|
|
TaskTypeCommand
|
2019-12-09 03:02:49 -05:00
|
|
|
)
|
|
|
|
|
2021-01-15 11:45:49 -05:00
|
|
|
type Monitor struct {
|
|
|
|
Common
|
|
|
|
Name string
|
|
|
|
Type uint8
|
|
|
|
Target string
|
2021-04-17 11:36:37 -04:00
|
|
|
Notify bool
|
2019-12-07 05:14:40 -05:00
|
|
|
}
|
|
|
|
|
2021-01-15 11:45:49 -05:00
|
|
|
func (m *Monitor) PB() *pb.Task {
|
|
|
|
return &pb.Task{
|
|
|
|
Id: m.ID,
|
|
|
|
Type: uint64(m.Type),
|
|
|
|
Data: m.Target,
|
2019-12-09 05:14:31 -05:00
|
|
|
}
|
|
|
|
}
|