This document explains how to install and enable New Relic's .NET agent on Linux for application performance monitoring.
Install overview
The instructions in this document are for a standard .NET agent installation on Linux. However, some setups have specific install documentation that you should read first:
The file newrelic-netcore20-agent-path.sh is placed in /etc/profile.d, and this will set the CORECLR_NEWRELIC_HOME environment variable on system start.
The path to newrelic.config file is ${CORECLR_NEWRELIC_HOME}/newrelic.config.
Follow the instructions for your package manager:
Configure the New Relic apt repository by adding deb https://apt.newrelic.com/debian/ newrelic non-free to /etc/apt/sources.list.d/newrelic.list:
echo 'deb https://apt.newrelic.com/debian/ newrelic non-free' | sudo tee /etc/apt/sources.list.d/newrelic.list
Enable New Relic's GPG key to allow apt to find New Relic packages. To avoid possible errors about public keys, run this command as root:
Download the package with wget, replacing https://LINK_TO_PACKAGE with the full URL of the package:
wget -L https://LINK_TO_PACKAGE
Extract the agent:
tar xzf newrelic*.tar.gz
Move the newrelic-netcore20-agent directory to /usr/local or your preferred install location.
Verify that the environment variable CORECLR_NEWRELIC_HOME points to the newrelic-netcore20-agent directory and that the directory is readable by monitored .NET processes.
Important
If CORECLR_NEWRELIC_HOME does not exist, create it and point it to the newrelic-netcore20-agent directory.
Verify that the logs directory in the agent home directory is writeable by monitored .NET processes.
Continue to step 2.
Step 2. Enable the agent
Use one of the following methods to set the environment variables that enable the agent and define your license key. For an ASP.NET Core app targeting .NET Core, use the environment variable method.
You can configure your environment using a custom script. The script must define the variables before your app starts.
Caution
Set the environment variables for each application that you want to instrument. If you set these environment variables globally, you could instrument .NET processes other than your apps.
Set the following environment variables, replacing PATH_TO_AGENT_DIRECTORY with the actual path to the .NET Core agent installation folder:
Except for CORECLR_NEWRELIC_HOME, the source /usr/local/newrelic-netcore20-agent/setenv.sh script included with the .NET agent configures the environment variables automatically.
Tip
Set these environment variables before running any apps that you want instrumented. This sets the environment variables only for the current shell and any child processes of that shell.
Set the CORECLR_NEWRELIC_HOME environment variable to the .NET agent installation directory.
Use one of the following methods to set your license key (required) and your app name (optional):