Documentation ¶
Index ¶
Constants ¶
View Source
const ( OpStop = 'S' // Stop the watchdogd petting. OpContinue = 'C' // Continue the watchdogd petting. OpDisarm = 'D' // Disarm the watchdog. OpArm = 'A' // Arm the watchdog. )
View Source
const ( OpResultOk = 'O' // Ok. OpResultError = 'E' // Error. OpResultInvalidOp = 'I' // Invalid Op. )
Variables ¶
This section is empty.
Functions ¶
func MonitorOops ¶
func MonitorOops() error
MonitorOops return an error if the kernel logs contain an oops.
func NewClientFromUDS ¶
Types ¶
type Daemon ¶
type Daemon struct { // CurrentOpts is current operating parameters for the daemon. // // It is assigned at the first call of Run and updated on each subsequent call of it. CurrentOpts *DaemonOpts // CurrentWd is an open file descriptor to the watchdog device specified in the daemon options. CurrentWd *watchdog.Watchdog // PettingOp syncs the signal to continue or stop petting the watchdog. PettingOp chan int // PettingOn indicate if there is an active petting session. PettingOn bool }
Daemon contains running states of an instance of the daemon.
func New ¶
func New(opts *DaemonOpts) *Daemon
func (*Daemon) DisarmWatchdog ¶
disarmWatchdog disarm the watchdog if already armed.
func (*Daemon) DoPetting ¶
doPetting sends keepalive signal to Watchdog when necessary.
If at least one of the custom monitors failed check(s), it won't send a keepalive signal.
func (*Daemon) StartPetting ¶
startPetting starts Watchdog petting in a new goroutine.
func (*Daemon) StartServing ¶
func (d *Daemon) StartServing(l *net.UnixListener)
StartServing enters a loop of accepting and processing next incoming watchdogd operation call.
func (*Daemon) StopPetting ¶
stopPetting stops an ongoing petting process if there is.
type DaemonOpts ¶
type DaemonOpts struct { // Dev is the watchdog device. Ex: /dev/watchdog Dev string // nil uses the preset values. 0 disables the timeout. Timeout, PreTimeout *time.Duration // KeepAlive is the length of the keep alive interval. KeepAlive time.Duration // Monitors are called before each keepalive interval. If any monitor // function returns an error, the . Monitors []func() error // UDS is the name of daemon's unix domain socket. UDS string }
DaemonOpts contain operating parameters for bootstrapping a watchdog daemon.
Click to show internal directories.
Click to hide internal directories.