# OneAgent on Fargate

**URL:** <https://community.dynatrace.com/t/oneagent-on-fargate/19302>\
**Category:** Cloud platforms\
**Tags:** nodejs, aws, oneagent, docker\
**Created:** [May 11, 2020, 10:30am UTC](https://community.dynatrace.com/t/oneagent-on-fargate/19302 "2020-05-11T10:30:02Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![patb23](https://avatars.discourse-cdn.com/v4/letter/p/5e9695/32.png) [@patb23](https://community.dynatrace.com/u/patb23)\
**Post date:** [May 11, 2020, 10:30am UTC](https://community.dynatrace.com/t/oneagent-on-fargate/19302/1 "2020-05-11T10:30:02Z")

</div>

I am trying to enable monitoring on a Task running Node.js on AWS Fargate - the base image is [node](https://hub.docker.com/_/node/). I followed the steps outlined in [Install OneAgent](https://www.dynatrace.com/support/help/technology-support/cloud-platforms/amazon-web-services/installation/deploy-oneagent-on-aws-fargate/#expand-644how-to-use-a-different-dynatrace-environment-for-oneagent-enriched-images), no errors found at the time of build and after running the task, I could see in the logs that it prints the following:

```auto
Info: Using DT_HOME: /opt/dynatrace/oneagent

```

I don’t see any other Dynatrace specific error on INFO messages. The ECS Fargate is not listed in my Dashboard.

I am also sharing the content of Dockerfile below, could I get help on what is missing or what I didn’t follow in the instructions?

```auto
FROM node
ARG MASTER_NAME
ARG DT_API_URL="https://myenv.live.dynatrace.com/api"
ARG DT_API_TOKEN
ARG DT_ONEAGENT_OPTIONS="flavor=default&include=nodejs"
ENV DT_HOME="/opt/dynatrace/oneagent"
RUN mkdir -p "$DT_HOME" && \
    wget -O "$DT_HOME/oneagent.zip" "$DT_API_URL/v1/deployment/installer/agent/unix/paas/latest?Api-Token=$DT_API_TOKEN&$DT_ONEAGENT_OPTIONS" && \
    unzip -d "$DT_HOME" "$DT_HOME/oneagent.zip" && \
    rm "$DT_HOME/oneagent.zip"

WORKDIR /server

COPY . /server

RUN npm install

EXPOSE 3000
ENTRYPOINT ["/opt/dynatrace/oneagent/dynatrace-agent64.sh"]
CMD ["npm", "start"]

```

---

<div class="post-metadata">

**Author:** ![steve\_caron](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@steve\_caron](https://community.dynatrace.com/u/steve_caron)\
**Post date:** [May 12, 2020, 1:05pm UTC](https://community.dynatrace.com/t/oneagent-on-fargate/19302/2 "2020-05-12T13:05:37Z")

</div>

Quick question: are you sure you used a PaaS token (for the value of DT\_API\_TOKEN)? Even though the variable is named DT\_API\_TOKEN, what is needed is a PaaS token and not an API token. That’s a common source of errors, that’s why I’m asking.

---

<div class="post-metadata">

**Author:** ![patb23](https://avatars.discourse-cdn.com/v4/letter/p/5e9695/32.png) [@patb23](https://community.dynatrace.com/u/patb23)\
**Post date:** [May 12, 2020, 1:42pm UTC](https://community.dynatrace.com/t/oneagent-on-fargate/19302/3 "2020-05-12T13:42:42Z")

</div>

Thanks for helping with this. Yes, I used one of the 2 PaaS tokens I had on my account.

 ![24986-paas-token.png](https://global.discourse-cdn.com/dynatrace/original/2X/6/643f1581770b14c7b5cc716b024b9c7ea4f0d9df.png)

Please note that I am able to monitor my app running on EC2 - deployed both OneAgent and ActiveGate for that.

---

<div class="post-metadata">

**Author:** ![rodrigo\_alvare1](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/rodrigo_alvare1/32/1927_2.png) [@rodrigo\_alvare1](https://community.dynatrace.com/u/rodrigo_alvare1)\
**Post date:** [July 8, 2020, 1:31am UTC](https://community.dynatrace.com/t/oneagent-on-fargate/19302/4 "2020-07-08T01:31:25Z")

</div>

Hello,  
Are you running the container alone or the task also deploys any other security container? ( As I have seen in the past some solutions that conflicted with Dynatrace OneAgent)

The message you see "Info: Using DT\_HOME: /opt/dynatrace/oneagent " comes from the execution of “/opt/dynatrace/oneagent/dynatrace-agent64.sh”

By default Dynatrace oneAgent does not print information into cloudwatch as it can be too chatty, but you can enable that for NGINX with the environment variable DT\_NGINX\_OPTIONS=loglevelconinfo.

With that option enabled you will see the Dynatrace OneAgent logs in CloudWatch .

Regards

---

<div class="post-metadata">

**Author:** ![rohit\_upadhyay](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@rohit\_upadhyay](https://community.dynatrace.com/u/rohit_upadhyay)\
**Post date:** [April 14, 2021, 4:23am UTC](https://community.dynatrace.com/t/oneagent-on-fargate/19302/5 "2021-04-14T04:23:48Z")

</div>

Hi&nbsp;[@patb23](https://community.dynatrace.com/user/38529)&nbsp; ,

I’m facing the exact issue , do let me know if there’s a solution or workaround for this issue.

Regards,

Rohit U

---

<div class="post-metadata">

**Author:** ![RodrigoBiaggio](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/rodrigobiaggio/32/39343_2.png) [@RodrigoBiaggio](https://community.dynatrace.com/u/RodrigoBiaggio)\
**Post date:** [November 11, 2021, 3:48pm UTC](https://community.dynatrace.com/t/oneagent-on-fargate/19302/6 "2021-11-11T15:48:35Z")

</div>

Hi, any updates on this error? I have the same problem and message.

---

<div class="post-metadata">

**Author:** ![rodrigo\_alvare1](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/rodrigo_alvare1/32/1927_2.png) [@rodrigo\_alvare1](https://community.dynatrace.com/u/rodrigo_alvare1)\
**Post date:** [November 11, 2021, 4:18pm UTC](https://community.dynatrace.com/t/oneagent-on-fargate/19302/7 "2021-11-11T16:18:55Z")

</div>

Hi Rodrigo,&nbsp;  
Are you using build/auto/runtime injection ? [Monitor AWS Fargate — Dynatrace Docs](https://www.dynatrace.com/support/help/setup-and-configuration/setup-on-cloud-platforms/amazon-web-services/deploy-oneagent-on-aws-fargate/)

Verify if you are using alpine linux or not  
(if alpine, the oneagent image name will be :&nbsp;/linux/oneagent-codemodules-musl:\<technology\> )

Check the cloudwatch logs any reference to oneAgent or add the environment variable “DT\_LOGLEVELCON=info” to get more details.  
If still not seeing any information, try to run the image locally and you can ssh into the container and verify if the oneagent is running inside of the container.  
Some related errors I have seen in the past is that the Dynatrace cluster or the repo where the oneagent image is, does not has a valid certificate, so docker will fail when pulling the image.

---

<div class="post-metadata">

**Author:** ![KePe](https://avatars.discourse-cdn.com/v4/letter/k/ecc23a/32.png) [@KePe](https://community.dynatrace.com/u/KePe)\
**Post date:** [July 21, 2022, 7:40am UTC](https://community.dynatrace.com/t/oneagent-on-fargate/19302/8 "2022-07-21T07:40:19Z")

</div>

Did you solve your problem? If so how?

I face same issue, build-time injection (docker image) looks fine. Build pass green, oneAgent is downloaded successfully.  
We use Alpine based image so musl is used.

When testing the final image locally (for easy debug) I can “ssh” to the running docker. I can see entrypoint script, next to it seats environment setting script with all the company URLS, tokens and so on. All looks good.

But lunching the dynatrace-agent64.sh produces same “Info: Using DT\_HOME: /opt/dynatrace/oneagent” output as in your case.

That is the end, no more logs, errors etc. No process is started (ps aux) or netstat does not show any extra connections made. All the “.so” libs are in place. What is wrong? Deploying to AWS ECS Fargate produces same result, just the very same “info:” in CloudWatch and nothing more. Please share you results&nbsp;  
[@rodrigo\_alvare1](https://community.dynatrace.com/user/22109)&nbsp;maybe you came up with some other ideas? In my docker I also have verbosity mode set but … seams not working.

bash-5.1# env |grep DT  
DT\_HOME=/opt/dynatrace/oneagent  
DT\_LOGLEVELSDK=finest  
DT\_LOGLEVELCON=finest

---

<div class="post-metadata">

**Author:** ![techean](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/techean/32/227_2.png) [@techean](https://community.dynatrace.com/u/techean)\
**Post date:** [July 21, 2022, 11:27am UTC](https://community.dynatrace.com/t/oneagent-on-fargate/19302/9 "2022-07-21T11:27:21Z")

</div>

How you are connecting to Dynatrace api, is there any egress or ingress controller set for the traffic routes exceptionally? also have you mounted the volume as per the map config path?

---

<div class="post-metadata">

**Author:** ![KePe](https://avatars.discourse-cdn.com/v4/letter/k/ecc23a/32.png) [@KePe](https://community.dynatrace.com/u/KePe)\
**Post date:** [July 21, 2022, 12:02pm UTC](https://community.dynatrace.com/t/oneagent-on-fargate/19302/10 "2022-07-21T12:02:54Z")

</div>

We use Dynatrace cloud. As I am pretty new to this&nbsp; I dont get your question. API token is set via DT Cloud UI, for scope I have used PaaS template +ingress scope added. I did not setup any extra controllers&nbsp; Map config path, whats that? I wish even my local docker environment would allow me to see any problem there might be and solve them but if the script outputs just that info: message I dont know what to fix.&nbsp; My integration is build-time/classic as shown here&nbsp;[Monitor AWS Fargate — Dynatrace Docs](https://www.dynatrace.com/support/help/setup-and-configuration/setup-on-cloud-platforms/amazon-web-services/deploy-oneagent-on-aws-fargate#tabgroup--builds--classic-integration)  
What would you expect to see in the following senario:

running local docker,

docker exec -e “DT\_LOGLEVELSDK=finest” --user root -it our-app /bin/bash  
bash-5.1# /opt/dynatrace/oneagent/dynatrace-agent64.sh  
Info: Using DT\_HOME: /opt/dynatrace/oneagent  
bash-5.1# env |grep DT  
DT\_HOME=/opt/dynatrace/oneagent  
DT\_LOGLEVELSDK=finest  
DT\_LOGLEVELCON=finest

No process in the background (just out app running, no DT visible). This is isolated WSL localhost test. Same image we use for AWS testing and same info message and that is everything we get. Build is okay, with the same scope/token we are downloading the one-agent.zip, embeding it into the docker image, all good. As you can see the docker image has got the agent installed, but produces no errors etc.

---

<div class="post-metadata">

**Author:** ![rodrigo\_alvare1](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/rodrigo_alvare1/32/1927_2.png) [@rodrigo\_alvare1](https://community.dynatrace.com/u/rodrigo_alvare1)\
**Post date:** [July 21, 2022, 1:08pm UTC](https://community.dynatrace.com/t/oneagent-on-fargate/19302/11 "2022-07-21T13:08:56Z")

</div>

Hello,

Im not aware of the flag DT\_LOGLEVELSDK , where did you saw that one?  
(The one I used before is " DT\_LOGLEVELCON = info")

If you don’t see logs (besides _Info: using DT\_HOME_…) that means that the agent is not being injected at the process level.

Things that you could check on why it could fail the injection:  
- check the technology used to be monitored (java,.net…)  
- you mentioned that you are using the musl version, try also with the regular version just in case (I remember years ago I had a image that was failing the injection because we though it was alpine, but it wasn’t)  
- try to print the env variable LD\_PRELOAD, it should have a reference to a Dynatrace library&nbsp; (/opt/dynatrace/oneagent/agent/lib64/liboneagentproc.so). I had an scenario where other tools where overriding the LD\_PRELOAD, removing the Dynatrace library so no automatic injection was possible  
- you could do a manual injection on the app process to verify if it is working, for example:  
“export&nbsp;JAVA\_OPTS=“${JAVA\_OPTS}&nbsp;-Xshare:off&nbsp;-Djava.net.preferIPv4Stack=true&nbsp;-agentpath:/opt/dynatrace/oneagent/agent/lib64/liboneagentloader.so=server=hhtps://\<mydynatraceserver\>/e/\<tenant\>:443,tenant=\<tenantID\>,tenanttoken=\<TOKEN\>,loglevelcon=info”  
- The last troubleshooting option I had to do was to modify the dynatrace-agent64.sh to print some echos and verify which steps on that script were executed. (JUST TROUBLESHOOTING PURPOSES)

Regards

---

<div class="post-metadata">

**Author:** ![KePe](https://avatars.discourse-cdn.com/v4/letter/k/ecc23a/32.png) [@KePe](https://community.dynatrace.com/u/KePe)\
**Post date:** [July 22, 2022, 2:13pm UTC](https://community.dynatrace.com/t/oneagent-on-fargate/19302/12 "2022-07-22T14:13:41Z")

</div>

Hi thanks for replying!

Let me provide more details. The image I change is

```markup
FROM kong/kong-gateway:2.8.1.1-alpine

```

So I have used musl (but also default, nginx and all as well)

Currently my Dockerfile is

```markup
FROM kong/kong-gateway:2.8.1.1-alpine
USER root
# Dynatrace OneAgent
ARG DT_API_URL
ARG DT_API_TOKEN
ARG DT_ONEAGENT_OPTIONS="flavor=musl&include=nginx"
ENV DT_HOME="/opt/dynatrace/oneagent"
ENV DT_LOGLEVELCON=info
RUN mkdir -p "$DT_HOME" && \
    wget --quiet -O "$DT_HOME/oneagent.zip" "$DT_API_URL/v1/deployment/installer/agent/unix/paas/latest?Api-Token=$DT_API_TOKEN&$DT_ONEAGENT_OPTIONS" && \
    unzip -d "$DT_HOME" "$DT_HOME/oneagent.zip" && \
    rm "$DT_HOME/oneagent.zip"

RUN apk --no-cache add curl jq

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT ["/opt/dynatrace/oneagent/dynatrace-agent64.sh", "/docker-entrypoint.sh", "kong", "docker-start"]

USER kong

```

To be honest there was NO entrypoint in the original Dockerfile, somehow this container knew that starting point is /docker-enrtypoint.sh (which starts kong nginx smth, probably set in the original “FROM” image). So I knew I have to inject the LD\_PRELOAD before /docker-entrypoint.sh is magically called. I came to this long ENTRYPOINT as you can see above. This runs DT magic first with a set o 3 parameters. And I think this made a change… I have to note that running /dynatrace-agent64.sh wont set the LD\_PRELOAD outside the script, dunno why? Exported var is visible inside the script but not when it finishes

```markup
bash-5.1# /opt/dynatrace/oneagent/dynatrace-agent64.sh
Info: Using DT_HOME: /opt/dynatrace/oneagent
bash-5.1#
bash-5.1# env |grep LD
bash-5.1# env |grep DT
DT_HOME=/opt/dynatrace/oneagent
DT_LOGLEVELCON=info

```

Also maybe you will need that, the LD\_PRELOAD library does not have to overwrite any existing one as nginx does not seam to use the one exported by the DT scritpt?

```markup
bash-5.1# ldd /usr/local/openresty/nginx/sbin/nginx
        /lib/ld-musl-x86_64.so.1 (0x7f3d2958f000)
        libluajit-5.1.so.2 => /usr/local/openresty/luajit/lib/libluajit-5.1.so.2 (0x7f3d28ea4000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7f3d28d03000)
        libopentracing.so.1 => /usr/local/kong/lib/libopentracing.so.1 (0x7f3d28aeb000)
        libssl.so.1.1 => /usr/local/kong/lib/libssl.so.1.1 (0x7f3d28857000)
        libcrypto.so.1.1 => /usr/local/kong/lib/libcrypto.so.1.1 (0x7f3d28366000)
        libz.so.1 => /lib/libz.so.1 (0x7f3d2834c000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f3d28332000)
        libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7f3d2958f000)

```

Anyway the nested and long ENTRYPOINT made a change:

```markup
bash-5.1# ps
PID USER TIME COMMAND
    1 kong 0:00 bash /docker-entrypoint.sh kong docker-start
   11 root 0:00 /bin/bash
 2136 kong 0:00 perl /usr/local/openresty/bin/resty /usr/local/bin/kong prepare -p /usr/local/kong kong docker-start
 2138 kong 0:00 /usr/local/openresty/nginx/sbin/nginx -p /tmp/resty_xxxxxx/ -c conf/nginx.conf
 2169 kong 0:00 nginx -v
 2185 root 0:00 ps

# and container exits to my local linux shell 

root@EPPLWROW0270:~/kong# docker logs kong-xxxxxx
Info: Using DT_HOME: /opt/dynatrace/oneagent
***Welcome to the rocketship***
Running checks...
Enjoy the flight!
/
2022-07-22 12:17:56.641 UTC [0000085a] info [native] ... last message repeated 3 times ...

xxxxx a lot of lines, removed for serurity and clearnes 

2022-07-22 12:18:01.282 UTC [0000085a] info [native] Detected static modules: ndk_http_module (0x5635c723de40) a lot of them nxxxxxxxxxxxxxxx
2022-07-22 12:18:01.282 UTC [0000085a] info [native] Registering agent via core module hook (default; custom array registration viable as well)
2022-07-22 12:18:01.282 UTC [0000085a] info [native] Nginx successfully instrumented

2022-07-22 12:18:01.283 UTC [0000085a] info [native] Agent successfully loaded from '/opt/dynatrace/oneagent/agent/bin/1.243.166.20220701-145555/linux-x86-64/liboneagentnginx.so'

Error: could not prepare Kong prefix at /usr/local/kong: could not find OpenResty 'nginx' executable. Kong requires version 1.19.3.1 to 1.19.9.1

  Run with --v (verbose) or --vv (debug) for more details

```

So DT agent is UP but somehow Kong is complaining about the altered nginx and exits, along with container that dies&nbsp;(I mean I think messing with .so libraries might have caused that?) Why? If I run unmodified&nbsp;container (no entrypoint used so DT wont be started at all)

```markup
bash-5.1# nginx -v
nginx version: openresty/1.19.9.1

```

So the version is within the scope of supported versions by Kong however it is not starting up… I have no idea what to do next, maybe test latest source container.
