NGINX Agent configuration

Click here for troubleshooting tips.


You must have the following to perform this procedure:

  • NGINX version 1.4.7 or later.
  • AppMon Web Server Agent installer


The NGINX Agent doesn't communicate with the Collector directly, but through the Web Server Master Agent.

The Web Server Master Agent should be separately started first, before starting the NGINX Agent.

For an overview of the AppMon Web Server Master Agent technology, see Web Server Master Agent Configuration.

With open source NGINX 1.9.11, dynamic module loading via load_module was introduced. Please note that the classic agent does not support this feature and will cause crashes. Dynamic modules are not supported by Classic Agent and requires to switch the agent platform.

Activate the NGINX Agent

As NGINX offers no user-facing API for interfacing with its functionality programmatically, the NGINX Agent needs to be started in a somewhat non-typical way. The following factors are involved:

  • A file containing addresses (offsets) of specific functions and data fields within the NGINX binary.
  • Manual load of the Agent library into NGINX process memory using system LD_PRELOAD functionality.

Offset file

The offsets file contains the instrumentation information which is used at Agent startup to instrument the NGINX binary. In most situations, the Agent generates the file at startup.

Classic Agent Certain circumstances require manual file generation and the Agent writes an appropriate script to disk to request the user to execute it from command line.

Loading the agent at NGINX startup

The NGINX Agent starts by preloading. You need to set the environment variable LD_PRELOAD in the NGINX startup script:

LD_PRELOAD=/opt/dynatrace-7.0/agent/lib64/ nginx

Make sure to use the Agent library matching the bitness of your NGINX: one from the lib directory for 32-bit NGINX or one from lib64 for 64-bit NGINX.

The agent looks for configuration, including the offset file, in ../conf/ starting from its location on disk. Logs are typically written to ../logs/, although this can be changed in dtwsagent.ini located in the configuration directory.