gosnmplib

package
v0.0.0-...-c4caace Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MockValidReachableGetNextPacket = gosnmp.SnmpPacket{
	Variables: []gosnmp.SnmpPDU{
		{
			Name:  "1.3.6.1.2.1.1.2.0",
			Type:  gosnmp.ObjectIdentifier,
			Value: "1.3.6.1.4.1.3375.2.1.3.4.1",
		},
	},
}

MockValidReachableGetNextPacket valid reachable packet

Functions

func GetAuthProtocol

func GetAuthProtocol(authProtocolStr string) (gosnmp.SnmpV3AuthProtocol, error)

GetAuthProtocol converts auth protocol from string to type

func GetPrivProtocol

func GetPrivProtocol(privProtocolStr string) (gosnmp.SnmpV3PrivProtocol, error)

GetPrivProtocol converts priv protocol from string to type

func GetValueFromPDU

func GetValueFromPDU(pduVariable gosnmp.SnmpPDU) (string, valuestore.ResultValue, error)

GetValueFromPDU converts gosnmp.SnmpPDU to ResultValue See possible types here: https://github.com/gosnmp/gosnmp/blob/master/helper.go#L59-L271

func PacketAsString

func PacketAsString(packet *gosnmp.SnmpPacket) string

PacketAsString used to format gosnmp.SnmpPacket for debug/trace logging

func ResultToColumnValues

func ResultToColumnValues(columnOids []string, snmpPacket *gosnmp.SnmpPacket) (valuestore.ColumnResultValuesType, map[string]string)

ResultToColumnValues builds column values - ColumnResultValuesType: column values - nextOidsMap: represent the oids that can be used to retrieve following rows/values

func ResultToScalarValues

func ResultToScalarValues(result *gosnmp.SnmpPacket) valuestore.ScalarResultValuesType

ResultToScalarValues converts result to scalar values

Types

type Replacer

type Replacer struct {
	Regex *regexp.Regexp
	Repl  []byte
}

Replacer structure to store regex matching logs parts to replace

type TraceLevelLogWriter

type TraceLevelLogWriter struct{}

TraceLevelLogWriter is a log writer for gosnmp logs, it removes sensitive info

func (*TraceLevelLogWriter) Write

func (sw *TraceLevelLogWriter) Write(logInput []byte) (n int, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL