snmp_exporter

package
v1.5.0 Latest Latest
Warning

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

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

Documentation

Overview

Package snmp_exporter embeds https://github.com/prometheus/snmp_exporter

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	WalkParams:     make(map[string]snmp_config.WalkParams),
	SnmpConfigFile: "",
	SnmpTargets:    make([]SNMPTarget, 0),
	SnmpConfig:     snmp_config.Config{},
}

DefaultConfig holds the default settings for the snmp_exporter integration.

Functions

func Handler

func Handler(w http.ResponseWriter, r *http.Request, logger log.Logger, snmpCfg *snmp_config.Config,
	targets []SNMPTarget, wParams map[string]snmp_config.WalkParams)

func LoadSNMPConfig

func LoadSNMPConfig(snmpConfigFile string, snmpCfg *snmp_config.Config) (*snmp_config.Config, error)

LoadSNMPConfig loads the SNMP configuration from the given file. If the file is empty, it will load the embedded configuration.

func New

New creates a new snmp_exporter integration

func NewSNMPMetrics

func NewSNMPMetrics(reg prometheus.Registerer) collector.Metrics

Types

type Config

type Config struct {
	WalkParams     map[string]snmp_config.WalkParams `yaml:"walk_params,omitempty"`
	SnmpConfigFile string                            `yaml:"config_file,omitempty"`
	SnmpTargets    []SNMPTarget                      `yaml:"snmp_targets"`
	SnmpConfig     snmp_config.Config                `yaml:"snmp_config,omitempty"`
}

Config configures the SNMP integration.

func (*Config) InstanceKey

func (c *Config) InstanceKey(agentKey string) (string, error)

InstanceKey returns the hostname:port of the agent.

func (*Config) Name

func (c *Config) Name() string

Name returns the name of the integration.

func (*Config) NewIntegration

func (c *Config) NewIntegration(l log.Logger) (integrations.Integration, error)

NewIntegration creates a new SNMP integration.

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler for Config.

type Integration

type Integration struct {
	// contains filtered or unexported fields
}

Integration is the SNMP integration. The integration scrapes metrics from the host Linux-based system.

func (*Integration) MetricsHandler

func (i *Integration) MetricsHandler() (http.Handler, error)

MetricsHandler implements Integration.

func (*Integration) Run

func (i *Integration) Run(ctx context.Context) error

Run satisfies Integration.Run.

func (*Integration) ScrapeConfigs

func (i *Integration) ScrapeConfigs() []config.ScrapeConfig

ScrapeConfigs satisfies Integration.ScrapeConfigs.

type SNMPTarget

type SNMPTarget struct {
	Name        string `yaml:"name"`
	Target      string `yaml:"address"`
	Module      string `yaml:"module"`
	Auth        string `yaml:"auth"`
	WalkParams  string `yaml:"walk_params,omitempty"`
	SNMPContext string `yaml:"snmp_context,omitempty"`
	Labels      map[string]string
}

SNMPTarget defines a target device to be used by the integration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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