b146f34d19
Maintenance windows suppress alerts during planned downtime while checks continue running. Incidents provide informational tracking. Supports targeting all monitors, single monitor, or group (applies to children). New Maint tab in TUI with create/end/delete. Status page, JSON API, and Prometheus metrics all reflect maintenance state.
88 lines
1.7 KiB
Go
88 lines
1.7 KiB
Go
package models
|
|
|
|
import "time"
|
|
|
|
type Site struct {
|
|
ID int
|
|
Name string
|
|
URL string
|
|
Type string // "http", "push", "ping", "port", "dns", "group"
|
|
Token string
|
|
Interval int
|
|
AlertID int
|
|
CheckSSL bool
|
|
ExpiryThreshold int
|
|
MaxRetries int
|
|
|
|
Hostname string
|
|
Port int
|
|
Timeout int
|
|
Method string
|
|
Description string
|
|
ParentID int
|
|
AcceptedCodes string
|
|
DNSResolveType string
|
|
DNSServer string
|
|
IgnoreTLS bool
|
|
Paused bool
|
|
Regions string
|
|
|
|
FailureCount int
|
|
Status string
|
|
StatusCode int
|
|
Latency time.Duration
|
|
CertExpiry time.Time
|
|
HasSSL bool
|
|
LastCheck time.Time
|
|
SentSSLWarning bool
|
|
}
|
|
|
|
type AlertConfig struct {
|
|
ID int
|
|
Name string
|
|
Type string
|
|
Settings map[string]string
|
|
}
|
|
|
|
type User struct {
|
|
ID int
|
|
Username string
|
|
PublicKey string
|
|
Role string
|
|
}
|
|
|
|
type CheckRecord struct {
|
|
SiteID int
|
|
NodeID string
|
|
LatencyNs int64
|
|
IsUp bool
|
|
CheckedAt time.Time
|
|
}
|
|
|
|
type ProbeNode struct {
|
|
ID string
|
|
Name string
|
|
Region string
|
|
LastSeen time.Time
|
|
Version string
|
|
}
|
|
|
|
type MaintenanceWindow struct {
|
|
ID int
|
|
MonitorID int
|
|
Title string
|
|
Description string
|
|
Type string // "maintenance" or "incident"
|
|
StartTime time.Time
|
|
EndTime time.Time // zero = ongoing
|
|
CreatedBy string
|
|
CreatedAt time.Time
|
|
}
|
|
|
|
type Backup struct {
|
|
Sites []Site `json:"sites"`
|
|
Alerts []AlertConfig `json:"alerts"`
|
|
Users []User `json:"users"`
|
|
MaintenanceWindows []MaintenanceWindow `json:"maintenance_windows,omitempty"`
|
|
}
|