# Linux Apache - chroot

**URL:** <https://community.dynatrace.com/t/linux-apache-chroot/20585>\
**Category:** Open Q&A\
**Tags:** apache\
**Created:** [May 9, 2019, 7:59am UTC](https://community.dynatrace.com/t/linux-apache-chroot/20585 "2019-05-09T07:59:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dimitris\_pistio](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@dimitris\_pistio](https://community.dynatrace.com/u/dimitris_pistio)\
**Post date:** [May 9, 2019, 7:59am UTC](https://community.dynatrace.com/t/linux-apache-chroot/20585/1 "2019-05-09T07:59:29Z")

</div>

A customer runs Apache on a linux host in a chroot directory. What’s the best practice for monitoring the Apache process in this case?

---

<div class="post-metadata">

**Author:** ![david\_n](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/david_n/32/12978_2.png) [@david\_n](https://community.dynatrace.com/u/david_n)\
**Post date:** [May 9, 2019, 7:46pm UTC](https://community.dynatrace.com/t/linux-apache-chroot/20585/2 "2019-05-09T19:46:27Z")

</div>

Hello Dimitris,

If Dynatrace does not detect you process automatically you can use a process detection rule and add the executable path so that Dynatrace can be pointed directly to the Apache process.

To do that go to settings → processes and containers → process group detection → custom process group detection rule.

Thanks,  
David Nicholls

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [May 10, 2019, 7:09am UTC](https://community.dynatrace.com/t/linux-apache-chroot/20585/3 "2019-05-10T07:09:04Z")

</div>

I think it depends on the actual situation.  
If the Apache is the only process to be monitored on the host and the full stack agent does not work in your case, you can use the PaaS agent

However, I think with proper settings and mapping oneagent directories into the chroot and setting the LD\_PRELOAD you should be able to use the full stack oneagent on your host in the chroot environment.

---

<div class="post-metadata">

**Author:** ![dimitris\_pistio](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@dimitris\_pistio](https://community.dynatrace.com/u/dimitris_pistio)\
**Post date:** [May 10, 2019, 10:07am UTC](https://community.dynatrace.com/t/linux-apache-chroot/20585/4 "2019-05-10T10:07:20Z")

</div>

Thank you Julius for your answer.

Can you provide some more info on how to deploy the PaaS agent? I find documentation for Azure WebApps, Cloud Foundry, Openshift and Kubernetes platforms.

What steps should i follow in this case?

If not using the PaaS installer,

would the following settings solve my issue?

#!/bin/bash

CHROOT=/new/root/directory

mkdir -p $CHROOT/var/lib/dynatrace

mount -o bind /var/lib/dynatrace/ $CHROOT/var/lib/dynatrace/

mkdir -p $CHROOT/opt/dynatrace

mount -o bind /opt/dynatrace/ $CHROOT/opt/dynatrace

mount -o bind /dev/ $CHROOT/dev

cp /etc/resolv.conf $CHROOT/etc/resolv.conf

Please advise also where to set the LD\_PRELOAD variable.

Thank you

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [May 10, 2019, 12:03pm UTC](https://community.dynatrace.com/t/linux-apache-chroot/20585/5 "2019-05-10T12:03:48Z")

</div>

The LD\_PRELOAD is typically set from /etc/ld.so.preload and typically is set to /lib/x86\_64-linux-gnu/liboneagentproc.so

So you need to either add /lib/x86\_64-linux-gnu/liboneagentproc.so to the chroot and set the LD\_PRELOAD correctly or you can try to point it to /opt/dynatrace/oneagent/agent/lib64/liboneagentproc.so (I did not try - it may not work).

The PaaS agent can be downloaded from this URL (replace tenant and api token)  
\<tenant\>/api/v1/deployment/installer/agent/unix/paas/latest?Api-Token=\<api token\>&arch=x86&flavor=default

But don’t forget you have to manually upgrade the PaaS agent. For usage of PaaS agent, I’d recommend seeing the docs for Solaris OneAgent as it only exists as PaaS. (There are no docs about PaaS agent on Linux, since typically you install the full-stack agent).

---

<div class="post-metadata">

**Author:** ![djschnei](https://avatars.discourse-cdn.com/v4/letter/d/eada6e/32.png) [@djschnei](https://community.dynatrace.com/u/djschnei)\
**Post date:** [April 12, 2024, 2:08pm UTC](https://community.dynatrace.com/t/linux-apache-chroot/20585/6 "2024-04-12T14:08:25Z")

</div>

Hey Julius, sorry to bump this old topic, but dealing with something very similar.&nbsp; Running Java apps in a Nomad Cluster.&nbsp; Nomad and it’s Java task driver utilizes chroot to isolate the workloads.&nbsp; &nbsp;When I disable isolation, auto-instrumentation works as expected.&nbsp; However, trying to figure out if it’s possible to inject the agent into a java task without breaking the isolation.&nbsp; I’ve added all the relevant directories to the chroot environment and tried using the LD\_PRELOAD method, but it doesn’t seem to be working.&nbsp; Would Java be a different story?
