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

Linux Apache - chroot

dimitris_pistio
Participant

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?


5 REPLIES 5

david_n
Inactive

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


Julius_Loman
DynaMight Legend
DynaMight Legend

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.


Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

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


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).


Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

Hey Julius, sorry to bump this old topic, but dealing with something very similar.  Running Java apps in a Nomad Cluster.  Nomad and it's Java task driver utilizes chroot to isolate the workloads.   When I disable isolation, auto-instrumentation works as expected.  However, trying to figure out if it's possible to inject the agent into a java task without breaking the isolation.  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.  Would Java be a different story? 

Featured Posts