You can download the NGINX Agent artifact from GitHub. For more information about this artifact, see OTel Web Server Module. The NGINX 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 NGINX 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.

Make sure to deploy the OTEL collector and configure the exporter OTLPHTTP endpoint to the Splunk AppDynamics SaaS OpenTelemetry ingestion service endpoint. For more details on collector and how to configure it, see Splunk AppDynamics for OpenTelemetry™.

Download and Install the Agent

  1. Download the NGINX Agent from GitHub
  2. 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
  3. Copy the conf/nginx/opentelemetry_module.conf file to /opt/. See Sample OpenTelemetry Module Configuration File.
  4. Edit the directives values according to your deployment environment. For example, NginxModuleOtelExporterEndpoint must point to the Collector URL.
  5. Edit the nginx.conf file to provide a reference to opentelemetry_module.conf and shared library. See Sample NGINX Configuration File.
  6. 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;
    CODE
  7. Before 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
CODE


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;
	}
CODE

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.

DirectivesDefault ValueConfiguration RequirementRemarks
NginxModuleEnabledONOptional Required to instrument NGINX web server.
NginxModuleOtelSpanExporterotlpOptionalSpecify the span exporter to be used. Currently, the supported values are otlp and ostream.
NginxModuleOtelExporterEndpoint:
RequiredOpenTelemetry exports to this endpoint. For example, docker.for.mac.localhost:4317.
NginxModuleOtelSpanProcessorbatchOptional Supported values are simple and batch.
NginxModuleOtelSamplerAlwaysOnOptionalSupported values are AlwaysOn and AlwaysOff.
NginxModuleOtelMaxQueueSize2048Optional The maximum span queue size. After this size limit is reached, spans are dropped.
NginxModuleOtelScheduledDelayMillis5000OptionalThe delay interval in milliseconds between two consecutive exports.
NginxModuleOtelExportTimeoutMillis30000OptionalThe time duration in milliseconds that export can run before it is canceled.
NginxModuleOtelMaxExportBatchSize512OptionalThe maximum batch size of every export. It must be smaller or equal to maxQueueSize.
NginxModuleServiceName-RequiredA namespace for the ServiceName.
NginxModuleServiceNamespace-RequiredLogical name of the service.
NginxModuleServiceInstanceId-RequiredThe string ID of the service instance.
NginxModuleTraceAsError-OptionalTrace level for logging to Apache log.
NginxModuleWebserverContext-OptionalTakes 3 values (separated by space) ServiceName, ServiceNamespace, and ServiceInstanceId.
NginxModuleSegmentType-OptionalSpecify the string (FIRST/LAST/CUSTOM) to be filtered for the span name creation.
NginxModuleSegmentParameter-OptionalSpecify the segment count or segment numbers that you want to display for the span creation.

Visualizing on Splunk AppDynamics

This image shows how the NGINX Agent data is visualized on the Controller.