More features (#9)
* added config file implementation, refactoring * add gitignore * improved test * preperations for more metrics * added resource metrics * added first bgp metrics * added asn as label for bgp metrics * added prefix and message counts to bgp metrics * simplified * Update README.md * added yaml dependency * fixed go routine call * added timeout * clean up * added TLS support * set default api port for TLS * added routes metric * added missing log information * added type collectorContext to reduce the count of parameters for better readability * added DHCP and DHCPv6 metrics * filter for active dhcp leases only * added pool metrics * enable/disable feature in config file * refactoring * clean up * comment fix
This commit is contained in:
committed by
Steve Brunton
parent
f2866a3a2f
commit
d170b0a4d2
@@ -7,10 +7,19 @@ import (
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
// Config represents the configuration for the exporter
|
||||
type Config struct {
|
||||
Devices []Device `yaml:"devices"`
|
||||
Devices []Device `yaml:"devices"`
|
||||
Features struct {
|
||||
BGP bool `yaml:"bgp,omitempty"`
|
||||
DHCP bool `yaml:"dhcp,omitempty"`
|
||||
DHCPv6 bool `yaml:"dhcpv6,omitempty"`
|
||||
Routes bool `yaml:"routes,omitempty"`
|
||||
Pools bool `yaml:"pools,omitempty"`
|
||||
} `yaml:"features,omitempty"`
|
||||
}
|
||||
|
||||
// Device represents a target device
|
||||
type Device struct {
|
||||
Name string `yaml:"name"`
|
||||
Address string `yaml:"address"`
|
||||
@@ -18,6 +27,7 @@ type Device struct {
|
||||
Password string `yaml:"password"`
|
||||
}
|
||||
|
||||
// Load reads YAML from reader and unmashals in Config
|
||||
func Load(r io.Reader) (*Config, error) {
|
||||
b, err := ioutil.ReadAll(r)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user