gosnmpquerier

package module
v0.0.0-...-de62dea Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: MIT Imports: 8 Imported by: 8

README

gosnmpquerier

CI Coverage Status GoDoc License

Scalable SNMP querier library

Features

  • Asynchronous and Synchronous scalable snmpquerier
  • Support for Walk/Get/GetNext snmp queries
  • Maximum number of concurrent snmp queries for each device/host (Contention).
  • Circuit Breaker pattern for each device/host connection
  • Back preasure control for each device/host incomming queries
  • Back preasure control for global incomming queries

Unimplemented features / TODO

  • Contention level configured for each device/host
  • Back preasure configuration
  • Set snmp command

Testing

$ make test

Documentation

Index

Constants

View Source
const (
	GLOBAL_QUEUE_SIZE      = 1024
	DESTINATION_QUEUE_SIZE = 1024
)
View Source
const (
	GET = iota + 1
	GETNEXT
	WALK
)
View Source
const (
	QUERIER_TIMEOUT = 2 * time.Second
)

Variables

This section is empty.

Functions

func NewSyncQuerier

func NewSyncQuerier(contention, numErrors int, resetTime time.Duration) *syncQuerier

func ToJson

func ToJson(query *Query) (string, error)

Types

type AsyncQuerier

type AsyncQuerier struct {
	Input      chan Query
	Output     chan Query
	Contention int
	// contains filtered or unexported fields
}

func NewAsyncQuerier

func NewAsyncQuerier(contention int, numErrors int, resetTime time.Duration) *AsyncQuerier

type GoSnmpClient

type GoSnmpClient struct{}

type OpSnmp

type OpSnmp int32

func ConvertCommand

func ConvertCommand(command string) (OpSnmp, error)

type Query

type Query struct {
	Id          int
	Cmd         OpSnmp
	Community   string
	Oids        []string
	Timeout     time.Duration
	Retries     int
	Destination string
	Response    []gosnmp.SnmpPDU
	Error       error
}

func FromJson

func FromJson(jsonText string) (*Query, error)

type QueryWithOutputChannel

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

type SnmpClient

type SnmpClient interface {
	// contains filtered or unexported methods
}

type SyncQuerier

type SyncQuerier interface {
	ExecuteQuery(query Query) Query
	Get(destination, community string, oids []string, timeout time.Duration, retries int) ([]gosnmp.SnmpPDU, error)
	GetNext(destination, community string, oids []string, timeout time.Duration, retries int) ([]gosnmp.SnmpPDU, error)
	Walk(destination, community, oid string, timeout time.Duration, retries int) ([]gosnmp.SnmpPDU, error)
}

Directories

Path Synopsis
examples
amqpsnmpqueries command
get command
snmphttpserver command
snmpqueries command
walk command

Jump to

Keyboard shortcuts

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