kernelmonitor

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2016 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogBuffer

func NewLogBuffer(maxLines int) *logBuffer

NewLogBuffer creates log buffer with max line number limit. Because we only match logs in the log buffer, the max buffer line number is also the max pattern line number we support. Smaller buffer line number means less memory and cpu usage, but also means less lines of patterns we support.

Types

type KernelLogWatcher

type KernelLogWatcher interface {
	// Watch starts the kernel log watcher and returns a watch channel.
	Watch() (<-chan *types.KernelLog, error)
	// Stop stops the kernel log watcher.
	Stop()
}

KernelLogWatcher watches and translates the kernel log. Once there is new log line, it will translate and report the log.

func NewKernelLogWatcher

func NewKernelLogWatcher(cfg WatcherConfig) KernelLogWatcher

NewKernelLogWatcher creates a new kernel log watcher.

type KernelMonitor

type KernelMonitor interface {
	// Start starts the kernel monitor.
	Start() (<-chan *types.Status, error)
	// Stop stops the kernel monitor.
	Stop()
}

KernelMonitor monitors the kernel log and reports node problem condition and event according to the rules.

func NewKernelMonitorOrDie

func NewKernelMonitorOrDie(configPath string) KernelMonitor

NewKernelMonitorOrDie create a new KernelMonitor, panic if error occurs.

type LogBuffer

type LogBuffer interface {
	// Push pushes log into the log buffer.
	Push(*types.KernelLog)
	// Match with regular expression in the log buffer.
	Match(string) []*types.KernelLog
	// String returns a concatenated string of the buffered logs.
	String() string
}

LogBuffer buffers the logs and supports match in the log buffer with regular expression.

type MonitorConfig

type MonitorConfig struct {
	// WatcherConfig is the configuration of kernel log watcher.
	WatcherConfig
	// BufferSize is the size (in lines) of the log buffer.
	BufferSize int `json:"bufferSize"`
	// Source is the source name of the kernel monitor
	Source string `json:"source"`
	// DefaultConditions are the default states of all the conditions kernel monitor should handle.
	DefaultConditions []types.Condition `json:"conditions"`
	// Rules are the rules kernel monitor will follow to parse the log file.
	Rules []kerntypes.Rule `json:"rules"`
}

MonitorConfig is the configuration of kernel monitor.

type WatcherConfig

type WatcherConfig struct {
	KernelLogPath string `json:"logPath, omitempty"`
}

WatcherConfig is the configuration of kernel log watcher.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL