services

package
v0.0.0-...-143a0bd Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: GPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithIcingaDbConfig

func WithIcingaDbConfig(config string) func(*IcingaDb)

WithIcingaDbConfig sets additional raw YAML configuration.

Types

type Icinga2

type Icinga2 struct {
	Icinga2Base
}

Icinga2 wraps the Icinga2Base interface and adds some more helper functions.

func (Icinga2) ApiClient

func (i Icinga2) ApiClient() *utils.Icinga2Client

func (Icinga2) Ping

func (i Icinga2) Ping() error

Ping tries to connect to the API port of an Icinga 2 instance to see if it is running.

func (Icinga2) Reload

func (i Icinga2) Reload() error

Reload sends a reload signal to icinga2 and waits for the new config to become active.

func (Icinga2) WriteIcingaDbConf

func (i Icinga2) WriteIcingaDbConf(r RedisServerBase)

type Icinga2Base

type Icinga2Base interface {
	// Host returns the host on which the Icinga 2 API can be reached.
	Host() string

	// Port return the port on which the Icinga 2 API can be reached.
	Port() string

	// TriggerReload sends a reload signal to the Icinga 2 node.
	TriggerReload()

	// WriteConfig writes a config file to the file system of the Icinga 2 node.
	//
	// Example usage:
	//
	//   i.WriteConfig("etc/icinga2/conf.d/api-users.conf", []byte("var answer = 42"))
	WriteConfig(file string, data []byte)

	// DeleteConfigGlob deletes all configs file matching a glob from the file system of the Icinga 2 node.
	//
	// Example usage:
	//
	//   i.DeleteConfigGlob("etc/icinga2/zones.d/test/*.conf")
	DeleteConfigGlob(glob string)

	// EnableIcingaDb enables the icingadb feature on this node using the connection details of redis.
	EnableIcingaDb(redis RedisServerBase)

	// Cleanup stops the node and removes everything that was created to start this node.
	Cleanup()
}

type IcingaDb

type IcingaDb struct {
	IcingaDbBase
	// contains filtered or unexported fields
}

IcingaDb wraps the IcingaDbBase interface and adds some more helper functions.

func (IcingaDb) Config

func (i IcingaDb) Config() string

Config returns additional raw YAML configuration, if any.

func (IcingaDb) WriteConfig

func (i IcingaDb) WriteConfig(w io.Writer) error

type IcingaDbBase

type IcingaDbBase interface {
	// Redis returns the instance information of the Redis server this instance is using.
	Redis() RedisServerBase

	// RelationalDatabase returns the instance information of the relational database this instance is using.
	RelationalDatabase() RelationalDatabase

	// Cleanup stops the instance and removes everything that was created to start it.
	Cleanup()
}

type IcingaDbOption

type IcingaDbOption func(*IcingaDb)

IcingaDbOption configures IcingaDb.

type MysqlDatabase

type MysqlDatabase struct {
	MysqlDatabaseBase
}

MysqlDatabase wraps the MysqlDatabaseBase interface and adds some helper functions.

func (MysqlDatabase) DSN

func (m MysqlDatabase) DSN() string

func (MysqlDatabase) Driver

func (m MysqlDatabase) Driver() string

func (MysqlDatabase) IcingaDbType

func (m MysqlDatabase) IcingaDbType() string

func (MysqlDatabase) ImportIcingaDbSchema

func (m MysqlDatabase) ImportIcingaDbSchema()

func (MysqlDatabase) Open

func (m MysqlDatabase) Open() (*sql.DB, error)

type MysqlDatabaseBase

type MysqlDatabaseBase interface {
	// Host returns the host for connecting to this database.
	Host() string

	// Port returns the port for connecting to this database.
	Port() string

	// Username returns the username for connecting to this database.
	Username() string

	// Password returns the password for connecting to the database.
	Password() string

	// Database returns the name of the database on the MySQL server.
	Database() string

	// Cleanup removes the MySQL database.
	Cleanup()
}

type PostgresqlDatabase

type PostgresqlDatabase struct {
	PostgresqlDatabaseBase
}

PostgresqlDatabase wraps the PostgresqlDatabaseBase interface and adds some helper functions.

func (PostgresqlDatabase) DSN

func (p PostgresqlDatabase) DSN() string

func (PostgresqlDatabase) Driver

func (p PostgresqlDatabase) Driver() string

func (PostgresqlDatabase) IcingaDbType

func (p PostgresqlDatabase) IcingaDbType() string

func (PostgresqlDatabase) ImportIcingaDbSchema

func (p PostgresqlDatabase) ImportIcingaDbSchema()

func (PostgresqlDatabase) Open

func (p PostgresqlDatabase) Open() (*sql.DB, error)

type PostgresqlDatabaseBase

type PostgresqlDatabaseBase interface {
	// Host returns the host for connecting to this database.
	Host() string

	// Port returns the port for connecting to this database.
	Port() string

	// Username returns the username for connecting to this database.
	Username() string

	// Password returns the password for connecting to the database.
	Password() string

	// Database returns the name of the database on the PostgreSQL server.
	Database() string

	// Cleanup removes the PostgreSQL database.
	Cleanup()
}

type RedisServer

type RedisServer struct {
	RedisServerBase
}

RedisServer wraps the RedisServerBase interface and adds some helper functions.

func (RedisServer) Address

func (r RedisServer) Address() string

func (RedisServer) Open

func (r RedisServer) Open() *redis.Client

type RedisServerBase

type RedisServerBase interface {
	// Host returns the host for connecting to this Redis server.
	Host() string

	// Port returns the port for connecting to this Redis server.
	Port() string

	// Cleanup stops and removes this Redis server.
	Cleanup()
}

type RelationalDatabase

type RelationalDatabase interface {
	// Host returns the host for connecting to this database.
	Host() string

	// Port returns the port for connecting to this database.
	Port() string

	// Username returns the username for connecting to this database.
	Username() string

	// Password returns the password for connecting to the database.
	Password() string

	// Database returns the name of the database.
	Database() string

	// IcingaDbType returns the database type for use in config.yml for Icinga DB.
	IcingaDbType() string

	// Driver returns the sql driver name to connect to this database from Go.
	Driver() string

	// DSN returns the data source name (DSN) to connect to this database from Go.
	DSN() string

	// ImportIcingaDbSchema imports the Icinga DB schema into this database.
	ImportIcingaDbSchema()

	// Cleanup removes the database.
	Cleanup()
}

Jump to

Keyboard shortcuts

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