Documentation ¶
Index ¶
- Variables
- func Notify(heartbeatName string, status Status) func()
- func ProcessHeartbeatsSettings() error
- func ProcessServiceSettings() error
- func ReadConfigFile(configPath string, init bool) error
- func ResetTimerIfRunning(previousHeartbeats *[]Heartbeat)
- type Cache
- type Config
- type Defaults
- type Heartbeat
- type Heartbeats
- type Notifications
- type NotificationsMap
- type Server
- type Service
- type Status
Constants ¶
This section is empty.
Variables ¶
var StaticFS embed.FS
Functions ¶
func ProcessHeartbeatsSettings ¶ added in v0.4.8
func ProcessHeartbeatsSettings() error
ProcessHeartbeatsSettings checks if all heartbeats are valid and can be parsed
func ProcessServiceSettings ¶
func ProcessServiceSettings() error
ProcessNotificationSettings checks if all services are valid and can be parsed
func ReadConfigFile ¶
ReadConfigFile reads the notifications config file configPath is the path to the config file init is true if the config file is read on startup. this will skip the comparison of the previous config
func ResetTimerIfRunning ¶
func ResetTimerIfRunning(previousHeartbeats *[]Heartbeat)
ResetTimerIfRunning resets existing timers if they are running
Types ¶
type Defaults ¶
type Defaults struct { Subject string `mapstructure:"subject"` Message string `mapstructure:"message"` SendResolved *bool `mapstructure:"sendResolved"` }
Details details holds defaults for notifications
type Heartbeat ¶
type Heartbeat struct { Name string `mapstructure:"name"` UUID string `mapstructure:"uuid,omitempty"` Enabled *bool `mapstructure:"enabled"` Description string `mapstructure:"description"` Interval time.Duration `mapstructure:"interval"` Grace time.Duration `mapstructure:"grace"` LastPing time.Time `mapstructure:"lastPing"` Status string `mapstructure:"status"` Notifications []string `mapstructure:"notifications"` NotificationsMap []NotificationsMap `mapstructure:",-,omitempty"` IntervalTimer *timer.Timer `mapstructure:"intervalTimer,omitempty"` GraceTimer *timer.Timer `mapstructure:"graceTimer,omitempty"` }
Heartbeat is a struct for a heartbeat
func (*Heartbeat) GotPingFail ¶ added in v0.2.5
GotPingFail stops the timer for the heartbeat
type Heartbeats ¶ added in v0.3.0
type Heartbeats struct { Version string `mapstructure:"version"` Config Config `mapstructure:"config"` Server Server `mapstructure:"server"` Cache Cache `mapstructure:"cache"` Heartbeats []Heartbeat `mapstructure:"heartbeats"` Notifications Notifications `mapstructure:"notifications"` }
Heartbeats is the main configuration struct
var ConfigCopy Heartbeats
var HeartbeatsServer Heartbeats
func (*Heartbeats) GetHeartbeatByName ¶ added in v0.3.0
func (h *Heartbeats) GetHeartbeatByName(name string) (*Heartbeat, error)
GetHeartbeatByName search heartbeat in HeartbeatsConfig.Heartbeats by name and returns it
func (*Heartbeats) GetHeartbeatByUUID ¶ added in v0.4.8
func (h *Heartbeats) GetHeartbeatByUUID(uuid string) (*Heartbeat, error)
GetHeartbeatByUUID search heartbeat in HeartbeatsConfig.Heartbeats by uuid and returns it
func (*Heartbeats) GetServiceByName ¶ added in v0.3.0
func (h *Heartbeats) GetServiceByName(notificationType string) (*Service, error)
GetServiceByType returns notification settings by type
type Notifications ¶
type Notifications struct { Defaults Defaults `mapstructure:"defaults"` Services []Service `mapstructure:"services"` }
NotifyConfig holds the configuration for the notifications
type NotificationsMap ¶ added in v0.4.8
type Server ¶
type Server struct { Hostname string `mapstructure:"hostname"` Port int `mapstructure:"port"` SiteRoot string `mapstructure:"siteRoot"` }
Server is the holds HTTP server settings
type Service ¶ added in v0.4.8
type Service struct { Name string `mapstructure:"name"` Enabled *bool `mapstructure:"enabled,omitempty"` SendResolved *bool `mapstructure:"sendResolved,omitempty"` Message string `mapstructure:"message,omitempty"` Shoutrrr string `mapstructure:"shoutrrr"` }
Service represents a notification service