snmpparse

package
v0.0.0-...-1dd94e2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package snmpparse extracts SNMP configurations from agent config data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDefault

func SetDefault(sc *SNMPConfig)

SetDefault sets the standard default config values

Types

type SNMPConfig

type SNMPConfig struct {

	//General
	IPAddress string `yaml:"ip_address"`
	Port      uint16 `yaml:"port"`
	Version   string `yaml:"snmp_version"`
	Timeout   int    `yaml:"timeout"`
	Retries   int    `yaml:"retries"`
	//v1 &2
	CommunityString string `yaml:"community_string"`
	//v3
	Username     string `yaml:"user"`
	AuthProtocol string `yaml:"authProtocol"`
	AuthKey      string `yaml:"authKey"`
	PrivProtocol string `yaml:"privProtocol"`
	PrivKey      string `yaml:"privKey"`
	Context      string `yaml:"context_name"`
	//network
	NetAddress string `yaml:"network_address"`
}

SNMPConfig is a generic container for configuration data specific to the SNMP integration.

func GetConfigCheckSnmp

func GetConfigCheckSnmp(conf config.Component) ([]SNMPConfig, error)

GetConfigCheckSnmp returns each SNMPConfig for all running config checks, by querying the local agent. If the agent isn't running or is unreachable, this will fail.

func GetIPConfig

func GetIPConfig(ipAddress string, SnmpConfigList []SNMPConfig) SNMPConfig

GetIPConfig finds the SNMPConfig for a specific IP address. If the IP is explicitly configured, that will be returned; if it isn't, but it is part of a configured subnet, then the subnet config will be returned. If there are no matches, this will return an empty SNMPConfig.

func ParseConfigSnmp

func ParseConfigSnmp(c integration.Config) []SNMPConfig

ParseConfigSnmp extracts all SNMPConfigs from an autodiscovery config. Any loading errors are logged but not returned.

Jump to

Keyboard shortcuts

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