* 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
34 lines
609 B
Go
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
|
|
|
|
}
|