provider

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Type           string         `json:"type"`
	ScrapeInterval uint           `json:"scrape_interval" default:"120"` // scrape interval in seconds
	Params         map[string]any `json:"params" default:"{}"`           // extra parameters
}

type MetricMessage

type MetricMessage struct {
	MetricID    string
	Name        string
	Description string
}

type MetricState

type MetricState struct {
	MetricID    string
	Name        string
	IsHealthy   bool
	Description string
}

type MetricWrapper added in v1.1.0

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

func (*MetricWrapper) PushFailure added in v1.1.0

func (wrapper *MetricWrapper) PushFailure(description string, args ...any)

func (*MetricWrapper) PushMessage added in v1.1.0

func (wrapper *MetricWrapper) PushMessage(description string, args ...any)

func (*MetricWrapper) PushOK added in v1.1.0

func (wrapper *MetricWrapper) PushOK()

type Provider

type Provider interface {
	// return the list of tasks to be performed to update the provider metrics.
	// This function is called only once at startup.
	// Tasks may be executed in parallel.
	GetUpdateTaskList(ctx context.Context, resultWrapper *ScrapeResultWrapper, storage storage.Storager) UpdateTaskList
	MultipleInstanceAllowed() bool
	Destroy()
}

func LoadProviderFromConfig

func LoadProviderFromConfig(ctx context.Context, cfg Config) (Provider, error)

func NewProviderContainer added in v1.1.0

func NewProviderContainer() (Provider, error)

func NewProviderFileSystemUsage added in v1.1.0

func NewProviderFileSystemUsage(params map[string]any) (Provider, error)

func NewProviderPing

func NewProviderPing(params map[string]any) (Provider, error)

func NewProviderSystemd added in v1.1.0

func NewProviderSystemd(ctx context.Context, params map[string]any) (Provider, error)

type ProviderContainer added in v1.1.0

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

func (*ProviderContainer) Destroy added in v1.1.0

func (*ProviderContainer) Destroy()

func (*ProviderContainer) GetUpdateTaskList added in v1.1.0

func (containerProvider *ProviderContainer) GetUpdateTaskList(ctx context.Context, resultWrapper *ScrapeResultWrapper, storage storage.Storager) UpdateTaskList

func (*ProviderContainer) MultipleInstanceAllowed added in v1.1.0

func (containerProvider *ProviderContainer) MultipleInstanceAllowed() bool

type ProviderFileSystemUsage added in v1.1.0

type ProviderFileSystemUsage struct {
	MountPoints             []string `json:"mountpoints"`
	SpaceRemainingThreshold uint     `json:"threshold_percent" default:"20"`
}

func (*ProviderFileSystemUsage) Destroy added in v1.1.0

func (*ProviderFileSystemUsage) Destroy()

func (*ProviderFileSystemUsage) GetUpdateTaskList added in v1.1.0

func (provider *ProviderFileSystemUsage) GetUpdateTaskList(ctx context.Context, resultWrapper *ScrapeResultWrapper, storage storage.Storager) UpdateTaskList

func (*ProviderFileSystemUsage) MultipleInstanceAllowed added in v1.1.0

func (*ProviderFileSystemUsage) MultipleInstanceAllowed() bool

type ProviderPing

type ProviderPing struct {
	Targets    []string `json:"targets"`
	RetryCount uint     `json:"retry_count" default:"3"`
}

func (*ProviderPing) Destroy added in v1.1.0

func (*ProviderPing) Destroy()

func (*ProviderPing) GetUpdateTaskList added in v1.1.0

func (pingProvider *ProviderPing) GetUpdateTaskList(ctx context.Context, resultWrapper *ScrapeResultWrapper, storage storage.Storager) UpdateTaskList

func (*ProviderPing) MultipleInstanceAllowed

func (pingProvider *ProviderPing) MultipleInstanceAllowed() bool

type ProviderSystemd added in v1.1.0

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

func (*ProviderSystemd) Destroy added in v1.1.0

func (systemdProvider *ProviderSystemd) Destroy()

func (*ProviderSystemd) GetUpdateTaskList added in v1.1.0

func (systemdProvider *ProviderSystemd) GetUpdateTaskList(ctx context.Context, resultWrapper *ScrapeResultWrapper, storage storage.Storager) UpdateTaskList

func (*ProviderSystemd) MultipleInstanceAllowed added in v1.1.0

func (*ProviderSystemd) MultipleInstanceAllowed() bool

type ScrapeResultWrapper added in v1.1.0

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

func MakeScrapeResultWrapper added in v1.1.0

func MakeScrapeResultWrapper(prefix string, resultChan chan<- any) ScrapeResultWrapper

func (*ScrapeResultWrapper) Metric added in v1.1.0

func (wrapper *ScrapeResultWrapper) Metric(metricId, name string) MetricWrapper

type UpdateTaskList added in v1.1.0

type UpdateTaskList []func()

Jump to

Keyboard shortcuts

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