Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DefaultAuth = Auth{
Community: "public",
SecurityLevel: "noAuthNoPriv",
AuthProtocol: "MD5",
PrivProtocol: "DES",
Version: 2,
}
DefaultWalkParams = WalkParams{
MaxRepetitions: 25,
Retries: &defaultRetries,
Timeout: time.Second * 5,
UseUnconnectedUDPSocket: false,
AllowNonIncreasingOIDs: false,
}
DefaultModule = Module{
WalkParams: DefaultWalkParams,
}
DefaultRegexpExtract = RegexpExtract{
Value: "$1",
}
)
View Source
var (
DoNotHideSecrets = false
)
Hack for creating snmp.yml with the secret.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
Community Secret `yaml:"community,omitempty"`
SecurityLevel string `yaml:"security_level,omitempty"`
Username string `yaml:"username,omitempty"`
Password Secret `yaml:"password,omitempty"`
AuthProtocol string `yaml:"auth_protocol,omitempty"`
PrivProtocol string `yaml:"priv_protocol,omitempty"`
PrivPassword Secret `yaml:"priv_password,omitempty"`
ContextName string `yaml:"context_name,omitempty"`
Version int `yaml:"version,omitempty"`
}
func (Auth) ConfigureSNMP ¶ added in v0.23.0
func (c Auth) ConfigureSNMP(g *gosnmp.GoSNMP, snmpContext string)
ConfigureSNMP sets the various version and auth settings.
func (*Auth) UnmarshalYAML ¶
func (c *Auth) UnmarshalYAML(unmarshal func(interface{}) error) error
type Config ¶
type Config struct {
Auths map[string]*Auth `yaml:"auths,omitempty"`
Modules map[string]*Module `yaml:"modules,omitempty"`
Version int `yaml:"version,omitempty"`
}
Config for the snmp_exporter.
type DynamicFilter ¶ added in v0.22.0
type DynamicFilter struct {
Oid string `yaml:"oid"`
Targets []string `yaml:"targets,omitempty"`
Values []string `yaml:"values,omitempty"`
}
type Filters ¶ added in v0.22.0
type Filters struct {
Static []StaticFilter `yaml:"static,omitempty"`
Dynamic []DynamicFilter `yaml:"dynamic,omitempty"`
}
type Index ¶
type Index struct {
Labelname string `yaml:"labelname"`
Type string `yaml:"type"`
FixedSize int `yaml:"fixed_size,omitempty"`
Implied bool `yaml:"implied,omitempty"`
EnumValues map[int]string `yaml:"enum_values,omitempty"`
}
type Lookup ¶
type Lookup struct {
Labels []string `yaml:"labels"`
Labelname string `yaml:"labelname"`
Oid string `yaml:"oid,omitempty"`
Type string `yaml:"type,omitempty"`
}
type Metric ¶
type Metric struct {
Name string `yaml:"name"`
Oid string `yaml:"oid"`
Type string `yaml:"type"`
Help string `yaml:"help"`
Indexes []*Index `yaml:"indexes,omitempty"`
Lookups []*Lookup `yaml:"lookups,omitempty"`
RegexpExtracts map[string][]RegexpExtract `yaml:"regex_extracts,omitempty"`
DateTimePattern string `yaml:"datetime_pattern,omitempty"`
EnumValues map[int]string `yaml:"enum_values,omitempty"`
Offset float64 `yaml:"offset,omitempty"`
Scale float64 `yaml:"scale,omitempty"`
}
type Module ¶
type Module struct {
// A list of OIDs.
Walk []string `yaml:"walk,omitempty"`
Get []string `yaml:"get,omitempty"`
Metrics []*Metric `yaml:"metrics"`
WalkParams WalkParams `yaml:",inline"`
Filters []DynamicFilter `yaml:"filters,omitempty"`
}
func (*Module) UnmarshalYAML ¶
func (c *Module) UnmarshalYAML(unmarshal func(interface{}) error) error
type Regexp ¶ added in v0.5.0
type Regexp struct {
*regexp.Regexp
}
Regexp encapsulates a regexp.Regexp and makes it YAML marshalable.
func (Regexp) MarshalYAML ¶ added in v0.5.0
func (re Regexp) MarshalYAML() (interface{}, error)
MarshalYAML implements the yaml.Marshaler interface.
func (*Regexp) UnmarshalYAML ¶ added in v0.5.0
func (re *Regexp) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type RegexpExtract ¶ added in v0.5.0
type RegexpExtract struct {
Value string `yaml:"value"`
Regex Regexp `yaml:"regex"`
}
func (*RegexpExtract) UnmarshalYAML ¶ added in v0.5.0
func (c *RegexpExtract) UnmarshalYAML(unmarshal func(interface{}) error) error
type Secret ¶ added in v0.5.0
type Secret string
Secret is a string that must not be revealed on marshaling.
func (Secret) MarshalYAML ¶ added in v0.5.0
func (s Secret) MarshalYAML() (interface{}, error)
MarshalYAML implements the yaml.Marshaler interface.
type StaticFilter ¶ added in v0.22.0
type StaticFilter struct {
Targets []string `yaml:"targets,omitempty"`
Indices []string `yaml:"indices,omitempty"`
}
type WalkParams ¶ added in v0.5.0
type WalkParams struct {
MaxRepetitions uint32 `yaml:"max_repetitions,omitempty"`
Retries *int `yaml:"retries,omitempty"`
Timeout time.Duration `yaml:"timeout,omitempty"`
UseUnconnectedUDPSocket bool `yaml:"use_unconnected_udp_socket,omitempty"`
AllowNonIncreasingOIDs bool `yaml:"allow_nonincreasing_oids,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.