collector

package
v0.0.0-...-d251121 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 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 ICollector

type ICollector interface {
	Name() string
	Settings() Settings
	Scan(context.Context) error
	StartLoop(context.Context, time.Duration)
	Describe(ch chan<- *prometheus.Desc)
	Collect(ch chan<- prometheus.Metric)
}

ICollector defines the interface that need to be implemented by each collector

type Settings

type Settings struct {
	ClientConcurrency int64
	LoopInterval      time.Duration
}

Settings defines the required collector settings

type TrivyCollector

type TrivyCollector struct {
	Vulnerabilities    *prometheus.GaugeVec
	VulnerabilitiesSum *prometheus.GaugeVec
	// contains filtered or unexported fields
}

TrivyCollector defines the trivy collector instance

func NewTrivyCollector

func NewTrivyCollector(
	trivyClient client.TrivyClient,
	settings Settings,
	logger *logrus.Logger,
) *TrivyCollector

NewTrivyCollector creates a new collector instance

func (*TrivyCollector) Collect

func (c *TrivyCollector) Collect(ch chan<- prometheus.Metric)

Collect implements the prometheus colletor interface method

func (*TrivyCollector) Describe

func (c *TrivyCollector) Describe(ch chan<- *prometheus.Desc)

Describe implements the prometheus colletor interface method

func (*TrivyCollector) Name

func (c *TrivyCollector) Name() string

Name returns the collectors friendly name

func (*TrivyCollector) Scan

func (c *TrivyCollector) Scan(ctx context.Context) error

Scan checks the discovered docker images in parallel and maps the results to prometheus metrics

func (*TrivyCollector) Settings

func (c *TrivyCollector) Settings() Settings

Settings returns the collectors settings

func (*TrivyCollector) StartLoop

func (c *TrivyCollector) StartLoop(ctx context.Context, interval time.Duration)

StartLoop re-schedules the next collectors run depending on the configured interval

Jump to

Keyboard shortcuts

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