You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2019/06/27 22:46:15 UTC
[trafficcontrol] branch master updated: CiaB: added log path of
traffic monitor in variables.env (#3665)
This is an automated email from the ASF dual-hosted git repository.
dangogh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new 61a985c CiaB: added log path of traffic monitor in variables.env (#3665)
61a985c is described below
commit 61a985ce4aeffcb67764b6e7ad81b922bbf8c90c
Author: Shihta Kuan <Sh...@users.noreply.github.com>
AuthorDate: Fri Jun 28 06:46:10 2019 +0800
CiaB: added log path of traffic monitor in variables.env (#3665)
---
infrastructure/cdn-in-a-box/traffic_monitor/Dockerfile | 2 +-
infrastructure/cdn-in-a-box/traffic_monitor/run.sh | 7 ++-----
.../cdn-in-a-box/traffic_monitor/traffic_monitor.cfg | 10 +++++-----
infrastructure/cdn-in-a-box/variables.env | 5 +++++
4 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/infrastructure/cdn-in-a-box/traffic_monitor/Dockerfile b/infrastructure/cdn-in-a-box/traffic_monitor/Dockerfile
index 998ab86..9cf40d7 100644
--- a/infrastructure/cdn-in-a-box/traffic_monitor/Dockerfile
+++ b/infrastructure/cdn-in-a-box/traffic_monitor/Dockerfile
@@ -40,7 +40,7 @@ RUN yum install -y epel-release && \
yum clean all
RUN mkdir -p /opt/traffic_monitor/conf
-ADD traffic_monitor/traffic_monitor.cfg /opt/traffic_monitor/conf/
+ADD traffic_monitor/traffic_monitor.cfg /opt/traffic_monitor/conf/traffic_monitor.cfg.template
ADD enroller/server_template.json \
traffic_ops/to-access.sh \
diff --git a/infrastructure/cdn-in-a-box/traffic_monitor/run.sh b/infrastructure/cdn-in-a-box/traffic_monitor/run.sh
index c86246f..a1032fc 100755
--- a/infrastructure/cdn-in-a-box/traffic_monitor/run.sh
+++ b/infrastructure/cdn-in-a-box/traffic_monitor/run.sh
@@ -101,15 +101,12 @@ export TO_PASSWORD="$TM_PASSWORD"
export TO_USER=$TO_ADMIN_USER
export TO_PASSWORD=$TO_ADMIN_PASSWORD
-touch /opt/traffic_monitor/var/log/traffic_monitor.log
-
# Do not start until there a valid Snapshot has been taken
until [ $(to-get "/api/1.4/cdns/$CDN_NAME/snapshot" 2>/dev/null | jq -c -e '.response.config|length') -gt 0 ] ; do
echo "Waiting on valid Snapshot...";
sleep 3;
done
+envsubst < /opt/traffic_monitor/conf/traffic_monitor.cfg.template > /opt/traffic_monitor/conf/traffic_monitor.cfg
cd /opt/traffic_monitor
-/opt/traffic_monitor/bin/traffic_monitor -opsCfg /opt/traffic_monitor/conf/traffic_ops.cfg -config /opt/traffic_monitor/conf/traffic_monitor.cfg &
-disown
-exec tail -f /opt/traffic_monitor/var/log/traffic_monitor.log
+/opt/traffic_monitor/bin/traffic_monitor -opsCfg /opt/traffic_monitor/conf/traffic_ops.cfg -config /opt/traffic_monitor/conf/traffic_monitor.cfg
diff --git a/infrastructure/cdn-in-a-box/traffic_monitor/traffic_monitor.cfg b/infrastructure/cdn-in-a-box/traffic_monitor/traffic_monitor.cfg
index b5223b1..91ea4fe 100644
--- a/infrastructure/cdn-in-a-box/traffic_monitor/traffic_monitor.cfg
+++ b/infrastructure/cdn-in-a-box/traffic_monitor/traffic_monitor.cfg
@@ -10,11 +10,11 @@
"max_health_history": 5,
"health_flush_interval_ms": 20,
"stat_flush_interval_ms": 20,
- "log_location_event": "/opt/traffic_monitor/var/log/traffic_monitor.log",
- "log_location_error": "/opt/traffic_monitor/var/log/traffic_monitor.log",
- "log_location_warning": "/opt/traffic_monitor/var/log/traffic_monitor.log",
- "log_location_info": "/opt/traffic_monitor/var/log/traffic_monitor.log",
- "log_location_debug": "/opt/traffic_monitor/var/log/traffic_monitor.log",
+ "log_location_event": "$TM_LOG_EVENT",
+ "log_location_error": "$TM_LOG_ERROR",
+ "log_location_warning": "$TM_LOG_WARNING",
+ "log_location_info": "$TM_LOG_INFO",
+ "log_location_debug": "$TM_LOG_DEBUG",
"serve_read_timeout_ms": 10000,
"serve_write_timeout_ms": 10000,
"http_poll_no_sleep": false,
diff --git a/infrastructure/cdn-in-a-box/variables.env b/infrastructure/cdn-in-a-box/variables.env
index 843a364..c5140b2 100644
--- a/infrastructure/cdn-in-a-box/variables.env
+++ b/infrastructure/cdn-in-a-box/variables.env
@@ -61,6 +61,11 @@ TM_PORT=80
TM_EMAIL=tmonitor@cdn.example.com
TM_PASSWORD=jhdslvhdfsuklvfhsuvlhs
TM_USER=tmon
+TM_LOG_EVENT=stdout
+TM_LOG_ERROR=stdout
+TM_LOG_WARNING=stdout
+TM_LOG_INFO=stdout
+TM_LOG_DEBUG=stdout
TO_ADMIN_PASSWORD=twelve
TO_ADMIN_USER=admin
TO_EMAIL=cdnadmin@example.com