Skip to content

Commit c13312d

Browse files
authored
Merge pull request #201 from csek06/dev
Dev
2 parents cf012f5 + 9b9d387 commit c13312d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

install-scripts/your-platform.env

+2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ MA_AGENT_NAME=$(hostname)
7070
MA_ENABLE_SIM=true
7171
MA_ENABLE_SIM_DOCKER=false
7272
MA_ENABLE_CONTAINERIDASHOSTID=false
73+
# https://docs.appdynamics.com/display/latest/Controller+Settings+for+Server+Visibility
74+
MONITOR_APM_CONTAINERS_ONLY=true
7375

7476
# Database Agent Information and Variables #
7577
DB_AGENT_NAME=$(hostname)

startup-scripts/start-MA.sh

+14
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ if [ -z $CONTROLLER_KEY ]; then
2020
JSESSIONID_H=$(grep -oP '(JSESSIONID\s)\K(.*)?(?=$)' cookie.appd)
2121
CONTROLLER_KEY=$(curl -s http://$CONTROLLER_HOST:$CONTROLLER_PORT/controller/restui/user/account -H "X-CSRF-TOKEN: $X_CSRF_TOKEN" -H "Cookie: JSESSIONID=$JSESSIONID_H" | grep -oP '(?:accessKey\"\s\:\s\")\K(.*?)(?=\"\,)')
2222
rm cookie.appd
23+
24+
# Monitor all containers if SIM Docker Enabled?
25+
if [ "$MONITOR_APM_CONTAINERS_ONLY" = "false"]; then
26+
curl -s -c cookie.appd --user root@system:appd -X GET http://$CONTROLLER_HOST:$CONTROLLER_PORT/controller/auth?action=login
27+
if [ -f "cookie.appd" ]; then
28+
X_CSRF_TOKEN="$(grep X-CSRF-TOKEN cookie.appd | grep -oP '(X-CSRF-TOKEN\s)\K(.*)?(?=$)')"
29+
X_CSRF_TOKEN_HEADER="`if [ -n "$X_CSRF_TOKEN" ]; then echo "X-CSRF-TOKEN:$X_CSRF_TOKEN"; else echo ''; fi`"
30+
containerOnlyValue="name=sim.docker.monitorAPMContainersOnly&value=false"
31+
echo "Setting $containerOnlyValue in Controller"
32+
curl -s -b cookie.appd -c cookie.appd2 --output /dev/null -H "$X_CSRF_TOKEN_HEADER" -X POST "http://$CONTROLLER_HOST:$CONTROLLER_PORT/controller/rest/configuration?$containerOnlyValue"
33+
else
34+
echo "Couldn't connect MA to controller $CONTROLLER_HOST:$CONTROLLER_PORT to set $containerOnlyValue"
35+
fi
36+
fi
2337
else
2438
echo "Couldn't connect MA to controller $CONTROLLER_HOST:$CONTROLLER_PORT to obtain controller key -- NOT starting MA"
2539
exit 1

0 commit comments

Comments
 (0)