Documentation ¶
Index ¶
- Constants
- Variables
- func ContainsAny(s string, substrs ...string) bool
- func DoWalk(device string, baseOid string, format string, conf *kt.SnmpConfig, ...) error
- func EngineID(bv []byte) (int64, string, map[string]string)
- func GetDeviceManufacturer(server snmpWalker, log logger.ContextL) string
- func GetFromConv(pdu gosnmp.SnmpPDU, conv string, log logger.ContextL) (int64, string, map[string]string)
- func GetIndex(value, prefix string) string
- func InitSNMP(device *kt.SnmpDeviceConfig, connectTimeout time.Duration, retries int, ...) (*gosnmp.GoSNMP, error)
- func LoadFile(ctx context.Context, file string) ([]byte, error)
- func ParseV3Config(v3config *kt.V3SNMPConfig) (*gosnmp.UsmSecurityParameters, gosnmp.SnmpV3MsgFlags, string, string, error)
- func PrettyPrint(pdu gosnmp.SnmpPDU, format string, log logger.ContextL) string
- func ReadOctetString(variable gosnmp.SnmpPDU, truncate bool) (string, bool)
- func ToInt64(val interface{}) int64
- func TouchFile(path string) error
- func WalkOID(ctx context.Context, device *kt.SnmpDeviceConfig, oid string, ...) ([]gosnmp.SnmpPDU, error)
- func WriteFile(ctx context.Context, file string, payload []byte, perms fs.FileMode) error
Constants ¶
View Source
const ( SNMP_PORT = uint16(161) MAX_CONNECT_TRY = 10 )
View Source
const ( CONV_HWADDR = "hwaddr" CONV_POWERSET = "powerset_status" CONV_HEXTOINT = "hextoint" CONV_HEXTOIP = "hextoip" CONV_ENGINE_ID = "engine_id" CONV_REGEXP = "regexp" CONV_ONE = "to_one" ConstantOidPrefix = "1.3.6.1.6.3.1135.6169." ConstantOidMetricPrefix = ".1.3.6.1.6.3.1136.6169." )
Variables ¶
View Source
var ( SNMP_POLL_SLEEP_TIME = 10 * time.Second // Device Manufacturer aka sysDescr SNMP_DEVICE_MANUFACTURER_OID = "1.3.6.1.2.1.1.1" )
View Source
var ( TRUNCATE = true NO_TRUNCATE = false MAX_SNMP_LEN = 128 )
Functions ¶
func ContainsAny ¶
func DoWalk ¶
func DoWalk(device string, baseOid string, format string, conf *kt.SnmpConfig, connectTimeout time.Duration, retries int, log logger.ContextL) error
Does a walk of the targeted device and exits.
func GetDeviceManufacturer ¶
func GetFromConv ¶
func GetFromConv(pdu gosnmp.SnmpPDU, conv string, log logger.ContextL) (int64, string, map[string]string)
Handle the case of wierd ints encoded as byte arrays.
func GetIndex ¶
getIndex returns the rest of value after prefix, e.g. for 1.2.3.4.5.6 and 2.3.4, returns .5.6 Modeled on getIndex in topology-demo/devicemetrics/main.go. Prefix must occur in value, otherwise results are undefined (aka "wrong").
func ParseV3Config ¶
func ParseV3Config(v3config *kt.V3SNMPConfig) (*gosnmp.UsmSecurityParameters, gosnmp.SnmpV3MsgFlags, string, string, error)
func ToInt64 ¶
func ToInt64(val interface{}) int64
toInt64 converts most of the numeric types in Go (and *all* the numeric types I expect to see from snmp) to int64.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.