Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aloismayr committed Jan 25, 2017
0 parents commit dfb1668
Show file tree
Hide file tree
Showing 17 changed files with 242 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
config/dev.yml
config/private.yml
releases/*.tgz
dev_releases
blobs
.blobs
.dev_builds
.idea
.final_builds/jobs/**/*.tgz
.final_builds/packages/**/*.tgz
releases/**/*.tgz
.DS_Store
tmp
*.swp
*.tgz
*.zip
*~
*#
#*
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# bosh-oneagent-release
1 change: 1 addition & 0 deletions config/blobs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--- {}
52 changes: 52 additions & 0 deletions dynatrace-oneagent-deployment-manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: dynatrace-oneagent
director_uuid: 6da39200-116d-4af2-9b71-d3e615a13074

releases:
- name: dynatrace-oneagent
version: latest

stemcells:
- alias: default
os: ubuntu-trusty
version: latest

update:
canaries: 1
max_in_flight: 32
canary_watch_time: 1000-300000
update_watch_time: 1000-300000
serial: false

instance_groups:
- name: dynatrace-test-job
instances: 0
jobs:
- name: dynatrace-test-job
release: dynatrace-oneagent
vm_type: default
stemcell: default
persistent_disk_type: default
azs:
- default
networks:
- name: public
- name: dynatrace-agent
instances: 0
jobs:
- name: dynatrace-agent
release: dynatrace-agent
vm_type: default
azs:
- default
stemcell: default
networks:
- name: default

properties:
dynatrace:
downloadurl: https://<environmentid>.live.dynatrace.com/installer/agent/unix/latest/<token>
processhooking: 1
proxy:
applogaccess: 1
test_message: Test Deployment of Dynatrace OneAgent
7 changes: 7 additions & 0 deletions jobs/dynatrace-oneagent/monit
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
check process dynatrace-oneagent
with pidfile /var/vcap/sys/run/dynatrace-oneagent/dynatrace-watchdog.pid
start program "/var/vcap/jobs/dynatrace-oneagent/bin/dynatrace-oneagent.sh start"
with timeout 600 seconds
stop program "/var/vcap/jobs/dynatrace-oneagent/bin/dynatrace-oneagent.sh stop"
with timeout 120 seconds
group vcap
17 changes: 17 additions & 0 deletions jobs/dynatrace-oneagent/spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: dynatrace-oneagent
templates:
dynatrace-oneagent.sh.erb: bin/dynatrace-oneagent.sh

packages:
- dynatrace-oneagent

properties:
dynatrace.downloadurl:
description: 'Download URL for OneAgent'
dynatrace.proxy:
description: 'Proxy for Server'
dynatrace.processhooking:
description: 'Enable deep monitoring'
dynatrace.applogaccess:
description: 'Enable access to discovered application log files content'
60 changes: 60 additions & 0 deletions jobs/dynatrace-oneagent/templates/dynatrace-oneagent.sh.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash
set -e -x

export PATH="/var/vcap/packages/dynatrace-oneagent:$PATH"

export PROXY=<%= properties.dynatrace.proxy %>
export DOWNLOADURL=<%= properties.dynatrace.downloadurl %>
export PROCESSHOOKING=<%= properties.dynatrace.processhooking %>
export APP_LOG_CONTENT_ACCESS=<%= properties.dynatrace.applogaccess %>

ARGS=""
if [ "$PROXY" != "" ]; then
ARGS="$ARGS PROXY=$PROXY"
fi
if [ "$PROCESSHOOKING" != "" ]; then
ARGS="$ARGS PROCESSHOOKING=$PROCESSHOOKING"
fi
if [ "$APP_LOG_CONTENT_ACCESS" != "" ]; then
ARGS="$ARGS APP_LOG_CONTENT_ACCESS=$APP_LOG_CONTENT_ACCESS"
fi


RUN_DIR=/var/vcap/sys/run/dynatrace-oneagent
LOG_DIR=/var/vcap/sys/log/dynatrace-oneagent
mkdir -p ${RUN_DIR} ${LOG_DIR}


getWatchdogPid() {
local AGENT_BIN=oneagentos
local AGENT_WATCHDOG=oneagentwatchdog

# grep -v "grep" is required, because ps -ef returns also "grep '${AGENT_WATCHDOG}.*${AGENT_BIN}"' process
# grep -v "sudo" it is enough to use "direct" watchdog pids, filter sudo calls with watchdog params.
ps -ef | grep "${AGENT_WATCHDOG}" | grep "${AGENT_BIN}" | grep -v "grep" | grep -v "sudo" | awk ' { print $2 } '
}


if [ ! -d /opt/dynatrace/oneagent ]; then
curl -L -o /tmp/Dynatrace-OneAgent-Linux.sh $DOWNLOADURL
chmod 755 /tmp/Dynatrace-OneAgent-Linux.sh
sh /tmp/Dynatrace-OneAgent-Linux.sh $ARGS >> $LOG_DIR/dynatrace-install.log 2>> $LOG_DIR/dynatrace-install.log
fi

case $1 in
start)
pid=$(getWatchdogPid)
# If the watchdog was stopped or rolled over...
if [ "$pid" == "" ]; then
curl -L -o /tmp/Dynatrace-OneAgent-Linux.sh $DOWNLOADURL
chmod 755 /tmp/Dynatrace-OneAgent-Linux.sh
sh /tmp/Dynatrace-OneAgent-Linux.sh $ARGS >> $LOG_DIR/dynatrace-install.log 2>> $LOG_DIR/dynatrace-install.log
pid=$(getWatchdogPid)
fi
echo $pid > ${RUN_DIR}/dynatrace-watchdog.pid
;;

stop)
sh /opt/dynatrace/oneagent/agent/uninstall.sh
;;
esac
7 changes: 7 additions & 0 deletions jobs/dynatrace-test-job/monit
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
check process dynatrace-test-job
with pidfile /var/vcap/sys/run/dynatrace-test-job/dynatrace-test-job.pid
start program "/var/vcap/jobs/dynatrace-test-job/bin/dynatrace-test-job.sh start"
with timeout 600 seconds
stop program "/var/vcap/jobs/dynatrace-test-job/bin/dynatrace-test-job.sh stop"
with timeout 120 seconds
group vcap
11 changes: 11 additions & 0 deletions jobs/dynatrace-test-job/spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: dynatrace-test-job
templates:
dynatrace-test-job.sh.erb: bin/dynatrace-test-job.sh

packages:
- dynatrace-oneagent

properties:
dynatrace.test_message:
description: 'Dynatrace Test Job'
24 changes: 24 additions & 0 deletions jobs/dynatrace-test-job/templates/dynatrace-test-job.sh.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -e -x

export PATH="/var/vcap/packages/dynatrace-oneagent:$PATH"

export TEST_MSG=<%= properties.dynatrace.test_message %>

RUN_DIR=/var/vcap/sys/run/dynatrace-test-job
LOG_DIR=/var/vcap/sys/log/dynatrace-test-job
mkdir -p ${RUN_DIR} ${LOG_DIR}



case $1 in
start)
echo $TEST_MSG >> ${LOG_DIR}/dynatrace-test-job.log
tail -f /dev/null & echo $! > ${RUN_DIR}/dynatrace-test-job.pid
pid=$(echo $!)
;;

stop)
kill -9 `cat ${RUN_DIR}/dynatrace-test-job.pid`
;;
esac
2 changes: 2 additions & 0 deletions packages/dynatrace-oneagent/packaging
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# abort script on any command that exits with a non zero value
set -e
2 changes: 2 additions & 0 deletions packages/dynatrace-oneagent/pre_packaging
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# abort script on any command that exits with a non zero value
set -e
7 changes: 7 additions & 0 deletions packages/dynatrace-oneagent/spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: dynatrace-oneagent

dependencies:

files:
- dynatrace-oneagent/placeholder
10 changes: 10 additions & 0 deletions run-with-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Change me
VERSION=0.1

bosh deployment dynatrace-oneagent-deployment-manifest.yml
bosh -n delete deployment dynatrace-oneagent
bosh -n delete release dynatrace-oneagent
rm -rf dev_releases
bosh create release --with-tarball --version $VERSION
bosh upload release
bosh -n deploy
6 changes: 6 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
bosh deployment dynatrace-oneagent-deployment-manifest.yml
bosh -n delete deployment dynatrace-oneagent
bosh -n delete release dynatrace-oneagent
bosh create release
bosh upload release
bosh -n deploy
16 changes: 16 additions & 0 deletions runtime-config-dynatrace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
releases:
- name: dynatrace-oneagent
version: 0.1

addons:
- name: dynatrace-oneagent
jobs:
- name: dynatrace-oneagent
release: dynatrace-oneagent

properties:
dynatrace:
downloadurl: https://<environmentid>.live.dynatrace.com/installer/agent/unix/latest/<token>
processhooking: 1
proxy:
applogaccess: 1
Empty file.

0 comments on commit dfb1668

Please sign in to comment.