cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

This product reached the end of support date on March 31, 2021.

Monitoring local agent with docker container

markus_strickle
Inactive

Hi,

I'm currently trying to use a dockerized dynatrace to monitor an application running on my local machine (not in a docker container) using the personal license of dynatrace on OSX.

The problem is, that while I can connect my java agent to the server just fine using server=localhost the personal license doesn't allow me to use the agent. Looking at the Agent Host Address it says 172.17.0.1.

Is there any way to get this setup to work? I'm pretty new to docker, so sorry if there is an obvious answer to this.

Thanks,

Markus

13 REPLIES 13

martin_et2
Inactive

Hi Markus, I suggest you do the following: you can circumvent this problem for all containers on a single machine by having them use your host network. This means that containers will effectively inherit the host's IP address (and share the same port space). You can do so by adding a "--net=host" directive to each of your "docker run" statements.

Best, Martin

Great tip Martin.

Because of environments like yours (Containers, Virtual, ...) we also plan to extend the personal license to allow remote agent connects for a certain amount of time per month. with that folks can leverage Dynatrace AppMon Personal License even though they run their software not only on their localhost machine

Andi

markus_strickle
Inactive

Hi Martin,

thanks for the tip.

Unfortunately I couldn't get it to work, as I couldn't get the dynatrace servers to start up correctly in host network mode.

Thanks anyway,

Markus

venkatesan_kube
Participant

I have been trying this whole weekend trying to setup the dynatrace environment (dtserver, agent and collector) in docker host mode so that they all can share the ip to leverage the personal license. But i have no success , it would be grateful if you can share the steps if u had success before.

Thanks

Venky

Hi Venky. thanks for posting this on the forum. I know you also sent me an email.

I will follow up on your email and then we make sure to post the answer on the forum for others to learn as well

Andi

venkatesan_kube
Participant

I have DT server and Agent running on docker host mode but I am stuck at running the collector

When I start the Dynatrace Collector I am getting the following error message.

Pulling dtcollector (dynatrace/collector:6.5)...

6.5: Pulling from dynatrace/collector

Digest: sha256:0ec2da5f10fa6e0ff9f158cf23e8f0b1776dfb904848fffd0199d0651bbe4e42

Status: Downloaded newer image for dynatrace/collector:6.5

Creating dtcollector

ERROR: for dtcollector Cannot create container for service dtcollector: Conflicting options: host type networking can't be used with links. This would result in undefined behavior

ERROR: Encountered errors while bringing up the project.

martin_et2
Inactive

Hi @Venky K.. The Docker documentation says that container linking and host networking is not supported. Container linking only works when using the default `bridge` networking mode, not the `host` networking mode you are enforcing. As stated here https://github.com/Dynatrace/Dynatrace-Docker/tree/master/Dynatrace-Collector, the Dynatrace Collector does not require a container link (neither do the agents), as a URI to the Server / Collector can also be provided, e.g. in DT_COLLECTOR_SERVER.

venkatesan_kube
Participant

Thank you @Martin E., now i have the Dockerized Dynatrace envrionment running (DT server/ agent running on host mode and collector running on bridge mode). However i am facing the same issue while hook up my tomcat container to dynatrace agent.

"Starting Apache Tomcat - Example
docker: Error response from daemon: Conflicting options: host type networking can't be used with links. This would result in undefined behavior
."

My understanding is, dynatrace envrionment (server/agent) and application have to be running on the same host in order to use Personal license. How can i get it all running on the same host and instrument the application ?

martin_et2
Inactive
@Venky K. I see a couple of things here.

1) Docker's error message indicates that your Apache Tomcat container uses both "linking" and "host" networking. This won't work.

2) When you run DT server and agent in "host" networking mode, I see no reason for running the collector in "bridge" mode. Running in "host" networking mode gives the containers which run in this mode the ability to re-use your host's IP address. Therefore, I suggest you get entirely rid of "links" and use the environment variables (DT_COLLECTOR_SERVER for the collector and DT_AGENT_COLLECTOR for the agent), as described in the respective component's directories at https://github.com/dynatrace/Dynatrace-Docker and pass IP:Port directly. Linking was only useful in "bridge" networking mode to look up the containers automatically. In your setup this is neither needed nor working.

Hope this helps!

venkatesan_kube
Participant

@Martin E., I have removed all the links and now i have the following setup in my docker-comopse (have entries for DT server as well). All 3 of them are running in host "networking mode". However i see the error message on the UI Client console saying " Collector is not listening to agents". I saw waring in Collector container saying port 9998 is already used hence i tried publishing 9999 but it didn't help though.

warning from collector container:

dtcollector | 2016-11-05 00:08:48 WARNING [Collector] Could not open port 9998 on interface '<any>' for collector communication! java.net.BindException: Address already in use

docker-compose ----

Collector:

environment:

DT_COLLECTOR_NAME: "dtcollector"

HOST_NAME: "docker-dtcollector"

DT_COLLECTOR_SERVER: "localhost:6699"

net: "host"

ports:
- "9999:9999"

Agent :

net: "host"

environment:

DT_AGENT_COLLECTOR: "localhost:9999"

volumes:
- /dynatrace
- "/tmp/log/dynatrace/agents/dtagent:/dynatrace/log/agent"

venkatesan_kube
Participant

It looks like that dynatrace server image comes with embedded collector and running on port 9998 thus i hooked my agent directly to dt server container and got rid of collector container

martin_et2
Inactive

@Venky K., we recently changed the behavior of `docker-compose.yml` to not start a dedicated collector instance. You can, however, go with a dedicated collector when using `docker-compose-withCollector.yml` (speaking of the convenience Docker Compose scripts in https://github.com/dynatrace/Dynatrace-Docker here).

venkatesan_kube
Participant

@Martin E., Thanks for the response. Actually i can't use the dedicated collector as port 9998 is used by embedded collector

I get this error message on the collector

dtcollector | 2016-11-05 00:08:48 WARNING [Collector] Could not open port 9998 on interface '<any>' for collector communication! java.net.BindException: Address already in use

How can i disable the embedded collector and not to use the port 9998