icinga2

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	ExitStatus      int       `json:"exit_status"`
	PluginOutput    string    `json:"plugin_output"`
	PerformanceData PerfData  `json:"performance_data,omitempty"`
	CheckCommand    Command   `json:"check_command,omitempty"`
	CheckSource     string    `json:"check_source,omitempty"`
	ExecutionStart  TimeStamp `json:"execution_start,omitempty"`
	ExecutionEnd    TimeStamp `json:"execution_end,omitempty"`
	TTL             int       `json:"ttl"`
	Filter          string    `json:"filter"`
	Type            string    `json:"type"`
}

type Checkable

type Checkable interface {
	GetCheckCommand() string
	GetVars() Vars
	GetNotes() string
	GetNotesURL() string
}

type Client

type Client interface {
	GetHost(string) (Host, error)
	CreateHost(Host) error
	ListHosts(string) ([]Host, error)
	DeleteHost(string) error
	UpdateHost(Host) error

	GetHostGroup(string) (HostGroup, error)
	CreateHostGroup(HostGroup) error
	ListHostGroups(string) ([]HostGroup, error)
	DeleteHostGroup(string) error
	UpdateHostGroup(HostGroup) error

	ListDowntimes(string) ([]Downtime, error)

	GetService(string) (Service, error)
	CreateService(Service) error
	ListServices(string) ([]Service, error)
	DeleteService(string) error
	UpdateService(Service) error

	ProcessCheckResult(Service, Action) error
}

type Command

type Command []string

type Downtime

type Downtime struct {
	Active    bool    `json:"active"`
	Author    string  `json:"author"`
	Comment   string  `json:"comment"`
	EndTime   float64 `json:"end_time"`
	Fixed     bool    `json:"fixed"`
	Host      string  `json:"host_name"`
	Name      string  `json:"name,omitempty"`
	Service   string  `json:"service_name"`
	StartTime float64 `json:"start_time"`
	Type      string  `json:"type"`
	Zone      string  `json:"zone"`
}

type DowntimeResults

type DowntimeResults struct {
	Results []struct {
		Downtime Downtime `json:"attrs"`
	} `json:"results"`
}

type Host

type Host struct {
	Name         string   `json:"name,omitempty"`
	DisplayName  string   `json:"display_name"`
	Address      string   `json:"address,omitempty"`
	Address6     string   `json:"address6,omitempty"`
	CheckCommand string   `json:"check_command,omitempty"`
	Notes        string   `json:"notes"`
	NotesURL     string   `json:"notes_url"`
	CheckPeriod  string   `json:"check_period,omitempty"`
	Vars         Vars     `json:"vars"`
	Groups       []string `json:"groups,omitempty"`
	Zone         string   `json:"zone,omitempty"`
}

func (Host) GetCheckCommand

func (h Host) GetCheckCommand() string

func (Host) GetNotes

func (h Host) GetNotes() string

func (Host) GetNotesURL

func (h Host) GetNotesURL() string

func (Host) GetVars

func (h Host) GetVars() Vars

type HostCreate

type HostCreate struct {
	Templates []string `json:"templates"`
	Attrs     Host     `json:"attrs"`
}

type HostGroup

type HostGroup struct {
	Name string `json:"display_name,omitempty"`
	Vars Vars   `json:"vars"`
	Zone string `json:"zone,omitempty"`
}

func (HostGroup) GetVars

func (hg HostGroup) GetVars() Vars

type HostGroupCreate

type HostGroupCreate struct {
	Templates []string  `json:"templates"`
	Attrs     HostGroup `json:"attrs"`
}

type HostGroupResults

type HostGroupResults struct {
	Results []struct {
		HostGroup HostGroup `json:"attrs"`
	} `json:"results"`
}

type HostResults

type HostResults struct {
	Results []struct {
		Host Host `json:"attrs"`
	} `json:"results"`
}

type MockClient

type MockClient struct {
	Hostgroups map[string]HostGroup
	Hosts      map[string]Host
	Services   map[string]Service
	Actions    map[string][]Action
	// contains filtered or unexported fields
}

func NewMockClient

func NewMockClient() (c *MockClient)

func (*MockClient) CreateHost

func (s *MockClient) CreateHost(host Host) error

func (*MockClient) CreateHostGroup

func (s *MockClient) CreateHostGroup(hostGroup HostGroup) error

func (*MockClient) CreateService

func (s *MockClient) CreateService(service Service) error

func (*MockClient) DeleteHost

func (s *MockClient) DeleteHost(name string) error

func (*MockClient) DeleteHostGroup

func (s *MockClient) DeleteHostGroup(name string) error

func (*MockClient) DeleteService

func (s *MockClient) DeleteService(name string) error

func (*MockClient) GetHost

func (s *MockClient) GetHost(name string) (Host, error)

func (*MockClient) GetHostGroup

func (s *MockClient) GetHostGroup(name string) (HostGroup, error)

func (*MockClient) GetService

func (s *MockClient) GetService(name string) (Service, error)

func (*MockClient) ListDowntimes

func (s *MockClient) ListDowntimes(query string) ([]Downtime, error)

func (*MockClient) ListHostGroups

func (s *MockClient) ListHostGroups(query string) ([]HostGroup, error)

func (*MockClient) ListHosts

func (s *MockClient) ListHosts(query string) ([]Host, error)

func (*MockClient) ListServices

func (s *MockClient) ListServices(query string) ([]Service, error)

func (*MockClient) ProcessCheckResult

func (s *MockClient) ProcessCheckResult(service Service, action Action) error

func (*MockClient) UpdateHost

func (s *MockClient) UpdateHost(host Host) error

func (*MockClient) UpdateHostGroup

func (s *MockClient) UpdateHostGroup(hostGroup HostGroup) error

func (*MockClient) UpdateService

func (s *MockClient) UpdateService(service Service) error

type Object

type Object interface {
	GetVars() Vars
}

type PerfData

type PerfData []string

type Results

type Results struct {
	Results []struct {
		Code   float64  `json:"code"`
		Errors []string `json:"errors,omitempty"`
		Status string   `json:"status,omitempty"`
		Name   string   `json:"name,omitempty"`
		Type   string   `json:"type,omitempty"`
	} `json:"results"`
}

type Service

type Service struct {
	Name               string  `json:"name,omitempty"`
	DisplayName        string  `json:"display_name"`
	HostName           string  `json:"host_name"`
	CheckCommand       string  `json:"check_command"`
	EnableActiveChecks bool    `json:"enable_active_checks"`
	Notes              string  `json:"notes"`
	NotesURL           string  `json:"notes_url"`
	ActionURL          string  `json:"action_url"`
	Vars               Vars    `json:"vars"`
	Zone               string  `json:"zone,omitempty"`
	CheckInterval      float64 `json:"check_interval"`
	RetryInterval      float64 `json:"retry_interval"`
	MaxCheckAttempts   float64 `json:"max_check_attempts"`
	CheckPeriod        string  `json:"check_period,omitempty"`
	State              float64 `json:"state,omitempty"`
	LastStateChange    float64 `json:"last_state_change,omitempty"`
}

func (*Service) FullName

func (s *Service) FullName() string

func (Service) GetCheckCommand

func (s Service) GetCheckCommand() string

func (Service) GetNotes

func (s Service) GetNotes() string

func (Service) GetNotesURL

func (s Service) GetNotesURL() string

func (Service) GetVars

func (s Service) GetVars() Vars

type ServiceCreate

type ServiceCreate struct {
	Templates []string `json:"templates"`
	Attrs     Service  `json:"attrs"`
}

type ServiceResults

type ServiceResults struct {
	Results []struct {
		Service Service `json:"attrs"`
	} `json:"results"`
}

type TimeStamp

type TimeStamp string

TODO: is this correct?

type Vars

type Vars map[string]interface{}

type WebClient

type WebClient struct {
	URL               string
	Username          string
	Password          string
	Debug             bool
	DisableKeepAlives bool
	Zone              string
	TLSConfig         *tls.Config
	// contains filtered or unexported fields
}

func New

func New(s WebClient) (*WebClient, error)

func (*WebClient) CreateHost

func (s *WebClient) CreateHost(host Host) error

func (*WebClient) CreateHostGroup

func (s *WebClient) CreateHostGroup(hostGroup HostGroup) error

func (*WebClient) CreateObject

func (s *WebClient) CreateObject(path string, create interface{}) error

func (*WebClient) CreateService

func (s *WebClient) CreateService(service Service) error

func (*WebClient) DeleteHost

func (s *WebClient) DeleteHost(name string) (err error)

func (*WebClient) DeleteHostGroup

func (s *WebClient) DeleteHostGroup(name string) (err error)

func (*WebClient) DeleteService

func (s *WebClient) DeleteService(name string) (err error)

func (*WebClient) GetHost

func (s *WebClient) GetHost(name string) (Host, error)

func (*WebClient) GetHostGroup

func (s *WebClient) GetHostGroup(name string) (HostGroup, error)

func (*WebClient) GetService

func (s *WebClient) GetService(name string) (Service, error)

func (*WebClient) ListDowntimes

func (s *WebClient) ListDowntimes(query string) (downtimes []Downtime, err error)

func (*WebClient) ListHostGroups

func (s *WebClient) ListHostGroups(query string) (hostGroups []HostGroup, err error)

func (*WebClient) ListHosts

func (s *WebClient) ListHosts(query string) (hosts []Host, err error)

func (*WebClient) ListServices

func (s *WebClient) ListServices(query string) (services []Service, err error)

func (*WebClient) ProcessCheckResult

func (s *WebClient) ProcessCheckResult(service Service, action Action) error

func (*WebClient) UpdateHost

func (s *WebClient) UpdateHost(host Host) error

func (*WebClient) UpdateHostGroup

func (s *WebClient) UpdateHostGroup(hostGroup HostGroup) error

func (*WebClient) UpdateObject

func (s *WebClient) UpdateObject(path string, create interface{}) error

func (*WebClient) UpdateService

func (s *WebClient) UpdateService(service Service) error

Jump to

Keyboard shortcuts

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