NGINX Agent configuration

Click here for troubleshooting tips.

Prerequisites

You must have the following to perform this procedure:

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

Classic Agent The Apache Agent doesn't communicate with the Collector directly, but through the Web Server Master Agent, which should be started first, before starting NGINX Agent. See the Architecture section on the Web Server Master Agent Configuration page for details.

OneAgent The Apache Agent communicate with the Collector directly. Web Server Master Agent is not needed. See OneAgent configuration.

Activate the AppMon 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/libdtagent.so 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.