Documentation ¶
Index ¶
- Constants
- Variables
- func Fatal(ss ...string)
- func ProcessNotifications()
- func StartLogger(l string)
- type Config
- type Defaults
- type Gate
- type Notification
- type Notifier
- type State
- type Task
- func (t Task) ExpandArgs() []string
- func (t Task) Frequency() time.Duration
- func (t Task) GetLastNotification(name string) time.Time
- func (t Task) Hash() uint32
- func (t Task) LastNotification() time.Time
- func (t Task) LastState() State
- func (t Task) NotifierIndex(name string) (int, error)
- func (t Task) Ready(ts time.Time) bool
- func (t *Task) RecordStatus(b bool)
- func (t *Task) Run() bool
- func (t *Task) SetLastNotification(name string, ts time.Time) error
- func (t Task) State() State
- func (t Task) StateChanged() bool
Constants ¶
View Source
const ( STATE_UNKNOWN = State(iota) STATE_FAIL STATE_OK )
View Source
const DEFAULT_FREQUENCY_SECONDS = 300
View Source
const DEFAULT_PRIORITY = 5
View Source
const DEFAULT_RETRIES = 5
View Source
const DEFAULT_TIMEOUT_SECONDS = 5
View Source
const GRACE_TIME = time.Duration(500) * time.Millisecond
Variables ¶
View Source
var DAEMON_START_TIME = time.Now()
View Source
var Logger *slog.Logger
View Source
var NotifyCh = make(chan Notification, 100)
Functions ¶
func ProcessNotifications ¶
func ProcessNotifications()
func StartLogger ¶
func StartLogger(l string)
Types ¶
type Config ¶
type Config struct { Defaults Defaults LogLevel string `toml:"log_level"` Notifiers []Notifier `toml:"notifier"` Tasks []Task `toml:"task"` Gates []Gate `toml:"gate"` ListenAddress string `toml:"listen_address"` Directory string `toml:"directory"` }
func ReadConfig ¶
func ReadConfig() Config
type Defaults ¶
type Defaults struct { FrequencySeconds int `toml:"frequency"` NotifierNames []string `toml:"notifiers"` Retries int `toml:"retries"` RetryFrequencySeconds int `toml:"retry_frequency"` TimeoutSeconds int `toml:"timeout"` // better to put the timeout into the commmand Priority int `toml:"priority"` }
type Gate ¶
type Gate struct { Name string `toml:"name"` // friendly name Command string `toml:"command"` // command Args []string `toml:"args"` // command arguments }
func GateByName ¶ added in v0.0.20
type Notification ¶
type Notifier ¶
type Notifier struct { Name string Command string Args []string GateSets [][]string `toml:"gates"` TimeoutSeconds int `toml:"timeout"` // contains filtered or unexported fields }
func NotifierByName ¶ added in v0.0.20
type Task ¶
type Task struct { Name string `toml:"name"` // friendly name Command string `toml:"command"` // command Args []string `toml:"args"` // command arguments FrequencySeconds int `toml:"frequency"` // how often to run RetryFrequencySeconds int `toml:"retry_frequency"` // how quickly to retry when state unknown TimeoutSeconds int `toml:"timeout"` // how long an execution may run Retries int `toml:"retries"` // number of retries before changing the state NotifierNames []string `toml:"notifiers"` // notifiers to trigger upon state change Priority int `toml:"priority"` // the priority of the notifications ErrorBody string `toml:"error_body"` // the body of the notification when entering an error state RecoverBody string `toml:"recover_body"` // the body of the notification when recovering from an error state // public, but not configurable ErrorCount int // task failed to executed ExecutionCount int // task was executed FailCount int // task failed History uint32 // represented in binary. Successes are high HistoryMask uint32 // the bits in the history with a recorded value. Needed to understand a history of 0 LastFail time.Time // the time of the last failed execution LastOk time.Time // the time of the last successfull execution LastResultOutput string // the result output of the last execution LastRun time.Time // the time of the last execution OKCount int // task passed // contains filtered or unexported fields }
func (Task) ExpandArgs ¶
return the arguments after interpolating the values
func (Task) GetLastNotification ¶ added in v0.0.20
func (Task) LastNotification ¶ added in v0.0.21
get the last notification of all notifiers.
func (*Task) RecordStatus ¶
func (*Task) SetLastNotification ¶ added in v0.0.20
Click to show internal directories.
Click to hide internal directories.