snmp

package
v0.0.0-...-1fdedb9 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: BSD-3-Clause-LBNL Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthMD5    AuthProto = "MD5"
	AuthSHA    AuthProto = "SHA"
	AuthSHA256 AuthProto = "SHA256"
	AuthSHA512 AuthProto = "SHA512"

	PrivDES    PrivProto = "DES"
	PrivAES    PrivProto = "AES"
	PrivAES192 PrivProto = "AES192"
	PrivAES256 PrivProto = "AES256"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthProto

type AuthProto string

AuthProto represents SNMPv3 authentication protocol options.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps gosnmp with a simplified interface.

func New

func New(cfg Config) (*Client, error)

New creates and connects a new SNMP client.

func (*Client) Close

func (c *Client) Close()

Close releases the underlying connection.

func (*Client) Get

func (c *Client) Get(oid string) (*gosnmp.SnmpPDU, error)

Get retrieves a single OID value.

func (*Client) Walk

func (c *Client) Walk(oid string) ([]gosnmp.SnmpPDU, error)

Walk performs a BulkWalk of the given OID subtree, falling back to Walk on error.

type Config

type Config struct {
	Host    string
	Port    uint16
	Version string // "2c" or "3"
	Timeout time.Duration
	Retries int

	// v2c
	Community string

	// v3
	Username  string
	AuthProto AuthProto
	AuthPass  string
	PrivProto PrivProto
	PrivPass  string
	SecLevel  string // "noauth", "auth", "authpriv"
}

Config holds SNMP connection parameters for v2c and v3.

type PrivProto

type PrivProto string

PrivProto represents SNMPv3 privacy protocol options.

Jump to

Keyboard shortcuts

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