Not a customer? Click the 'Start a free trial' link to begin a 30-day SaaS trial of our product and to join our community.
Existing Cisco AppDynamics customers should click the 'Sign In' button to authenticate to access the community
11-04-2021 02:37 AM
Hello
I need to use two different Machine Agent versions in order to run addpynamics extensions. Instead of installing each agent on separate server, I'm thinking of running each machine agent on a separate container.
is there a way to install Standalone Machine Agent on a container?
thanks
Solved! Go to Solution.
11-09-2021 11:18 PM
since I didnt get any reply here, I opened a case and this is their reply
We usually recommend customer create their own image so that there is better control over the setup.
I am pasting below the steps which you can use to create a MA image and run the same as a container on any server:
1. Download Machine agent installer for Linux with bundled jre and unzip and then rezip it as machine-agent.zip. This is important as sometimes the zip from the download is not read properly to create the folder structure. Do this on the machine where the docker image will be run.
2. Create a directory called MachineAgent on your machine where you will run the docker instance. eg. /Users/<ABC>/Docker/DockerVisibilty/MachineAgent.
3. Copy the machine-agent.zip to this location.
4. Create a new file called Dockerfile with the following code and give 744 permission:
# Sample Dockerfile for the AppDynamics Standalone Machine Agent
# This is provided for illustration purposes only, for full details
# please consult the product documentation: https://docs.appdynamics.com/
FROM ubuntu:14.04
# Install required packages
RUN apt-get update && apt-get upgrade -y && apt-get install -y unzip && apt-get clean
# Install AppDynamics Machine Agent
ENV APPDYNAMICS_HOME /opt/appdynamics
ADD machine-agent.zip /tmp/
RUN mkdir -p ${APPDYNAMICS_HOME} && unzip -oq /tmp/machine-agent.zip -d ${APPDYNAMICS_HOME} && rm /tmp/machine-agent.zip
# Setup MACHINE_AGENT_HOME
ENV MACHINE_AGENT_HOME /opt/appdynamics/machine-agent
#Comment this section only if you are using docker-compose to build/run the machine-agent container
ENV MA_PROPERTIES "-Dappdynamics.controller.hostName=<<ControllerHost>> -Dappdynamics.controller.port=<<ControllerPort>> -Dappdynamics.controller.ssl.enabled=false -Dappdynamics.agent.accountName=<<accountname>> -Dappdynamics.agent.accountAccessKey=<<accesskey>> -Dappdynamics.sim.enabled=true -Dappdynamics.docker.enabled=true -Dappdynamics.docker.container.containerIdAsHostId.enabled=true"
# Include start script to configure and start MA at runtime
ADD start-appdynamics ${APPDYNAMICS_HOME}
RUN chmod 744 ${APPDYNAMICS_HOME}/start-appdynamics
# Configure and Run AppDynamics Machine Agent
CMD "${APPDYNAMICS_HOME}/start-appdynamics"
Depending on how you are building and running the machine-agent container in docker (i.e. via docker-compose or docker build/docker run), you'll need to comment/un-comment the portions in the file. This script will set the AppDynamics specific environment variable needed for the MachineAgent and execute the machineagent.jar file.This docker file will basically use a ubuntu:14.04 base image (you can use any base image you want), install unzip command in it, copy over the machine-agent.zip to the /tmp directory of the image, extract the MachineAgent artifacts to /opt/appdynamics/machine-agent/, clear up the /tmp directory, copy over the MachineAgent startup script called start-appdynamics onto /opt/appdynamics/machine-agent/ directory and run the script.
Please note that we are using our own controller parameters in MA_PROPERTIES environment variable in the Dockerfile. You'll need to use your own controller information in this environment variable.
5. Create another file called start-appdynamics in the same MachineAgent folder with the following:
#!bin/bash
# Sample Docker start script for the AppDynamics Standalone Machine Agent
# This is provided for illustration purposes only, for full details
# please consult the product documentation: https://docs.appdynamics.com/
# See the AppDynamics Product Docs (Standalone Machine Agent Configuration Property Reference)
# In this example, APPD_* environment variables are passed to the container at runtime
# Uncomment all the lines in the below section when you are using docker-compose to build and run machine-agent container
#MA_PROPERTIES="-Dappdynamics.controller.hostName=${APPD_HOST}"
#MA_PROPERTIES+=" -Dappdynamics.controller.port=${APPD_PORT}"
#MA_PROPERTIES+=" -Dappdynamics.agent.accountName=${APPD_ACCOUNT_NAME%%_*}"
#MA_PROPERTIES+=" -Dappdynamics.agent.accountAccessKey=${APPD_ACCESS_KEY}"
#MA_PROPERTIES+=" -Dappdynamics.controller.ssl.enabled=${APPD_SSL_ENABLED}"
#MA_PROPERTIES+=" -Dappdynamics.sim.enabled=${APPD_SIM_ENABLED}"
#MA_PROPERTIES+=" -Dappdynamics.docker.enabled=${APPD_DOCKER_ENABLED}"
#MA_PROPERTIES+=" -Dappdynamics.docker.container.containerIdAsHostId.enabled=${APPD_CONTAINERID_AS_HOSTID_ENABLED}"
# Start Machine Agent
${MACHINE_AGENT_HOME}/jre/bin/java ${MA_PROPERTIES} -jar ${MACHINE_AGENT_HOME}/machineagent.jar
Please give appropriate permission for the file in my case I gave 777.
6. Create a script called build-docker.sh in the same MachineAgent folder with the following:
docker build -t appdynamics/docker-machine-agent:latest
Please give permission in my case 777 to this file. Please note if you use docker-compose then this is not needed.
7. Create a script called run-docker.sh in the same MachineAgent folder with the following:
docker run --rm -it -v /:/hostroot:ro -v /var/run/docker.sock:/var/run/docker.sock appdynamics/docker-machine-agent
Please give permission in my case 777 to this file. Again if docker-compose is used this is not needed.
8. To build the image run ./build-docker.sh and then to run the docker image run ./run-docker.sh
If you have CentOS we have seen issue with SELinux causing problems and you can disable selinux and try the same. If you wish to do any changes to the image, you can unzip the machine-agent.zip and make changes such as log level changes and zip it up again and then redo the image by building it again by the build-docker.sh and then run the same by run-docker.sh.
9. If you wish to use docker-compose; create a file docker-compose.yml in the same MachineAgent directory and the following code.
version: '3'
services:
docker-machine-agent:
build: .
container_name: docker-machine-agent
image: appdynamics/docker-machine-agent
environment:
- APPD_HOST=<<CONTROLLER HOST>>
- APPD_PORT=<<CONTROLLER PORT>>
- APPD_ACCOUNT_NAME=<<CONTROLLER ACCOUNT>>
- APPD_ACCESS_KEY=<<CONTROLLER ACCESS KEY>>
- APPD_SSL_ENABLED=false
- APPD_SIM_ENABLED=true
- APPD_DOCKER_ENABLED=true
- APPD_CONTAINERID_AS_HOSTID_ENABLED=true
volumes:
- /:/hostroot:ro
- /var/run/docker.sock:/var/run/docker.sock
Use the commands docker-compose build and docker-compose run to build and run respectively.
goodluck
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |
Thank you! Your submission has been received!
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form