monitor

package
v10.298.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: Apache-2.0 Imports: 16 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMonitor

func NewMonitor(opts ...Options) *config.MonitorConfig

NewMonitor provides a configuration for monitors.

Types

type DockerMonitorOption

type DockerMonitorOption func(*dockermonitor.Config)

DockerMonitorOption is provided using functional arguments.

func SubOptionMonitorDockerDestroyStoppedContainers

func SubOptionMonitorDockerDestroyStoppedContainers(f bool) DockerMonitorOption

SubOptionMonitorDockerDestroyStoppedContainers sets the option to destroy stopped containers.

func SubOptionMonitorDockerExtractor

func SubOptionMonitorDockerExtractor(extractor extractors.DockerMetadataExtractor) DockerMonitorOption

SubOptionMonitorDockerExtractor provides a way to specify metadata extractor for docker.

func SubOptionMonitorDockerFlags

func SubOptionMonitorDockerFlags(syncAtStart bool) DockerMonitorOption

SubOptionMonitorDockerFlags provides a way to specify configuration flags info for docker.

func SubOptionMonitorDockerSocket

func SubOptionMonitorDockerSocket(socketType, socketAddress string) DockerMonitorOption

SubOptionMonitorDockerSocket provides a way to specify socket info for docker.

type Implementation

type Implementation interface {

	// Run starts the monitor implementation.
	Run(ctx context.Context) error

	// SetupConfig provides a configuration to implmentations. Every implmentation
	// can have its own config type.
	SetupConfig(registerer registerer.Registerer, cfg interface{}) error

	// SetupHandlers sets up handlers for monitors to invoke for various events such as
	// processing unit events and synchronization events. This will be called before Start()
	// by the consumer of the monitor
	SetupHandlers(c *config.ProcessorConfig)

	// Resync should resynchronize PUs. This should be done while starting up.
	Resync(ctx context.Context) error
}

Implementation for a monitor.

type K8smonitorOption

type K8smonitorOption func(*k8smonitor.Config)

K8smonitorOption is provided using functional arguments.

func SubOptionMonitorK8sCRIRuntimeService

func SubOptionMonitorK8sCRIRuntimeService(criRuntimeService criapi.RuntimeService) K8smonitorOption

SubOptionMonitorK8sCRIRuntimeService provides a way to pass through the CRI runtime service

func SubOptionMonitorK8sKubeconfig

func SubOptionMonitorK8sKubeconfig(kubeconfig string) K8smonitorOption

SubOptionMonitorK8sKubeconfig provides a way to specify a kubeconfig to use to connect to Kubernetes. In case of an in-cluter config, leave the kubeconfig field blank

func SubOptionMonitorK8sMetadataExtractor

func SubOptionMonitorK8sMetadataExtractor(extractor extractors.PodMetadataExtractor) K8smonitorOption

SubOptionMonitorK8sMetadataExtractor provides a way to specify metadata extractor for Kubernetes

func SubOptionMonitorK8sNodename

func SubOptionMonitorK8sNodename(nodename string) K8smonitorOption

SubOptionMonitorK8sNodename provides a way to specify the kubernetes node name. This is useful for filtering

type LinuxMonitorOption

type LinuxMonitorOption func(*linuxmonitor.Config)

LinuxMonitorOption is provided using functional arguments.

func SubOptionMonitorLinuxExtractor

func SubOptionMonitorLinuxExtractor(extractor extractors.EventMetadataExtractor) LinuxMonitorOption

SubOptionMonitorLinuxExtractor provides a way to specify metadata extractor for linux monitors.

func SubOptionMonitorLinuxRealeaseAgentPath

func SubOptionMonitorLinuxRealeaseAgentPath(releasePath string) LinuxMonitorOption

SubOptionMonitorLinuxRealeaseAgentPath specifies the path to release agent programmed in cgroup

type Monitor

type Monitor interface {

	// Start starts the monitor.
	Run(ctx context.Context) error

	// UpdateConfiguration updates the configuration of the monitor
	UpdateConfiguration(ctx context.Context, config *config.MonitorConfig) error

	// Resync requests to the monitor to do a resync.
	Resync(ctx context.Context) error
}

A Monitor is an interface implmented to start/stop monitors.

func NewMonitors

func NewMonitors(ctx context.Context, opts ...Options) (Monitor, error)

NewMonitors instantiates all/any combination of monitors supported.

type Options

type Options func(*config.MonitorConfig)

Options is provided using functional arguments.

func OptionCollector

func OptionCollector(c collector.EventCollector) Options

OptionCollector provide a way to add to the monitor the collector instance

func OptionExternalEventSenders

func OptionExternalEventSenders(evs []external.ReceiverRegistration) Options

OptionExternalEventSenders provide a way to add to the monitor the external event senders

func OptionMergeTags

func OptionMergeTags(tags []string) Options

OptionMergeTags provides a way to add merge tags to be used with New().

func OptionMonitorDocker

func OptionMonitorDocker(opts ...DockerMonitorOption) Options

OptionMonitorDocker provides a way to add a docker monitor and related configuration to be used with New().

func OptionMonitorK8s

func OptionMonitorK8s(opts ...K8smonitorOption) Options

OptionMonitorK8s provides a way to add a K8s monitor and related configuration to be used with New().

func OptionMonitorLinuxHost

func OptionMonitorLinuxHost(
	opts ...LinuxMonitorOption,
) Options

OptionMonitorLinuxHost provides a way to add a linux host monitor and related configuration to be used with New().

func OptionMonitorLinuxProcess

func OptionMonitorLinuxProcess(
	opts ...LinuxMonitorOption,
) Options

OptionMonitorLinuxProcess provides a way to add a linux process monitor and related configuration to be used with New().

func OptionPolicyResolver

func OptionPolicyResolver(p policy.Resolver) Options

OptionPolicyResolver provides a way to add to the monitor the policy resolver instance

func OptionResyncLock

func OptionResyncLock(resyncLock *sync.RWMutex) Options

OptionResyncLock provide a shared lock between monitors if the monitor desires to sync with other components during PU resync at startup

Directories

Path Synopsis
api
mockexternal
Package mockexternal is a generated GoMock package.
Package mockexternal is a generated GoMock package.
internal
cni
docker/mockdocker
Package mockdocker is a generated GoMock package.
Package mockdocker is a generated GoMock package.
k8s
pod
uid
Package mockmonitor is a generated GoMock package.
Package mockmonitor is a generated GoMock package.
mockprocessor
Package mockprocessor is a generated GoMock package.
Package mockprocessor is a generated GoMock package.
remoteapi
client/mockclient
Package mockclient is a generated GoMock package.
Package mockclient is a generated GoMock package.

Jump to

Keyboard shortcuts

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