Documentation
¶
Index ¶
- Constants
- func FetchRemoteConfig(factumConfig *util.ConfigFactum) (*util.ConfigIcinga, error)
- func NewIcingaClient(c util.ConfigIcinga) *icingaClient
- func RemoteClient(factumConfig *util.ConfigFactum) (*icingaClient, error)
- type FactumIcingaClient
- type HostState
- type HostStateResult
- type Response
- type ServiceState
- type ServiceStateResult
Constants ¶
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).
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 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"`
}