From 1d5fa2297d654f13413a9c5d1ab6f12767a877fa Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Sat, 23 Feb 2019 17:04:21 +0100 Subject: [PATCH] fixed telegraf start Signed-off-by: Janos SUTO --- tests/setup.inc | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/setup.inc b/tests/setup.inc index 31625831..452f7392 100644 --- a/tests/setup.inc +++ b/tests/setup.inc @@ -1,4 +1,5 @@ CONTAINERS=( "piler1" ) +CONFIG_DIR="/data/config" setup() { destroy_containers @@ -6,18 +7,21 @@ setup() { create_rules "piler1" } +start_telegraf() { + local config="$1" + + if [[ "$RUN_TELEGRAF" == "true" ]]; then + docker cp "$config" "piler1:/etc/telegraf/telegraf.conf" + docker exec "piler1" sed -i 's/HOSTNAME/piler1/g' /etc/telegraf/telegraf + docker exec "piler1" service telegraf start + fi +} + launch_containers() { docker run -d --net=piler --name piler1 -e PILER_HOST="cust1.acts.hu" -p 80:80 -p 25:25 "$docker_image" 2>/dev/null wait_for_sleep_cycle_in_container "piler1" - if [[ -v JENKINS_URL ]]; then - docker cp "${HOME}/telegraf.conf" piler1:/etc/telegraf/telegraf.conf 2>/dev/null - else - docker cp "${topdir}/secrets/telegraf.conf" piler1:/etc/telegraf/telegraf.conf 2>/dev/null - fi - - docker exec "piler1" sed -i 's/HOSTNAME/piler1/g' /etc/telegraf/telegraf.conf - docker exec "piler1" service telegraf start + start_telegraf "${CONFIG_DIR}/telegraf.conf" } create_rules() {