gosnmpquerier

package module
Version: v0.0.0-...-0b27357 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: MIT Imports: 8 Imported by: 0

README

GoSNMPQuerier

Build Status Coverage Status

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

Installation

$ go get github.com/aleasoluciones/gosnmpquerier

Add it to your code:

import "github.com/aleasoluciones/gosnmpquerier"

Testing

$ make test

##License (The MIT License)

Copyright (c) 2014 Alea Soluciones SLL

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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
get

Jump to

Keyboard shortcuts

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