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

@ -2,7 +2,7 @@
set -euf -o pipefail
collectors=$(cat << COLLECTORS
enabled_collectors=$(cat << COLLECTORS
arp
bcache
buddyinfo
@ -36,6 +36,14 @@ collectors=$(cat << COLLECTORS
zfs
COLLECTORS
)
disabled_collectors=$(cat << COLLECTORS
filesystem
time
timex
uname
vmstat
COLLECTORS
)
cd "$(dirname $0)"
port="$((10000 + (RANDOM % 10000)))"
@ -74,13 +82,14 @@ then
fi
./node_exporter \
--collector.procfs="collector/fixtures/proc" \
--collector.sysfs="collector/fixtures/sys" \
--collectors.enabled="$(echo ${collectors} | tr ' ' ',')" \
--path.procfs="collector/fixtures/proc" \
--path.sysfs="collector/fixtures/sys" \
$(for c in ${enabled_collectors}; do echo --collector.${c} ; done) \
$(for c in ${disabled_collectors}; do echo --no-collector.${c} ; done) \
--collector.textfile.directory="collector/fixtures/textfile/two_metric_files/" \
--collector.megacli.command="collector/fixtures/megacli" \
--collector.wifi="collector/fixtures/wifi" \
--collector.qdisc="collector/fixtures/qdisc/" \
--collector.wifi.fixtures="collector/fixtures/wifi" \
--collector.qdisc.fixtures="collector/fixtures/qdisc/" \
--web.listen-address "127.0.0.1:${port}" \
--log.level="debug" > "${tmpdir}/node_exporter.log" 2>&1 &