icinga

package
v0.0.0-...-425e462 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ICINGA_ADDRESS         = "ICINGA_ADDRESS" // host:port
	ICINGA_API_USER        = "ICINGA_API_USER"
	ICINGA_API_PASSWORD    = "ICINGA_API_PASSWORD"
	ICINGA_CA_CERT         = "ICINGA_CA_CERT"
	ICINGA_SERVER_KEY      = "ICINGA_SERVER_KEY"
	ICINGA_SERVER_CERT     = "ICINGA_SERVER_CERT"
	ICINGA_IDO_HOST        = "ICINGA_IDO_HOST"
	ICINGA_IDO_PORT        = "ICINGA_IDO_PORT"
	ICINGA_IDO_DB          = "ICINGA_IDO_DB"
	ICINGA_IDO_USER        = "ICINGA_IDO_USER"
	ICINGA_IDO_PASSWORD    = "ICINGA_IDO_PASSWORD"
	ICINGA_WEB_HOST        = "ICINGA_WEB_HOST"
	ICINGA_WEB_PORT        = "ICINGA_WEB_PORT"
	ICINGA_WEB_DB          = "ICINGA_WEB_DB"
	ICINGA_WEB_USER        = "ICINGA_WEB_USER"
	ICINGA_WEB_PASSWORD    = "ICINGA_WEB_PASSWORD"
	ICINGA_WEB_UI_PASSWORD = "ICINGA_WEB_UI_PASSWORD"
)
View Source
const (
	TypePod     = "pod"
	TypeNode    = "node"
	TypeCluster = "cluster"
)

Variables

This section is empty.

Functions

func IVar

func IVar(value string) string

func IsValidHostType

func IsValidHostType(t string) bool

func Output

func Output(s State, message interface{})

Types

type APIRequest

type APIRequest struct {
	Err error

	Status       int
	ResponseBody []byte
	// contains filtered or unexported fields
}

func (*APIRequest) Create

func (ic *APIRequest) Create(name []string, jsonBody string) *APIRequest

func (*APIRequest) Delete

func (ic *APIRequest) Delete(name []string, jsonBody string) *APIRequest

func (*APIRequest) Do

func (ic *APIRequest) Do() *APIResponse

func (*APIRequest) Get

func (ic *APIRequest) Get(name []string, jsonBody ...string) *APIRequest

func (*APIRequest) Params

func (ic *APIRequest) Params(param map[string]string) *APIRequest

func (*APIRequest) Update

func (ic *APIRequest) Update(name []string, jsonBody string) *APIRequest

type APIResponse

type APIResponse struct {
	Err          error
	Status       int
	ResponseBody []byte
}

func (*APIResponse) Into

func (r *APIResponse) Into(to interface{}) (int, error)

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cfg Config) *Client

func (*Client) Actions

func (c *Client) Actions(action string) *APIRequest

func (*Client) Check

func (c *Client) Check() *APIRequest

func (*Client) HostGroups

func (c *Client) HostGroups(hostName string) *APIRequest

func (*Client) Hosts

func (c *Client) Hosts(hostName string) *APIRequest

func (*Client) Notifications

func (c *Client) Notifications(hostName string) *APIRequest

func (*Client) Service

func (c *Client) Service(hostName string) *APIRequest

func (*Client) SetEndpoint

func (c *Client) SetEndpoint(endpoint string) *Client

type ClusterHost

type ClusterHost struct {
	// contains filtered or unexported fields
}

func NewClusterHost

func NewClusterHost(IcingaClient *Client, verbosity string) *ClusterHost

func (*ClusterHost) Apply

func (h *ClusterHost) Apply(alert *api.ClusterAlert) error

func (*ClusterHost) Complete

func (h *ClusterHost) Complete(v string)

func (*ClusterHost) Delete

func (h *ClusterHost) Delete(namespace, name string) error

func (*ClusterHost) DeleteChecks

func (h *ClusterHost) DeleteChecks(cmd string) error

func (*ClusterHost) ForceDeleteIcingaHost

func (h *ClusterHost) ForceDeleteIcingaHost(kh IcingaHost) error

func (*ClusterHost) IcingaServiceSearchQuery

func (h *ClusterHost) IcingaServiceSearchQuery(svc string, kids ...IcingaHost) string

type Config

type Config struct {
	Endpoint  string
	BasicAuth struct {
		Username string
		Password string
	}
	CACert []byte
}

type Configurator

type Configurator struct {
	ConfigRoot       string
	IcingaSecretName string
	Expiry           time.Duration
}

func (*Configurator) ConfigFile

func (c *Configurator) ConfigFile() string

func (*Configurator) LoadConfig

func (c *Configurator) LoadConfig(userInput envconfig.LoaderFunc) (*Config, error)

type IcingaHost

type IcingaHost struct {
	Type           string
	AlertNamespace string
	ObjectName     string
	IP             string
}

func ParseHost

func ParseHost(name string) (*IcingaHost, error)

func (IcingaHost) GetAlert

func (kh IcingaHost) GetAlert(extClient cs.Interface, alertName string) (api.Alert, error)

func (IcingaHost) Name

func (kh IcingaHost) Name() (string, error)

type IcingaObject

type IcingaObject struct {
	Templates []string               `json:"templates,omitempty"`
	Attrs     map[string]interface{} `json:"attrs"`
}

type NodeHost

type NodeHost struct {
	// contains filtered or unexported fields
}

func NewNodeHost

func NewNodeHost(IcingaClient *Client, verbosity string) *NodeHost

func (*NodeHost) Apply

func (h *NodeHost) Apply(alert *api.NodeAlert, node *core.Node) error

set Alert in Icinga LocalHost

func (*NodeHost) Complete

func (h *NodeHost) Complete(v string)

func (*NodeHost) Delete

func (h *NodeHost) Delete(alertNamespace, alertName string, node *core.Node) error

func (*NodeHost) DeleteChecks

func (h *NodeHost) DeleteChecks(cmd string) error

func (*NodeHost) ForceDeleteIcingaHost

func (h *NodeHost) ForceDeleteIcingaHost(kh IcingaHost) error

func (*NodeHost) IcingaServiceSearchQuery

func (h *NodeHost) IcingaServiceSearchQuery(svc string, kids ...IcingaHost) string

type PodHost

type PodHost struct {
	// contains filtered or unexported fields
}

func NewPodHost

func NewPodHost(IcingaClient *Client, verbosity string) *PodHost

func (*PodHost) Apply

func (h *PodHost) Apply(alert *api.PodAlert, pod *core.Pod) error

func (*PodHost) Complete

func (h *PodHost) Complete(v string)

func (*PodHost) Delete

func (h *PodHost) Delete(alertNamespace, alertName string, pod *core.Pod) error

func (*PodHost) DeleteChecks

func (h *PodHost) DeleteChecks(cmd string) error

func (*PodHost) ForceDeleteIcingaHost

func (h *PodHost) ForceDeleteIcingaHost(kh IcingaHost) error

func (*PodHost) IcingaServiceSearchQuery

func (h *PodHost) IcingaServiceSearchQuery(svc string, kids ...IcingaHost) string

type ResponseObject

type ResponseObject struct {
	Results []struct {
		Attrs struct {
			Name            string                 `json:"name"`
			CheckInterval   float64                `json:"check_interval"`
			Vars            map[string]interface{} `json:"vars"`
			LastState       float64                `json:"last_state"`
			Acknowledgement float64                `json:"acknowledgement"`
		} `json:"attrs"`
		Name string `json:"name"`
	} `json:"results"`
}

type State

type State int32
const (
	OK       State = iota // 0
	Warning               // 1
	Critical              // 2
	Unknown               // 3
)

func (State) String

func (i State) String() string

Jump to

Keyboard shortcuts

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