poller

package
v0.0.0-...-68678b1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2021 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CommentTypeUser represents an user comment type
	CommentTypeUser = 1
	// CommentTypeDowntime represents a downtime comment type
	CommentTypeDowntime = 2
	// CommentTypeFlapping represents a flap comment type
	CommentTypeFlapping = 3
	// CommentTypeAcknowledgement represents a acknowledge comment type
	CommentTypeAcknowledgement = 4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog

type Catalog struct {
	Hosts  []*Host
	Worker *Worker
}

Catalog represents the states catalog in a poller worker

func NewCatalog

func NewCatalog(w *Worker) *Catalog

NewCatalog returns a new states catalog instance

func (*Catalog) GetHostByName

func (c *Catalog) GetHostByName(name string) (*Host, error)

GetHostByName returns an host based on its name, or nil if not found

type Comment

type Comment struct {
	Author  string
	Content string
	Type    int64
	Date    time.Time
}

Comment represents a comment entry in a states catalog host or service

type Config

type Config struct {
	Nodes []NodeConfig `yaml:"nodes"`
}

Config represents the poller configuration struct

type Host

type Host struct {
	Name         string
	State        int64
	StateChanged time.Time
	Comments     []Comment
	Links        [][2]string
	Services     []*Service
	Groups       []string
	Catalog      *Catalog
}

Host represents a host entry in a states catalog

type LinkConfig

type LinkConfig struct {
	Label      string `yaml:"label"`
	HostURL    string `yaml:"host_url"`
	ServiceURL string `yaml:"service_url"`
}

LinkConfig represents a link entry in a poller's node

type NodeConfig

type NodeConfig struct {
	Name         string       `yaml:"name"`
	Label        string       `yaml:"label"`
	Address      string       `yaml:"remote_addr"`
	Links        []LinkConfig `yaml:"links"`
	PollInterval int          `yaml:"poll_interval"`
}

NodeConfig represents a node entry in the poller

type Poller

type Poller struct {
	Workers []*Worker
	// contains filtered or unexported fields
}

Poller represents a poller instance

func NewPoller

func NewPoller(c Config) *Poller

NewPoller returns a new poller instance

func (*Poller) GetHostByName

func (p *Poller) GetHostByName(name string) ([]*Host, error)

GetHostByName returns an host based on its name, or nil if not found

func (*Poller) GetHosts

func (p *Poller) GetHosts() ([]*Host, error)

GetHosts returns the list of hosts present in the poller

func (*Poller) Refresh

func (p *Poller) Refresh()

Refresh refreshes the poller catalog content

func (*Poller) Shutdown

func (p *Poller) Shutdown()

Shutdown stops the poller

type Service

type Service struct {
	Name         string
	State        int64
	StateChanged time.Time
	Comments     []Comment
	Links        [][2]string
	Output       string
	Groups       []string
	Host         *Host
}

Service represents a service entry in a states catalog host

type Worker

type Worker struct {
	Catalog *Catalog
	Config  NodeConfig
	// contains filtered or unexported fields
}

Worker represents a worker instance in a poller

func NewWorker

func NewWorker(c NodeConfig, wg *sync.WaitGroup) *Worker

NewWorker returns a new worker instance

func (*Worker) Refresh

func (w *Worker) Refresh()

Refresh emits a refresh command on the worker command channel

func (*Worker) Shutdown

func (w *Worker) Shutdown()

Shutdown stops the worker

func (*Worker) Start

func (w *Worker) Start()

Start starts the worker processing

Jump to

Keyboard shortcuts

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