perfdata.go
func NewPerfDatum(label string, unit string, value float64, thresholds ...float64) (*PerfDatum, error) {
	datum := new(PerfDatum)
	datum.label = label
	datum.value = value
	datum.unit = unit
	if !validUnit(unit) {
		return nil, fmt.Errorf("Invalid unit %v", unit)
	}
	if math.IsInf(value, 0) || math.IsNaN(value) {
		return nil, fmt.Errorf("Perfdata value may not be infinity or NaN: %v.", value)
	}
	if len(thresholds) >= 1 {
		datum.min = &thresholds[0]
	}
	if len(thresholds) >= 2 {
		datum.max = &thresholds[1]
	}
	if len(thresholds) >= 3 {
		datum.warn = &thresholds[2]
	}
	if len(thresholds) >= 4 {
		datum.crit = &thresholds[3]
	}
	return datum, nil
}
func NewPerfDatum(label string, unit string, value float64, thresholds ...float64) (*PerfDatum, error) {
	datum := new(PerfDatum)
	datum.label = label
	datum.value = value
	datum.unit = unit
	if !validUnit(unit) {
		return nil, fmt.Errorf("Invalid unit %v", unit)
	}
	if math.IsInf(value, 0) || math.IsNaN(value) {
		return nil, fmt.Errorf("Perfdata value may not be infinity or NaN: %v.", value)
	}
	if len(thresholds) >= 1 {
		datum.min = &thresholds[0]
	}
	if len(thresholds) >= 2 {
		datum.max = &thresholds[1]
	}
	if len(thresholds) >= 3 {
		datum.warn = &thresholds[2]
	}
	if len(thresholds) >= 4 {
		datum.crit = &thresholds[3]
	}
	return datum, nil
}
// NewPerfDatum returns a PerfDatum object suitable to use in a check
// result. unit must a valid Nagios unit, i.e., one of "us", "ms", "s",
// "%", "b", "kb", "mb", "gb", "tb", "c", or the empty string.
//
// Zero to four thresholds may be supplied: min, max, warn and crit.
// Thresholds may be positive infinity, negative infinity, or NaN, in
// which case they will be omitted in check output.