Documentation ¶
Index ¶
- Constants
- func Compact(s []string) []string
- type Alert
- type ExitCode
- type PerfData
- func NewPerfData(label string, value *PerfValue, warn, crit *Threshold, min, max int) *PerfData
- func NewScopedPerfData(label string, value *PerfValue, min, max int) *PerfData
- func NewThresholdPerfData(label string, value *PerfValue, warn, crit *Threshold) *PerfData
- func NewUndefinedPerfData(label string) *PerfData
- func NewValuePerfData(label string, value *PerfValue) *PerfData
- func ParsePerfData(s string) (*PerfData, error)
- func ParsePerfDataOutput(s string) ([]PerfData, error)
- func (d *PerfData) Critical() string
- func (d *PerfData) CriticalAlert() bool
- func (d *PerfData) Equal(o *PerfData) bool
- func (d *PerfData) Float() float64
- func (d *PerfData) Label() string
- func (d *PerfData) Max() (result int)
- func (d *PerfData) Min() (result int)
- func (d *PerfData) QuotedLabel() string
- func (d *PerfData) String() string
- func (d *PerfData) Value() string
- func (d *PerfData) Warning() string
- func (d *PerfData) WarningAlert() bool
- type PerfValue
- type Plugin
- type PluginResult
- type PluginResultDecoder
- type Threshold
- func NewGreaterThreshold(minValue float64) *Threshold
- func NewInsideThreshold(lowerLimit, upperLimit float64) *Threshold
- func NewLesserThreshold(maxValue float64) *Threshold
- func NewOutsideThreshold(lowerLimit, upperLimit float64) *Threshold
- func NewThreshold(minValue float64) *Threshold
- func ParseThreshold(s string) (*Threshold, error)
Constants ¶
const ( PerfDataOutputDelimiter = "|" PerfDataLabelDelimiter = "=" PerfDataValueDelimiter = ";" )
const (
ThresholdDelimiter = ":"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Alert ¶
Alert is a comparison functor for the given value
func GreaterEqualThan ¶
GreaterEqualThan create an alert instance acting on the given value as boundary. Any compared value must be greater than or equal to the comparison in order to pass
func GreaterThan ¶
GreaterThan create an alert instance acting on the given value as boundary. Any compared value must be greater than the comparison in order to pass
func LessEqualThan ¶
LessEqualThan create an alert instance acting on the given value as boundary. Any compared value must be less than or equal to the comparison in order to pass
type PerfData ¶
type PerfData struct {
// contains filtered or unexported fields
}
PerfData holds a single performand data metric and its context (thresholds, limits, ...)
func NewPerfData ¶
NewPerfData creates a new instance with the given performance metric, thresholds, and limits
func NewScopedPerfData ¶
NewScopedPerfData creates a new instance with the given performance metric and limits
func NewThresholdPerfData ¶
NewThresholdPerfData creates a new instance with the given performance metric and thresholds
func NewUndefinedPerfData ¶
NewUndefinedPerfData creates a new instance with the semantic of the value being undefined
func NewValuePerfData ¶
NewValuePerfData creates a new instance with the given performance metric
func ParsePerfData ¶
ParsePerfDataOutput parses the given string for a single performance metric in the Nagios PerfData format
func ParsePerfDataOutput ¶
ParsePerfDataOutput parses the given string for performance metrics in the Nagios PerfData format
func (*PerfData) CriticalAlert ¶
CriticalAlert compares the value against the critical threshold. If either of those is not available, the function returns false.
func (*PerfData) QuotedLabel ¶
QuotedLabel returns the peformance data label; quoted if it contains any spaces
func (*PerfData) String ¶
String formats the internal data using the Nagios performance data notation
func (*PerfData) Value ¶
Value returns the current peformance data value, or U if no such information is available
func (*PerfData) WarningAlert ¶
WarningAlert compares the value against the warning threshold. If either of those is not available, the function returns false.
type PerfValue ¶
PerfValue represents a performance metric value
func NewFloatValue ¶
NewFloatValue creates a new numeric performance value without any unit of measurement
func NewPercentValue ¶
NewPercentValue creates a new numeric peformance value using percent as the unit of measurement
func NewUndefinedValue ¶
func NewUndefinedValue() *PerfValue
NewUndefinedValue creates a new undefined peformance value
func NewUnitValue ¶
NewUnitValue creates a new numeric peformance value using the provided unit of measurement
func ParsePerfValue ¶
ParsePerfValue parses the given string for a performance metric value
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin represents a Nagios plugin execution definition
func NewArgumentPlugin ¶
NewArgumentPlugin creates a new plugin instance using the given command and commandline arguments
func NewPlugin ¶
NewPlugin creates a new plugin instance using the given command, commandline arguments, and environment variables. The environment variables are expected to be an array of key/value pairs, joined by =
type PluginResult ¶
type PluginResult struct { Status ExitCode Error error Output string Trailer []string PerfData []PerfData }
PluginResult contains the summary of a Nagios plugin execution
func (*PluginResult) String ¶
func (r *PluginResult) String() string
String renders the plugin result in a Nagios compatible way
type PluginResultDecoder ¶
type PluginResultDecoder struct {
// contains filtered or unexported fields
}
PluginResultDecoder is a decoder implementation for Nagios plugin output
func NewPluginResultDecoder ¶
func NewPluginResultDecoder(r io.Reader) *PluginResultDecoder
NewPluginResultDecoder creates a new decoder instance using the give reader as data source
func (*PluginResultDecoder) Decode ¶
func (d *PluginResultDecoder) Decode(result *PluginResult) error
Decode uses a scanner to drain the internal reader of any data. Processed information are fed back into the given result instance.
type Threshold ¶
type Threshold struct {
// contains filtered or unexported fields
}
Threshold is a boundary definition for peformance metrics
func NewGreaterThreshold ¶
NewGreaterThreshold creates a threshold instance, alerting on any metric greater then the given boundary
func NewInsideThreshold ¶
NewInsideThreshold creates a threshold instance, alerting on any metric inside of the given boundaries
func NewLesserThreshold ¶
NewLesserThreshold creates a threshold instance, alerting on any metric less then the given boundary
func NewOutsideThreshold ¶
NewOutsideThreshold creates a threshold instance, alerting on any metric outside of the given boundaries
func NewThreshold ¶
NewThreshold creates a threshold instance, alerting on any metric less than zero or greater then the given boundary
func ParseThreshold ¶
ParseThreshold parses the given value for alert boundaries