Files
mikrotik-exporter/collector/config.go
Steve Brunton be3ca4608c update logging (#5)
* removed Zap logging and switched to logrus
* "deprecating" the prometheus.go file and fixed up logging stuff on a couple more files.
* removed uber zap from glide
* well that sure messed things up
2017-11-29 22:42:59 -05:00

34 lines
609 B
Go

package collector
import (
"fmt"
"github.com/prometheus/client_golang/prometheus"
)
type Config struct {
Devices []Device
}
func (c *Config) FromFlags(device, address, user, password *string) error {
if *device == "" || *address == "" || *user == "" || *password == "" {
return fmt.Errorf("missing required param for single device configuration")
}
d := &Device{
address: *address,
name: *device,
user: *user,
password: *password,
iDesc: map[string]*prometheus.Desc{},
rDesc: map[string]*prometheus.Desc{},
}
*c = Config{
Devices: []Device{*d},
}
return nil
}