lssnmp

package
v0.0.0-...-a24e936 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Snmp

type Snmp struct {
	Host    string
	Oid     string
	Version string
	CommStr string
	Port    int
	Timeout int
	Retries int
}

Snmp is wrapped some convinince SNMP interface for SNMP operation

func (*Snmp) Get

func (s *Snmp) Get(oid string) (string, error)

Get to get a SNMP value by oid string

func (*Snmp) GetMultiple

func (s *Snmp) GetMultiple(oids []string) (map[string]string, error)

GetMultiple to get SNMP values by oid slice

func (*Snmp) MultiSet

func (s *Snmp) MultiSet(toset map[string]interface{}) (map[string]interface{}, error)

MultiSet use wsnmp to do multi set

toset := make(map[string]interface{})
toset[oid1]="abc"
toset[oid2]=1
ret, err := MultiSet1(toset)

func (*Snmp) Set

func (s *Snmp) Set(oid string, value interface{}) (interface{}, error)

Set use wapsnmp to do snmp set

func (*Snmp) SortWalk

func (s *Snmp) SortWalk(oid string) (SortedWalkSlice, error)

SortWalk snmp walk function return with a sorted result slice

func (*Snmp) Walk

func (s *Snmp) Walk(oid string) (map[string]string, error)

Walk to get do snmp walk

type SortedWalkSlice

type SortedWalkSlice []WalkResult

SortedWalkSlice sorted slice by WalkResult.Oid

func (SortedWalkSlice) Len

func (s SortedWalkSlice) Len() int

func (SortedWalkSlice) Less

func (s SortedWalkSlice) Less(i, j int) bool

func (SortedWalkSlice) Swap

func (s SortedWalkSlice) Swap(i, j int)

type WalkResult

type WalkResult struct {
	Oid   string
	Value string
}

WalkResult to stroe walk result with key-value pair in struct

Jump to

Keyboard shortcuts

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