File tree 2 files changed +16
-0
lines changed
2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,8 @@ MA_AGENT_NAME=$(hostname)
70
70
MA_ENABLE_SIM = true
71
71
MA_ENABLE_SIM_DOCKER = false
72
72
MA_ENABLE_CONTAINERIDASHOSTID = false
73
+ # https://docs.appdynamics.com/display/latest/Controller+Settings+for+Server+Visibility
74
+ MONITOR_APM_CONTAINERS_ONLY = true
73
75
74
76
# Database Agent Information and Variables #
75
77
DB_AGENT_NAME = $( hostname)
Original file line number Diff line number Diff line change @@ -20,6 +20,20 @@ if [ -z $CONTROLLER_KEY ]; then
20
20
JSESSIONID_H=$( grep -oP ' (JSESSIONID\s)\K(.*)?(?=$)' cookie.appd)
21
21
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(.*?)(?=\"\,)' )
22
22
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
23
37
else
24
38
echo " Couldn't connect MA to controller $CONTROLLER_HOST :$CONTROLLER_PORT to obtain controller key -- NOT starting MA"
25
39
exit 1
You can’t perform that action at this time.
0 commit comments