perfdata

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: GPL-2.0 Imports: 5 Imported by: 4

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Perfdata

type Perfdata struct {
	Label string
	Value interface{}
	// Uom is the unit-of-measurement, see links above for details.
	Uom  string
	Warn *check.Threshold
	Crit *check.Threshold
	Min  interface{}
	Max  interface{}
}

Perfdata represents all properties of performance data for Icinga

Implements fmt.Stringer to return the plaintext format for a plugin output.

For examples of Uom see:

https://www.monitoring-plugins.org/doc/guidelines.html#AEN201

https://github.com/Icinga/icinga2/blob/master/lib/base/perfdatavalue.cpp

https://icinga.com/docs/icinga-2/latest/doc/05-service-monitoring/#unit-of-measurement-uom

func (Perfdata) String

func (p Perfdata) String() string

String returns the proper format for the plugin output on errors (occurs with invalid data, the empty string is returned

func (Perfdata) ValidatedString added in v0.6.2

func (p Perfdata) ValidatedString() (string, error)

ValidatedString returns the proper format for the plugin output Returns an eror in some known cases where the value of a data type does not represent a valid measurement, see the explanation for "formatNumeric" for perfdata values.

type PerfdataList

type PerfdataList []*Perfdata

PerfdataList can store multiple perfdata and brings a simple fmt.Stringer interface nolint: golint, revive

Example
list := PerfdataList{}
list.Add(&Perfdata{Label: "test1", Value: 23})
list.Add(&Perfdata{Label: "test2", Value: 42})

fmt.Println(list)
Output:

test1=23 test2=42

func (*PerfdataList) Add

func (l *PerfdataList) Add(p *Perfdata)

Add adds a Perfdata pointer to the list

func (PerfdataList) String

func (l PerfdataList) String() string

String returns string representations of all Perfdata

Jump to

Keyboard shortcuts

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