diff --git a/collector/collector.go b/collector/collector.go index 25bdcf50..c9b9abf0 100644 --- a/collector/collector.go +++ b/collector/collector.go @@ -168,7 +168,7 @@ func ScrapeTarget(ctx context.Context, target string, config *config.Module, log // evaluate rules newGet := config.Get newWalk := config.Walk - for _, filter := range config.Filters{ + for _, filter := range config.Filters { var pdus []gosnmp.SnmpPDU allowedList := []string{} diff --git a/config/config.go b/config/config.go index 5d3a90bc..06bd7d09 100644 --- a/config/config.go +++ b/config/config.go @@ -73,11 +73,11 @@ type WalkParams struct { 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"` + Walk []string `yaml:"walk,omitempty"` + Get []string `yaml:"get,omitempty"` + Metrics []*Metric `yaml:"metrics"` + WalkParams WalkParams `yaml:",inline"` + Filters []DynamicFilter `yaml:"filters,omitempty"` } func (c *Module) UnmarshalYAML(unmarshal func(interface{}) error) error { @@ -189,18 +189,18 @@ func (c WalkParams) ConfigureSNMP(g *gosnmp.GoSNMP) { } type Filters struct { - Static []StaticFilter `yaml:"static,omitempty"` + Static []StaticFilter `yaml:"static,omitempty"` Dynamic []DynamicFilter `yaml:"dynamic,omitempty"` } type StaticFilter struct { - Targets []string `yaml:"targets,omitempty"` + Targets []string `yaml:"targets,omitempty"` Instances []string `yaml:"instances,omitempty"` } type DynamicFilter struct { - Oid string `yaml:"oid"` + Oid string `yaml:"oid"` Targets []string `yaml:"targets,omitempty"` - Values []string `yaml:"values,omitempty"` + Values []string `yaml:"values,omitempty"` } type Metric struct { diff --git a/generator/config.go b/generator/config.go index 1661b416..1833126d 100644 --- a/generator/config.go +++ b/generator/config.go @@ -50,7 +50,7 @@ type ModuleConfig struct { Lookups []*Lookup `yaml:"lookups"` WalkParams config.WalkParams `yaml:",inline"` Overrides map[string]MetricOverrides `yaml:"overrides"` - Filters config.Filters `yaml:"filters,omitempty"` + Filters config.Filters `yaml:"filters,omitempty"` } type Lookup struct { diff --git a/generator/tree.go b/generator/tree.go index 7799ac5b..97b37a6b 100644 --- a/generator/tree.go +++ b/generator/tree.go @@ -379,7 +379,7 @@ func generateConfigModule(cfg *ModuleConfig, node *Node, nameToNode map[string]* // Build an map of all oid targeted by a filter to access it easily later filterMap := map[string][]string{} - for _, filter := range cfg.Filters.Static{ + for _, filter := range cfg.Filters.Static { for _, oid := range filter.Targets { n, ok := nameToNode[oid] if ok {