New Relic Server Monitoring Setup for Website

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Setting Up Server Monitoring with New Relic

New Relic is an observability platform with a free tier up to 100 GB data per month. It includes APM, Infrastructure monitoring, Browser monitoring, and Alerts in one account.

Installing the Infrastructure Agent

# Automatic installation (recommended)
curl -Ls https://download.newrelic.com/install/newrelic-cli/scripts/install.sh | \
  bash && sudo NEW_RELIC_API_KEY="NRAK-..." \
         NEW_RELIC_ACCOUNT_ID="1234567" \
         /usr/local/bin/newrelic install

# Manual installation (Ubuntu)
echo "deb http://apt.newrelic.com/debian/ newrelic non-free" | \
  sudo tee /etc/apt/sources.list.d/newrelic.list

wget -q https://download.newrelic.com/548C16BF.gpg | sudo apt-key add -

sudo apt-get update && sudo apt-get install newrelic-infra

# /etc/newrelic-infra.yml
license_key: your-license-key
display_name: web01.example.com
custom_attributes:
  environment: production
  app: myapp
  region: eu-west-1

PHP APM Agent

# Install PHP agent
wget https://download.newrelic.com/php_agent/archive/10.x.x/newrelic-php5-10.x.x-linux.tar.gz
tar -xzf newrelic-php5-*.tar.gz
cd newrelic-php5-*/
sudo ./newrelic-install install

# php.ini (added automatically)
extension = newrelic.so
newrelic.license = "your-license-key"
newrelic.appname = "MyApp (Production)"
newrelic.distributed_tracing_enabled = true
newrelic.transaction_tracer.enabled = true
newrelic.transaction_tracer.threshold = 500  # ms

Custom Metrics and Events

// Custom metric
newrelic_custom_metric('Custom/OrderProcessing/Duration', $durationMs);
newrelic_custom_metric('Custom/Orders/Total', $order->total);

// Custom event
newrelic_record_custom_event('OrderPlaced', [
    'orderId'  => $order->id,
    'userId'   => $user->id,
    'total'    => $order->total,
    'items'    => $order->items->count(),
]);

// Add attributes to current transaction
newrelic_add_custom_parameter('userId', auth()->id());
newrelic_add_custom_parameter('planType', auth()->user()->plan);

// Name the transaction
newrelic_name_transaction('/orders/checkout');

Node.js APM

// First line in entry point!
require('newrelic');

// newrelic.js
exports.config = {
  app_name: ['MyApp (Production)'],
  license_key: process.env.NEW_RELIC_LICENSE_KEY,
  logging: { level: 'info' },
  allow_all_headers: true,
  distributed_tracing: { enabled: true },
  transaction_tracer: {
    enabled: true,
    transaction_threshold: 500,
  },
};

NRQL Alerts (New Relic Query Language)

-- Alert: high error rate
SELECT percentage(count(*), WHERE error IS true)
FROM Transaction
WHERE appName = 'MyApp (Production)'
SINCE 5 minutes ago

-- Alert: slow transactions p95
SELECT percentile(duration, 95)
FROM Transaction
WHERE appName = 'MyApp (Production)'
SINCE 5 minutes ago

-- Dashboard: top slow database queries
SELECT average(duration), count(*)
FROM DatabaseQuery
FACET query
WHERE appName = 'MyApp (Production)'
SINCE 1 hour ago
LIMIT 20

PostgreSQL Integration

# /etc/newrelic-infra/integrations.d/postgresql-config.yml
integrations:
  - name: nri-postgresql
    env:
      USERNAME: newrelic
      PASSWORD: secure-password
      HOSTNAME: localhost
      PORT: 5432
      DATABASE: myapp
      COLLECT_DB_LOCK_METRICS: true
      ENABLE_SSL: false
    interval: 30s

Implementation Timeline

New Relic Infrastructure + PHP APM agent: 1 day. With custom metrics, NRQL alerts, and Browser monitoring: 2–3 days.