Archive · DevOps

New Relic: Infrastructure and APM Agents

Install the infrastructure agent on a Linux host and the Node.js APM agent in an application.

1 min read

  • New Relic One
  • Infrastructure agent
  • Node.js agent
  • Ubuntu 22.04 LTS

New Relic’s free tier includes 100 GB of data ingest a month and one full platform user, enough to learn the product.

Host metrics with the guided installer (needs your licence key and account ID):

curl -Ls https://download.newrelic.com/install/newrelic-cli/scripts/install.sh | bash
sudo NEW_RELIC_API_KEY=<key> NEW_RELIC_ACCOUNT_ID=<id> /usr/local/bin/newrelic install
sudo systemctl status newrelic-infra

Within a few minutes the host appears under Infrastructure with CPU, memory, disk and network.

Application traces for Node.js:

npm install newrelic
cp node_modules/newrelic/newrelic.js .
# set app_name and license_key (use environment variables in production)
node -r newrelic server.js

Set NEW_RELIC_APP_NAME and NEW_RELIC_LICENSE_KEY as environment variables so the key never reaches Git. APM then shows response time, throughput, error rate and slow transactions.

Check the ingest graph in Data management regularly: verbose logs are the usual cause of surprise overages.