Skip to content

Commit

Permalink
Switch for running oneagenthelper, support for garden-runc 1.2.0 or h…
Browse files Browse the repository at this point in the history
…igher
  • Loading branch information
aloismayr committed May 8, 2017
1 parent 61bacdc commit d8fa9ae
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 23 deletions.
3 changes: 3 additions & 0 deletions jobs/dynatrace-oneagent/spec
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ properties:
dynatrace.applogaccess:
description: 'Enable access to discovered application log files content'
default: '1'
dynatrace.starthelper:
description: 'Temporary switch for starting oneagenthelper from bosh job'
default: '0'
34 changes: 28 additions & 6 deletions jobs/dynatrace-oneagent/templates/dynatrace-oneagent.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export API_TOKEN=<%= properties.dynatrace.apitoken %>
export API_URL=<%= properties.dynatrace.apiurl %>
export SSL_MODE=<%= properties.dynatrace.sslmode %>
export APP_LOG_CONTENT_ACCESS=<%= properties.dynatrace.applogaccess %>
export START_HELPER=<%= properties.dynatrace.starthelper %>

export TMPDIR=/var/vcap/data/tmp

Expand Down Expand Up @@ -65,6 +66,27 @@ getWatchdogPid() {
ps -ef | grep "${AGENT_WATCHDOG}" | grep "${AGENT_BIN}" | grep -v "grep" | grep -v "sudo" | awk ' { print $2 } '
}

startOneAgentHelper() {
#gdn is the daemon for garden-runc >= 1.2.0
if pgrep -x "gdn" > /dev/null
then
/opt/dynatrace/oneagent/agent/lib64/oneagenthelper -p `pgrep -x gdn` --garden &
fi

#guardian is the daemon for garden-runc < 1.2.0
if pgrep -x "guardian" > /dev/null
then
/opt/dynatrace/oneagent/agent/lib64/oneagenthelper -p `pgrep -x guardian` --garden &
fi
}

stopOneAgentHelper() {
if pgrep -x "oneagenthelper" > /dev/null
then
pkill -x oneagenthelper
fi
}

case $1 in
start)
pid=$(getWatchdogPid)
Expand All @@ -77,9 +99,9 @@ case $1 in

sh $TMPDIR/Dynatrace-OneAgent-Linux.sh $ARGS INSTALL_PATH=$install_path >> $LOG_DIR/dynatrace-install.log 2>> $LOG_DIR/dynatrace-install.log

if pgrep -x "guardian" > /dev/null
then
/opt/dynatrace/oneagent/agent/lib64/oneagenthelper -p `pgrep -x guardian` --garden &
# Start oneagenthelper manually
if [ "x$START_HELPER" != "x0" ]; then
startOneAgentHelper
fi
pid=$(getWatchdogPid)
fi
Expand All @@ -90,9 +112,9 @@ case $1 in
if [ -f /opt/dynatrace/oneagent/agent/uninstall.sh ]; then
sh /opt/dynatrace/oneagent/agent/uninstall.sh
fi
if pgrep -x "oneagenthelper" > /dev/null
then
pkill -x oneagenthelper
# Stop oneagenthelper
if [ "x$START_HELPER" != "x0" ]; then
stopOneAgentHelper
fi

rm -rf /opt/dynatrace/oneagent
Expand Down
10 changes: 0 additions & 10 deletions run-with-version.sh

This file was deleted.

6 changes: 0 additions & 6 deletions run.sh

This file was deleted.

3 changes: 2 additions & 1 deletion runtime-config-dynatrace.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
releases:
- name: dynatrace-oneagent
version: 0.3.0
version: 0.3.1

addons:
- name: dynatrace-oneagent-addon
Expand All @@ -15,6 +15,7 @@ addons:
dynatrace:
environmentid: abc12345
apitoken: bvQ0e--secret--2fEL9B
starthelper: 1
# apiurl: https://abc12345.sprint.dynatracelabs.com/api

- name: dynatrace-oneagent-windows-addon
Expand Down

0 comments on commit d8fa9ae

Please sign in to comment.