nagioswatcher

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: Apache-2.0 Imports: 27 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChoriaPlugin added in v0.19.0

func ChoriaPlugin() *plugin.WatcherPlugin

func New

func New(machine model.Machine, name string, states []string, failEvent string, successEvent string, interval string, ai time.Duration, properties map[string]any) (any, error)

func StateName added in v0.20.0

func StateName(s int) string

StateName returns friendly name for a state

Types

type Execution added in v0.17.0

type Execution struct {
	Executed time.Time       `json:"execute"`
	Status   int             `json:"status"`
	PerfData []util.PerfData `json:"perfdata,omitempty"`
}

type State

type State int
const (
	OK State = iota
	WARNING
	CRITICAL
	UNKNOWN
	SKIPPED
	NOTCHECKED
)

type StateNotification

type StateNotification struct {
	event.Event

	Plugin      string            `json:"plugin"`
	Status      string            `json:"status"`
	StatusCode  int               `json:"status_code"`
	Output      string            `json:"output"`
	CheckTime   int64             `json:"check_time"`
	PerfData    []util.PerfData   `json:"perfdata"`
	RunTime     float64           `json:"runtime"`
	History     []*Execution      `json:"history"`
	Annotations map[string]string `json:"annotations"`
}

func (*StateNotification) CloudEvent

func (s *StateNotification) CloudEvent() cloudevents.Event

CloudEvent creates a CloudEvent from the state notification

func (*StateNotification) JSON

func (s *StateNotification) JSON() ([]byte, error)

JSON creates a JSON representation of the notification

func (*StateNotification) String

func (s *StateNotification) String() string

String is a string representation of the notification suitable for printing

type Watcher

type Watcher struct {
	*watcher.Watcher
	// contains filtered or unexported fields
}

func (*Watcher) CurrentState

func (w *Watcher) CurrentState() any

func (*Watcher) Delete

func (w *Watcher) Delete()

Delete stops the watcher and remove it from the prom state after the check was removed from disk

func (*Watcher) NotifyStateChance

func (w *Watcher) NotifyStateChance()

func (*Watcher) Run

func (w *Watcher) Run(ctx context.Context, wg *sync.WaitGroup)

func (*Watcher) ShouldWatch added in v0.19.0

func (w *Watcher) ShouldWatch() bool

Jump to

Keyboard shortcuts

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