snmp

package
v0.0.0-...-8dae9f9 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DeviceReachableGetNextOid = "1.0"

DeviceReachableGetNextOid is used in getNext call to check if the device is reachable GETNEXT 1.0 should be able to fetch the first available SNMP OID. There is no need to handle top node other than iso(1) since it the only valid SNMP tree starting point. Other top nodes like ccitt(0) and joint(2) do not pertain to SNMP. Source: https://docstore.mik.ua/orelly/networking_2ndEd/snmp/ch02_03.htm

Variables

View Source
var ErrNoConfigGiven = errors.New("no config given for snmp_listener")

ErrNoConfigGiven is returned when the SNMP listener config was not found

Functions

This section is empty.

Types

type Config

type Config struct {
	Network                     string          `mapstructure:"network_address"`
	Port                        uint16          `mapstructure:"port"`
	Version                     string          `mapstructure:"snmp_version"`
	Timeout                     int             `mapstructure:"timeout"`
	Retries                     int             `mapstructure:"retries"`
	OidBatchSize                int             `mapstructure:"oid_batch_size"`
	Community                   string          `mapstructure:"community_string"`
	User                        string          `mapstructure:"user"`
	AuthKey                     string          `mapstructure:"authKey"`
	AuthProtocol                string          `mapstructure:"authProtocol"`
	PrivKey                     string          `mapstructure:"privKey"`
	PrivProtocol                string          `mapstructure:"privProtocol"`
	ContextEngineID             string          `mapstructure:"context_engine_id"`
	ContextName                 string          `mapstructure:"context_name"`
	IgnoredIPAddresses          map[string]bool `mapstructure:"ignored_ip_addresses"`
	ADIdentifier                string          `mapstructure:"ad_identifier"`
	Loader                      string          `mapstructure:"loader"`
	CollectDeviceMetadataConfig *bool           `mapstructure:"collect_device_metadata"`
	CollectDeviceMetadata       bool
	CollectTopologyConfig       *bool `mapstructure:"collect_topology"`
	CollectTopology             bool
	UseDeviceIDAsHostnameConfig *bool `mapstructure:"use_device_id_as_hostname"`
	UseDeviceIDAsHostname       bool
	Namespace                   string   `mapstructure:"namespace"`
	Tags                        []string `mapstructure:"tags"`
	MinCollectionInterval       uint     `mapstructure:"min_collection_interval"`

	// InterfaceConfigs is a map of IP to a list of snmpintegration.InterfaceConfig
	InterfaceConfigs map[string][]snmpintegration.InterfaceConfig `mapstructure:"interface_configs"`

	PingConfig snmpintegration.PingConfig `mapstructure:"ping"`

	// Legacy
	NetworkLegacy      string `mapstructure:"network"`
	VersionLegacy      string `mapstructure:"version"`
	CommunityLegacy    string `mapstructure:"community"`
	AuthKeyLegacy      string `mapstructure:"authentication_key"`
	AuthProtocolLegacy string `mapstructure:"authentication_protocol"`
	PrivKeyLegacy      string `mapstructure:"privacy_key"`
	PrivProtocolLegacy string `mapstructure:"privacy_protocol"`
}

Config holds configuration for a particular subnet

func (*Config) BuildSNMPParams

func (c *Config) BuildSNMPParams(deviceIP string) (*gosnmp.GoSNMP, error)

BuildSNMPParams returns a valid GoSNMP struct to start making queries

func (*Config) Digest

func (c *Config) Digest(address string) string

Digest returns an hash value representing the data stored in this configuration, minus the network address

func (*Config) IsIPIgnored

func (c *Config) IsIPIgnored(ip net.IP) bool

IsIPIgnored checks the given IP against IgnoredIPAddresses

type ListenerConfig

type ListenerConfig struct {
	Workers               int                        `mapstructure:"workers"`
	DiscoveryInterval     int                        `mapstructure:"discovery_interval"`
	AllowedFailures       int                        `mapstructure:"discovery_allowed_failures"`
	Loader                string                     `mapstructure:"loader"`
	CollectDeviceMetadata bool                       `mapstructure:"collect_device_metadata"`
	CollectTopology       bool                       `mapstructure:"collect_topology"`
	MinCollectionInterval uint                       `mapstructure:"min_collection_interval"`
	Namespace             string                     `mapstructure:"namespace"`
	UseDeviceISAsHostname bool                       `mapstructure:"use_device_id_as_hostname"`
	Configs               []Config                   `mapstructure:"configs"`
	PingConfig            snmpintegration.PingConfig `mapstructure:"ping"`

	// legacy
	AllowedFailuresLegacy int `mapstructure:"allowed_failures"`
}

ListenerConfig holds global configuration for SNMP discovery

func NewListenerConfig

func NewListenerConfig() (ListenerConfig, error)

NewListenerConfig parses configuration and returns a built ListenerConfig

Directories

Path Synopsis
Package gosnmplib provides helpers to go with gosnmp.
Package gosnmplib provides helpers to go with gosnmp.
Package snmpparse extracts SNMP configurations from agent config data.
Package snmpparse extracts SNMP configurations from agent config data.

Jump to

Keyboard shortcuts

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