icinga

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCertTemplate = `` /* 415-byte string literal not displayed */

DefaultCertTemplate is the Jet source seeded in the lab and shown as the Icinga settings placeholder. Rendered once per sync with .Checks.

Variables

This section is empty.

Functions

func FetchRemoteConfig

func FetchRemoteConfig(factumConfig *util.ConfigFactum) (*util.ConfigIcinga, error)

FetchRemoteConfig pulls the Icinga API connection settings from the primary, authenticated with factumConfig.Token (checked against the primary's Settings.FactumApiToken - see web.Controller.checkServiceToken).

func NewIcingaClient

func NewIcingaClient(c util.ConfigIcinga) *icingaClient

func RemoteClient

func RemoteClient(factumConfig *util.ConfigFactum) (*icingaClient, error)

RemoteClient is the FetchRemoteConfig + NewIcingaClient convenience most callers want.

Types

type FactumIcingaClient

type FactumIcingaClient struct {
	Config       *util.ConfigFactum
	IcingaConfig *util.ConfigIcinga
	Icinga       *icingaClient

	// Users collects alarm-destination email addresses seen while writing
	// hosts (writeDevices), for writeUsers to turn into Icinga User
	// objects. Reset at the start of each Update().
	Users map[string]bool
}

func NewFactumIcingaClient

func NewFactumIcingaClient(config *util.ConfigFactum) (*FactumIcingaClient, error)

NewFactumIcingaClient fetches the Icinga API connection settings and the icinga_sync config (hosts/users file paths, templates, ignore list, ...) from the primary over REST - config.Icinga is never used, since factum2-icinga typically runs on a different host than the primary and has no local icinga config of its own (see util.ConfigIcinga's doc comment).

func (*FactumIcingaClient) Sync

func (fic *FactumIcingaClient) Sync(reporter jobevent.Reporter) error

Sync fetches devices from the Factum API, writes the icinga2 hosts, users, and certificate-check config files, and asks icinga2 to reload if anything changed.

type HostState

type HostState struct {
	Name                 string
	Acknowledgement      int
	State                int
	Address              string
	Address6             string
	LastHardState        int
	LastHardStateChanged time.Time

	Notes string

	FactumComments     string
	FactumLocation     string
	FactumManufacturer string
	FactumModel        string
	FactumPlatform     string
	FactumRole         string
	FactumSiteName     string
}

HostState is the parsed, factum-relevant subset of an Icinga Host object (icinga's own https://icinga.com/docs/icinga2/latest/doc/12-icinga2-api/ "results[].attrs" shape, with the "vars.factum_*" custom vars set by Settings.IcingaHostTemplate - see internal/icinga/factum2-icinga.go).

type HostStateResult

type HostStateResult struct {
	Error   float32     `json:"error"`
	Status  string      `json:"status"`
	Results []HostState `json:"results"`
}

type Response

type Response struct {
	Status  string `json:"status"`
	Message string `json:"message"`
	Data    any    `json:"data"`
}

type ServiceState

type ServiceState struct {
	HostName             string
	Name                 string
	Acknowledgement      int
	State                int
	LastHardState        int
	LastHardStateChanged time.Time
	Output               string
	Notes                string
}

ServiceState is the parsed, factum-relevant subset of an Icinga Service object.

type ServiceStateResult

type ServiceStateResult struct {
	Error   float32        `json:"error"`
	Status  string         `json:"status"`
	Results []ServiceState `json:"results"`
}

Jump to

Keyboard shortcuts

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