snmp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InterfaceInfo

type InterfaceInfo struct {
	Index       int
	Name        string
	Description string
	Type        string
	Speed       uint64
	AdminStatus int
	OperStatus  int
	InOctets    uint64
	OutOctets   uint64
}

InterfaceInfo contains information about a network interface

type Poller

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

Poller handles SNMP polling of devices

func NewPoller

func NewPoller(community string, version int) *Poller

NewPoller creates a new SNMP poller

func (*Poller) GetLatestSNMPResult

func (p *Poller) GetLatestSNMPResult(host string, db *storage.Database) (*SNMPResult, error)

GetLatestSNMPResult retrieves the latest SNMP result for a specific host

func (*Poller) GetSNMPDevices

func (p *Poller) GetSNMPDevices(db *storage.Database) ([]string, error)

GetSNMPDevices retrieves a list of all SNMP devices from the database

func (*Poller) PollHost

func (p *Poller) PollHost(host string) (*SNMPResult, error)

PollHost polls a single host for SNMP data

func (*Poller) PollHosts

func (p *Poller) PollHosts(ctx context.Context, hosts []string, db *storage.Database)

PollHosts polls a list of hosts for SNMP data

type SNMPResult

type SNMPResult struct {
	Host        string
	SysName     string
	SysDescr    string
	SysUpTime   string
	SysContact  string
	SysLocation string
	Interfaces  []InterfaceInfo
	Timestamp   time.Time
}

SNMPResult represents data collected from an SNMP device

Jump to

Keyboard shortcuts

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