nagioswatcher

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Execution added in v0.17.0

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

type Machine

type Machine interface {
	State() string
	NotifyWatcherState(string, interface{})
	Name() string
	Directory() string
	Identity() string
	InstanceID() string
	Version() string
	TimeStampSeconds() int64
	TextFileDirectory() string
	OverrideData() ([]byte, error)
	Transition(t string, args ...interface{}) error
	Debugf(name string, format string, args ...interface{})
	Infof(name string, format string, args ...interface{})
	Errorf(name string, format string, args ...interface{})
}

type PerfData

type PerfData struct {
	Unit  string  `json:"unit"`
	Label string  `json:"label"`
	Value float64 `json:"value"`
}

type State

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

type StateNotification

type StateNotification struct {
	Protocol    string            `json:"protocol"`
	Identity    string            `json:"identity"`
	ID          string            `json:"id"`
	Version     string            `json:"version"`
	Timestamp   int64             `json:"timestamp"`
	Type        string            `json:"type"`
	Machine     string            `json:"machine"`
	Name        string            `json:"name"`
	Plugin      string            `json:"plugin"`
	Status      string            `json:"status"`
	StatusCode  int               `json:"status_code"`
	Output      string            `json:"output"`
	CheckTime   int64             `json:"check_time"`
	PerfData    []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) SenderID

func (s *StateNotification) SenderID() string

SenderID is the identity of the event producer

func (*StateNotification) String

func (s *StateNotification) String() string

String is a string representation of the notification suitable for printing

func (*StateNotification) WatcherType

func (s *StateNotification) WatcherType() string

WatcherType is the type of watcher the notification is for - exec, file etc

type Watcher

type Watcher struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(machine Machine, name string, states []string, failEvent string, successEvent string, interval string, ai time.Duration, properties map[string]interface{}) (watcher *Watcher, err error)

func (*Watcher) AnnounceInterval

func (w *Watcher) AnnounceInterval() time.Duration

func (*Watcher) CurrentState

func (w *Watcher) CurrentState() interface{}

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) Name

func (w *Watcher) Name() string

func (*Watcher) NotifyStateChance

func (w *Watcher) NotifyStateChance()

func (*Watcher) Run

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

func (*Watcher) Type

func (w *Watcher) Type() string

Jump to

Keyboard shortcuts

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