snmp

package
v8.0.8 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VendorMikrotik = "14988"
	VendorH3C      = "25506"
	VendorHuawei   = "2011"
	VendorRuijie   = "4881"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceIfOctets

type DeviceIfOctets struct {
	Name      string `json:"name"`
	Index     int64  `json:"-"`
	Type      int64  `json:"-"`
	InOctets  int64  `json:"in_octets"`
	OutOctets int64  `json:"out_octets"`
}

type SnmpAuth

type SnmpAuth struct {
	Ipaddr    string
	Port      int
	Community string
}

type SnmpDevice

type SnmpDevice struct {
	SnmpAuth
	ShopId        int64
	ShopName      string
	VendorName    string
	VendorCode    string
	SoftwareIdOid string
	SoftwareId    string
	SnOid         string
	UseSnOid      bool
	Sn            string
	SystemNameOid string
	SystemName    string
	ModelOid      string
	Model         string
	CpuLoad       float64
	UptimeOid     string
	Uptime        int64
	MemTotal      int64
	MemUsage      int64
	MemPercent    float64
	DiskUsage     int64
	DiskTotal     int64
	DiskPercent   float64
	IfOctetsMap   map[int64]*DeviceIfOctets
}

func NewH3CDevice

func NewH3CDevice() *SnmpDevice

func NewHuaweiDevice

func NewHuaweiDevice() *SnmpDevice

func NewMikrotikDevice

func NewMikrotikDevice() *SnmpDevice

func NewRuijieDevice

func NewRuijieDevice() *SnmpDevice

func (*SnmpDevice) IfaceDocments

func (dev *SnmpDevice) IfaceDocments() ([]map[string]interface{}, error)

func (*SnmpDevice) SnmpDocment

func (dev *SnmpDevice) SnmpDocment() (map[string]interface{}, error)

func (*SnmpDevice) ToJson

func (dev *SnmpDevice) ToJson() string

type SnmpV2Client

type SnmpV2Client struct {
	Snmpc *gosnmp.GoSNMP
}

func NewSnmpV2Client

func NewSnmpV2Client(target string, port int, community string) (*SnmpV2Client, error)

func NewSnmpV2Client2

func NewSnmpV2Client2(auth SnmpAuth) (*SnmpV2Client, error)

func (*SnmpV2Client) BulkWalkAll

func (c *SnmpV2Client) BulkWalkAll(oid string) (map[string]SnmpValue, error)

func (*SnmpV2Client) Close

func (c *SnmpV2Client) Close() error

Close the connection

func (*SnmpV2Client) CollectDevice

func (c *SnmpV2Client) CollectDevice(device *SnmpDevice) error

CollectDevice 采集设备信息

func (*SnmpV2Client) CollectDeviceSystemInfo

func (c *SnmpV2Client) CollectDeviceSystemInfo(device *SnmpDevice) (err error)

CollectDeviceSystemInfo 采集设备系统信息

func (*SnmpV2Client) CollectIfOctets

func (c *SnmpV2Client) CollectIfOctets(device *SnmpDevice) (err error)

func (*SnmpV2Client) CollectOids

func (c *SnmpV2Client) CollectOids(oids []string) (map[string]SnmpValue, error)

CollectOids 批量采集OID

type SnmpValue

type SnmpValue gosnmp.SnmpPDU

func (SnmpValue) Int64Value

func (v SnmpValue) Int64Value() int64

func (SnmpValue) IpAddress

func (v SnmpValue) IpAddress() net.IP

func (SnmpValue) IsOid

func (v SnmpValue) IsOid(oprefix string) bool

func (SnmpValue) MacAddr

func (v SnmpValue) MacAddr() net.HardwareAddr

func (SnmpValue) String

func (v SnmpValue) String() string

func (SnmpValue) StringValue

func (v SnmpValue) StringValue() string

Directories

Path Synopsis
mibs

Jump to

Keyboard shortcuts

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