snmpc

package
v0.0.0-...-fc64511 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: MIT, MIT Imports: 13 Imported by: 2

Documentation

Overview

* Copyright (c) 2020. Liero AB * * 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.

Index

Constants

View Source
const (
	APP_NAME        string        = "liero-snmpc"
	Version1        SnmpVersion   = 0x0
	Version2c       SnmpVersion   = 0x1
	Version3        SnmpVersion   = 0x3
	DEFAULT_TIMEOUT time.Duration = time.Second * 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type C

type C struct {
	Community          string        `json:"community" hcl:"community,optional"`
	Version            uint8         `json:"version" hcl:"version,optional"`
	Port               uint16        `json:"port" hcl:"port,optional"`
	Timeout            znet.Duration `json:"timeout" hcl:"timeout,optional"`
	Retries            int           `json:"retries" hcl:"retries,optional"`
	MaxIterations      int           `json:"max_iterations" hcl:"max_iterations,optional"`
	MaxRepetitions     MaxReps       `json:"max_repetitions" hcl:"max_repetitions,optional"`
	NonRepeaters       int           `json:"non_repeaters" hcl:"non_repeaters,optional"`
	DynamicRepetitions bool          `json:"dynamic_repetitions" hcl:"dynamic_repetitions,optional"`
}

Configuration for SNMP

func ProtoToC

func ProtoToC(c *snmpc2.Config) C

NewPBConfigConversion creates a new configuration from protobuf config. TODO: timeout is not passed as it should

type Cache

type Cache interface {
	Pop(host string) Connection
	BulkGet(host string, oids []string, cfg C) (result *gosnmp.SnmpPacket, err error)
	Get(host string, oids []string, cfg C) (result *gosnmp.SnmpPacket, err error)
	Walk(host string, rootOid string, cfg C) (results []gosnmp.SnmpPDU, err error)
	// contains filtered or unexported methods
}

func New

func New(logger hclog.Logger) Cache

type Connection

type Connection struct {
	*gosnmp.GoSNMP

	C C
	// contains filtered or unexported fields
}

type MaxReps

type MaxReps uint8

type SnmpVersion

type SnmpVersion uint8

Jump to

Keyboard shortcuts

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