Replace --collectors.enabled with per-collector flags (#640)

* Move NodeCollector into package collector

* Refactor collector enabling

* Update README with new collector enabled flags

* Fix out-of-date inline flag reference syntax

* Use new flags in end-to-end tests

* Add flag to disable all default collectors

* Track if a flag has been set explicitly

* Add --collectors.disable-defaults to README

* Revert disable-defaults flag

* Shorten flags

* Fixup timex collector registration

* Fix end-to-end tests

* Change procfs and sysfs path flags

* Fix review comments
This commit is contained in:
Calle Pettersson 2017-09-28 15:06:26 +02:00 committed by Johannes 'fish' Ziemke
commit 859a825bb8
58 changed files with 410 additions and 406 deletions

View file

@ -47,7 +47,7 @@ type mdStatus struct {
type mdadmCollector struct{}
func init() {
Factories["mdadm"] = NewMdadmCollector
registerCollector("mdadm", defaultEnabled, NewMdadmCollector)
}
func evalStatusline(statusline string) (active, total, size int64, err error) {
@ -220,35 +220,35 @@ func NewMdadmCollector() (Collector, error) {
var (
isActiveDesc = prometheus.NewDesc(
prometheus.BuildFQName(Namespace, "md", "is_active"),
prometheus.BuildFQName(namespace, "md", "is_active"),
"Indicator whether the md-device is active or not.",
[]string{"device"},
nil,
)
disksActiveDesc = prometheus.NewDesc(
prometheus.BuildFQName(Namespace, "md", "disks_active"),
prometheus.BuildFQName(namespace, "md", "disks_active"),
"Number of active disks of device.",
[]string{"device"},
nil,
)
disksTotalDesc = prometheus.NewDesc(
prometheus.BuildFQName(Namespace, "md", "disks"),
prometheus.BuildFQName(namespace, "md", "disks"),
"Total number of disks of device.",
[]string{"device"},
nil,
)
blocksTotalDesc = prometheus.NewDesc(
prometheus.BuildFQName(Namespace, "md", "blocks"),
prometheus.BuildFQName(namespace, "md", "blocks"),
"Total number of blocks on device.",
[]string{"device"},
nil,
)
blocksSyncedDesc = prometheus.NewDesc(
prometheus.BuildFQName(Namespace, "md", "blocks_synced"),
prometheus.BuildFQName(namespace, "md", "blocks_synced"),
"Number of blocks synced on device.",
[]string{"device"},
nil,