Documentation
¶
Index ¶
Constants ¶
const ( KibiByte uint64 = 1024 MebiByte = 1024 * KibiByte GibiByte = 1024 * MebiByte TebiByte = 1024 * GibiByte )
Variables ¶
var (
ErrThresholdInvalid = errors.New("threshold invalid")
)
Functions ¶
func ParseThreshold ¶
ParseThreshold returns the parsed unit(UOM) from threshold
Total = 100MB; Threshold = 10% => 10MB Total = 100MB; Threshold = 30MB => 30MB Viable units are: kb, kib, mb, mib, gb, gib, tb, tib, %
func ThresholdFree ¶
ThresholdFree returns the threshold level relative to the total.
10% free from 100MB = 90MB used 15MB free from 100MB = 85MB used
Types ¶
type Metric ¶
Metric allows to check a metric for levels specified by its thresholds.
Is currently implemented for byte values in IEC - which is what Nagios plugins use.
func (*Metric) Perfdata ¶
Perfdata returns a perfdata.Perfdata object for output with a plugin.
Values are scaled down to MB, so they are more readable. And we won't need that much precision.
func (*Metric) SetCritical ¶
SetCritical parses critical level for free OR used and remembers the absolute value.
Used: Total 100 MB; Threshold 90% => If 90 MB used. Returns critical
Free: Total 100MB; Threshold 90% => If 10 MB free. Returns critical
func (*Metric) SetWarning ¶
SetWarning parses warning level for free OR used and remembers the absolute value.
Used: Total 100 MB; Threshold 80% => If 80 MB used. Returns warning
Free: Total 100MB; Threshold 80% => If 20 MB free. Returns warning
func (*Metric) Status ¶
Status returns the Icinga status in perspective to the current value and thresholds.
Free: Value <= Warning will result in warning state Value <= Critical will result in critical state
Used: Value >= Warning will result in warning state Value >= Critical will result in critical state