The Network Agent can monitor applications running in Docker containers on the same host. You can deploy one Network Agent per host and collect individual metrics for every local application monitored by a Java App Agent in a container. AppDynamics recommends that you install the Network Agent in a separate container in Docker Host network mode on the same host as the application containers. This recommendation applies when the App Agent containers are running in Docker Bridge or Docker Host mode.  Example 1: App Agents in Separate Network | Example 2: App Agents in Host Network |
---|
|
|
Install the Network Agent and App Agents
Paste the sample Dockerfile into a text file and save the file. This sample Dockerfile contains commands for installing the Network Agent. FROM centos:centos7
RUN yum update -y && yum install -y \
net-tools \
iproute \
tcpdump \
curl \
unzip \
sysvinit-tools \
openssh-clients
WORKDIR /netviz-agent
ARG NETVIZ_ZIP_PKG
# copy NetViz agent contents
ADD ${NETVIZ_ZIP_PKG} .
# run the agent install script
RUN unzip *.zip && ./install.sh \
&& sed -i -e "s|enable_netlib = 1|enable_netlib = 0|g" ./conf/agent_config.lua \
&& sed -i -e "s|WEBSERVICE_IP=.*|WEBSERVICE_IP=\"0.0.0.0\"|g" ./conf/agent_config.lua
# default command to run for the agent
CMD ./bin/appd-netagent -c ./conf -l ./logs -r ./run |
Navigate to the directory where you saved the Dockerfile. Build the Docker image by entering: docker build --build-arg NETVIZ_ZIP_PKG=/path/to/netviz-agent-pkg.zip -t appd-netviz . |
Push the Docker image to your Docker Trusted Registry. Deploy your Docker image using this sample Docker Compose file:
version: '2'
services:
appd-netviz-agent:
image: path/to/your/docker/image # docker registry image
network_mode: "host"
restart: unless-stopped
ports:
- '3892:3892'
cap_add:
- NET_ADMIN
- NET_RAW |
Alternatively, enter:
docker run -d --network=host --cap-add=NET_ADMIN --cap-add=NET_RAW path/to/your/netviz/docker/image |
Set up the Network Agent. Follow the single-tenant setup instructions on Set Up the Network and App Agents on Linux. For single-tenant setup, you do not need to enable netlib. |
Specify the Docker Host Gateway IP on the App AgentIf you are running the App Agent in a Docker container outside of the Docker Host network (as shown in Example 1 in the diagram), complete these steps. In the host for your App Agent, enter these environment variables: export APPDYNAMICS_NETVIZ_AGENT_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
export APPDYNAMICS_NETVIZ_AGENT_PORT=3892 |
Set the values for the port and host address. Run the application Docker image by passing the AppDynamics environment variables which were exported in Step 1. For example: docker run --env "APPDYNAMICS_NETVIZ_AGENT_HOST=$APPDYNAMICS_NETVIZ_AGENT_HOST"
--env "APPDYNAMICS_NETVIZ_AGENT_PORT=$APPDYNAMICS_NETVIZ_AGENT_PORT" <application_docker_image> |
|