Documentation
¶
Index ¶
- Variables
- type Check
- func (c *Check) AddPerfData(pd PerfData)
- func (c *Check) Critical(msg string, vs ...interface{})
- func (c *Check) Done()
- func (c *Check) OK(msg string, vs ...interface{})
- func (c *Check) SetMessage(msg string, vs ...interface{})
- func (c *Check) String() string
- func (c *Check) Unknown(msg string, vs ...interface{})
- func (c *Check) Warning(msg string, vs ...interface{})
- type PerfData
- type Range
- type RangeCheck
- type Status
Constants ¶
This section is empty.
Variables ¶
var ( StatusOK = Status{"OK", 0} StatusWarn = Status{"WARN", 1} StatusCrit = Status{"CRIT", 2} StatusUnknown = Status{"UNKNOWN", 3} )
Nagios return status codes
Functions ¶
This section is empty.
Types ¶
type Check ¶ added in v0.2.0
Check is the core Nagios check holder
func NewCheck ¶ added in v0.2.0
func NewCheck() *Check
NewCheck initializes a new Check in an unknown state
func (*Check) AddPerfData ¶ added in v0.2.0
AddPerfData adds Nagios performance data to the check result
func (*Check) Done ¶ added in v0.2.0
func (c *Check) Done()
Done prints the output of the check and exits with the appropriate code
func (*Check) SetMessage ¶ added in v0.2.0
SetMessage sets check message (with sprintf formatting)
type PerfData ¶ added in v0.2.0
type PerfData struct { Label string Value float64 Units string Warn *Range Crit *Range Min *float64 Max *float64 }
PerfData is Nagios performance data
func NewPerfData ¶ added in v0.2.0
NewPerfData creates a simple Nagios Performance Data object with no ranges
type Range ¶
Range represents a basic Nagios range object Note: Ranges are exclusive by default, eg x < min || x > max
func ParseRange ¶
ParseRange creates a Range object from a Nagios-style Range string Ref: https://nagios-plugins.org/doc/guidelines.html#THRESHOLDFORMAT
type RangeCheck ¶ added in v0.2.0
RangeCheck is a kind of Nagios check with built-in warn/crit ranges
func NewRangeCheck ¶ added in v0.2.0
func NewRangeCheck(warn *Range, crit *Range) *RangeCheck
NewRangeCheck creates a new check with warning and critical ranges
func NewRangeCheckParse ¶ added in v0.2.0
func NewRangeCheckParse(warn string, crit string) (*RangeCheck, error)
NewRangeCheckParse creates a range check by parsing warning and critical as Nagios ranges
func (*RangeCheck) CheckValue ¶ added in v0.2.0
func (rc *RangeCheck) CheckValue(value float64)
CheckValue updates the status based on available ranges