Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatLabel ¶
FormatLabel returns a sane perfdata label
All groups of invalid characters will be replaced by a single underscore.
func FormatNumeric ¶
func FormatNumeric(value interface{}) string
FormatNumeric returns a string representation of various possible numerics
This supports most internal types of Go and all fmt.Stringer interfaces.
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
Example ¶
perf := Perfdata{
Label: "test",
Value: 10.1,
Uom: "%",
Warn: &check.Threshold{Upper: 80},
Crit: &check.Threshold{Upper: 90},
Min: 0,
Max: 100}
fmt.Println(perf)
Output: test=10.1%;80;90;0;100
type PerfdataList ¶
type PerfdataList []*Perfdata
PerfdataList can store multiple perfdata and brings a simple fmt.Stringer interface
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) String ¶
func (l PerfdataList) String() string
String returns string representations of all Perfdata