spoolfile

package
v0.0.0-...-5afe855 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2019 License: GPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//MinFileAge is the duration to wait, before the files are parsed
	MinFileAge = time.Duration(10) * time.Second
	//IntervalToCheckDirectory the interval to check if there are new files
	IntervalToCheckDirectory = time.Duration(5) * time.Second
)

Variables

This section is empty.

Functions

func FilesInDirectoryOlderThanX

func FilesInDirectoryOlderThanX(folder string, age time.Duration) []string

FilesInDirectoryOlderThanX returns a list of file, of a folder, names which are older then a certain duration.

func IsItTime

func IsItTime(timeStamp time.Time, duration time.Duration) bool

IsItTime checks if the timestamp plus duration is in the past.

func NagiosSpoolfileWorkerGenerator

func NagiosSpoolfileWorkerGenerator(jobs chan string, results collector.ResultQueues,
	livestatusCacheBuilder *livestatus.CacheBuilder, fileBufferSize int, defaultTarget collector.Filterable) func() *NagiosSpoolfileWorker

NagiosSpoolfileWorkerGenerator generates a worker and starts it.

Types

type NagiosSpoolfileCollector

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

NagiosSpoolfileCollector scans the nagios spoolfile folder and delegates the files to its workers.

func NagiosSpoolfileCollectorFactory

func NagiosSpoolfileCollectorFactory(spoolDirectory string, workerAmount int, results collector.ResultQueues,
	livestatusCacheBuilder *livestatus.CacheBuilder, fileBufferSize int, defaultTarget collector.Filterable) *NagiosSpoolfileCollector

NagiosSpoolfileCollectorFactory creates the give amount of Woker and starts them.

func (*NagiosSpoolfileCollector) Stop

func (s *NagiosSpoolfileCollector) Stop()

Stop stops his workers and itself.

type NagiosSpoolfileWorker

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

NagiosSpoolfileWorker parses the given spoolfiles and adds the extraced perfdata to the queue.

func NewNagiosSpoolfileWorker

func NewNagiosSpoolfileWorker(workerID int, jobs chan string, results collector.ResultQueues,
	livestatusCacheBuilder *livestatus.CacheBuilder, fileBufferSize int, defaultTarget collector.Filterable) *NagiosSpoolfileWorker

NewNagiosSpoolfileWorker returns a new NagiosSpoolfileWorker.

func (*NagiosSpoolfileWorker) PerformanceDataIterator

func (w *NagiosSpoolfileWorker) PerformanceDataIterator(input map[string]string) <-chan PerformanceData

PerformanceDataIterator returns an iterator to loop over generated perf data.

func (*NagiosSpoolfileWorker) Stop

func (w *NagiosSpoolfileWorker) Stop()

Stop stops the worker

type PerformanceData

type PerformanceData struct {
	collector.Filterable
	Hostname         string
	Service          string
	Command          string
	PerformanceLabel string
	Unit             string
	Time             string
	Tags             map[string]string
	Fields           map[string]string
}

PerformanceData represents the nagios perfdata

func (PerformanceData) PrintForElasticsearch

func (p PerformanceData) PrintForElasticsearch(version, index string) string

PrintForElasticsearch prints in the elasticsearch json format

func (PerformanceData) PrintForInfluxDB

func (p PerformanceData) PrintForInfluxDB(version string) string

PrintForInfluxDB prints the data in influxdb lineformat

Jump to

Keyboard shortcuts

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