config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultModule = Module{
		Version:        2,
		MaxRepititions: 25,
		Retries:        3,
		Timeout:        time.Second * 20,
	}
	DefaultAuth = Auth{
		Community:     "public",
		SecurityLevel: "noAuthNoPriv",
		AuthProtocol:  "MD5",
		PrivProtocol:  "DES",
	}
)

Functions

func CheckOverflow

func CheckOverflow(m map[string]interface{}, ctx string) error

Types

type Auth

type Auth struct {
	Community     string `yaml:"community,omitempty"`
	SecurityLevel string `yaml:"security_level,omitempty"`
	Username      string `yaml:"username,omitempty"`
	Password      string `yaml:"password,omitempty"`
	AuthProtocol  string `yaml:"auth_protocol,omitempty"`
	PrivProtocol  string `yaml:"priv_protocol,omitempty"`
	PrivPassword  string `yaml:"priv_password,omitempty"`

	XXX map[string]interface{} `yaml:",inline"`
}

func (*Auth) UnmarshalYAML

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

type Config

type Config map[string]*Module

Config for the snmp_exporter.

func LoadFile

func LoadFile(filename string) (*Config, error)

type Index

type Index struct {
	Labelname string `yaml:"labelname"`
	Type      string `yaml:"type"`

	XXX map[string]interface{} `yaml:",inline"`
}

func (*Index) UnmarshalYAML

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

type Lookup

type Lookup struct {
	Labels    []string `yaml:"labels"`
	Labelname string   `yaml:"labelname"`
	Oid       string   `yaml:"oid"`
	Type      string   `yaml:"type"`

	XXX map[string]interface{} `yaml:",inline"`
}

func (*Lookup) UnmarshalYAML

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

type Metric

type Metric struct {
	Name    string    `yaml:"name"`
	Oid     string    `yaml:"oid"`
	Type    string    `yaml:"type"`
	Indexes []*Index  `yaml:"indexes,omitempty"`
	Lookups []*Lookup `yaml:"lookups,omitempty"`

	XXX map[string]interface{} `yaml:",inline"`
}

func (*Metric) UnmarshalYAML

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

type Module

type Module struct {
	// A list of OIDs.
	Walk    []string  `yaml:"walk"`
	Metrics []*Metric `yaml:"metrics"`

	Version        int           `yaml:"version,omitempty"`
	MaxRepititions uint8         `yaml:"max_repititions,omitempty"`
	Retries        int           `yaml:"retries,omitempty"`
	Timeout        time.Duration `yaml:"timeout,omitempty"`
	Auth           *Auth         `yaml:"auth,omitempty"`

	XXX map[string]interface{} `yaml:",inline"`
}

func (Module) ConfigureSNMP

func (c Module) ConfigureSNMP(g *gosnmp.GoSNMP)

configureSNMP sets the various version and auth settings.

func (*Module) UnmarshalYAML

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

Jump to

Keyboard shortcuts

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