Documentation ¶
Overview ¶
Package snmpvar maps SNMP variables to float64 values.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Div = func(divisor float64) Float64 { return func(v snmpgo.Variable) (float64, error) { if i, ok := v.(*snmpgo.Integer); ok { return float64(i.Value) / divisor, nil } return 0, fmt.Errorf("unexpected non-integer SNMP variable type %s", v.Type()) } }
Div divides SNMP values by a divisor.
View Source
var Ident = func(v snmpgo.Variable) (float64, error) { if i, ok := v.(*snmpgo.Integer); ok { return float64(i.Value), nil } return 0, fmt.Errorf("unexpected non-integer SNMP variable type %s", v.Type()) }
Ident is an identify function that returns SNMP values as a float64.
View Source
var Match = func(set ...int) Float64 { m := make(map[int]struct{}, len(set)) for _, element := range set { m[element] = struct{}{} } return func(v snmpgo.Variable) (float64, error) { if i, ok := v.(*snmpgo.Integer); ok { var value float64 if _, found := m[int(i.Value)]; found { value = 1 } return value, nil } return 0, fmt.Errorf("unexpected non-integer SNMP variable type %s", v.Type()) } }
Match returns 1 if an SNMP value matches an element of the given set.
View Source
var Mul = func(multiplier float64) Float64 { return func(v snmpgo.Variable) (float64, error) { if i, ok := v.(*snmpgo.Integer); ok { return float64(i.Value) * multiplier, nil } return 0, fmt.Errorf("unexpected non-integer SNMP variable type %s", v.Type()) } }
Mul multiplies SNMP values by a multiplier.
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.