snmp

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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
	UseDeviceIDAsHostnameConfig *bool `mapstructure:"use_device_id_as_hostname"`
	UseDeviceIDAsHostname       bool
	Namespace                   string   `mapstructure:"namespace"`
	Tags                        []string `mapstructure:"tags"`
	MinCollectionInterval       uint     `mapstructure:"min_collection_interval"`

	// 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"`
	MinCollectionInterval uint     `mapstructure:"min_collection_interval"`
	Namespace             string   `mapstructure:"namespace"`
	UseDeviceISAsHostname bool     `mapstructure:"use_device_id_as_hostname"`
	Configs               []Config `mapstructure:"configs"`

	// 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

Jump to

Keyboard shortcuts

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