Download PDF
Download page Install the NGINX Agent.
Install the NGINX Agent
You can download the agent artifact from the agent from GitHub. This agent is based on CentOS 7 and contains shared libraries for Apache and NGINX instrumentation. The shared libraries are available at WebServerModule/Apache
or WebServerModule/Nginx
for respective web servers. However, the common libraries for OpenTelemetry are available at sdk_lib/lib/
. The shared libraries are used for both Apache and NGINX instrumentation.
Currently, the agent build is based on the x86-64 architecture. Therefore, the artifact should work on any Linux distribution running on the x86-64 platform and having glibc version >= 2.17
.
Download and Install the Agent
- Download the agent from GitHub.
Extract and install the agent to
/opt
.tar -xf opentelemetry-webserver-sdk-x64-linux.tgz -C /opt cd /opt/opentelemetry-webserver-sdk/ ./install.sh
CODE- Copy the
conf/nginx/opentelemetry_module.conf
file to/opt/
. See Sample OpenTelemetry Module Configuration File. - Edit the directives values according to your deployment environment. For example,
NginxModuleOtelExporterEndpoint
must point to the Collector URL. - Edit the
nginx.conf
file to provide a reference toopentelemetry_module.conf
and shared library. See Sample NGINX Configuration File. Follow the below command sequence and location while referring to
conf/nginx/nginx.conf
.load_module /opt/opentelemetry-webserver-sdk/WebServerModule/Nginx/ngx_http_opentelemetry_module.so; include /opt/opentelemetry_module.conf;
CODEBefore you start the NGINX Agent, update
LD_LIBRARY_PATH
to load OpenTelemetry dependencies.export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/opentelemetry-webserver-sdk/sdk_lib/lib
CODE
Sample opentelemetry_module.conf
NginxModuleEnabled ON;
#NginxModule Otel Exporter details
NginxModuleOtelSpanExporter otlp;
NginxModuleOtelExporterEndpoint docker.for.mac.localhost:4317;
# SSL Certificates
#NginxModuleOtelSslEnabled ON
#NginxModuleOtelSslCertificatePath
#NginxModuleOtelSpanProcessor Batch
#NginxModuleOtelSampler AlwaysOn
#NginxModuleOtelMaxQueueSize 1024
#NginxModuleOtelScheduledDelayMillis 3000
#NginxModuleOtelExportTimeoutMillis 30000
#NginxModuleOtelMaxExportBatchSize 1024
NginxModuleServiceName DemoService;
NginxModuleServiceNamespace DemoServiceNamespace;
NginxModuleServiceInstanceId DemoInstanceId;
NginxModuleResolveBackends ON;
NginxModuleTraceAsError ON;
#NginxModuleWebserverContext DemoService DemoServiceNamespace DemoInstanceId
#NginxModuleSegmentType custom
#NginxModuleSegmentParameter 15,1,6,7
Sample nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
load_module /opt/opentelemetry-webserver-sdk/WebServerModule/Nginx/ngx_http_opentelemetry_module.so;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
include /opt/opentelemetry_module.conf;
}
Configuration Directives
You can configure these directives based on your deployment needs. A dash ("-") in a table cell indicates that this column is not relevant to the directive.
Directives | Default Value | Configuration Requirement | Remarks |
---|---|---|---|
NginxModuleEnabled | ON | Optional | Required to instrument NGINX web server. |
NginxModuleOtelSpanExporter | otlp | Optional | Specify the span exporter to be used. Currently, the supported values are otlp and ostream . |
NginxModuleOtelExporterEndpoint: | Required | OpenTelemetry exports to this endpoint. For example, docker.for.mac.localhost:4317 . | |
NginxModuleOtelSpanProcessor | batch | Optional | Supported values are simple and batch . |
NginxModuleOtelSampler | AlwaysOn | Optional | Supported values are AlwaysOn and AlwaysOff . |
NginxModuleOtelMaxQueueSize | 2048 | Optional | The maximum span queue size. After this size limit is reached, spans are dropped. |
NginxModuleOtelScheduledDelayMillis | 5000 | Optional | The delay interval in milliseconds between two consecutive exports. |
NginxModuleOtelExportTimeoutMillis | 30000 | Optional | The time duration in milliseconds that export can run before it is canceled. |
NginxModuleOtelMaxExportBatchSize | 512 | Optional | The maximum batch size of every export. It must be smaller or equal to maxQueueSize . |
NginxModuleServiceName | - | Required | A namespace for the ServiceName. |
NginxModuleServiceNamespace | - | Required | Logical name of the service. |
NginxModuleServiceInstanceId | - | Required | The string ID of the service instance. |
NginxModuleTraceAsError | - | Optional | Trace level for logging to Apache log. |
NginxModuleWebserverContext | - | Optional | Takes 3 values (separated by space) ServiceName , ServiceNamespace , and ServiceInstanceId . |
NginxModuleSegmentType | - | Optional | Specify the string (FIRST/LAST/CUSTOM) to be filtered for the span name creation. |
NginxModuleSegmentParameter | - | Optional | Specify the segment count or segment numbers that you want to display for the span creation. |
Visualizing on AppDynamics
This image shows how the NGINX Agent data is visualized on the AppDynamics Controller.