Guide: Installing New Relic Agent on Nginx

guide:-installing-new-relic-agent-on-nginx

I was so excited when setting up New Relic. The tool seemed so fresh and slick!

Everything was going smoothly until I started to setup nginx agent. The process has been finished, but there was an error.

⊘  NGINX Open Source Integration  (unsupported)
  Installation incomplete. Follow the instructions at the URL below to complete the installation process.

This happened on every machine 😕
Re-installing did no help 😕
The docs they offered were too messy and also did not help 😕
I started to search their forum. It turns out to be a popular problem. The only solution they offered is to contact support. But I need to pay before getting access to support. Such a shame! 😤

So I spend a few hours with ChatGPT and a barrel of coffee and figured it out. Here is a step-by-step guide on how to install a New Relic agent on your nginx.

The guide

1) Proceed with the agent install process as they say in the docs.

Use the generated cURL link or sudo apt install nri-nginx.

2) Throw in those to create a config file.

cd /etc/newrelic-infra/integrations.d
sudo cp nginx-config.yml.sample nginx-config.yml
sudo cp /etc/newrelic-infra/logging.d/nginx-log.yml.example /etc/newrelic-infra/logging.d/nginx-log.yml

3) Check if your nginx has the required monitoring module called http_stub_status_module.

nginx -V 2>&1 | grep -o with-http_stub_status_module

If your nginx does not have it, get it. Mine had.

4) Change the status URL:

cd /etc/newrelic-infra/integrations.d
sudo nano nginx-config.yml

Set STATUS_URL to something like this:

STATUS_URL: https://my-domain.com/status where my-domain.com is a domain from your nginx config.

5) Restart it.

sudo systemctl restart newrelic-infra

6) Add the status page and the IP of your server:

cd /etc/nginx/sites-enabled && nano default
server {
    # other stuff
    server_name my-domain.com.com;    

    location /status {
        stub_status on; 
        access_log off;
        allow 1.1.1.1; # set your server IP here 🚨
    }
    # other stuff
}

7) Reload nginx:

sudo service nginx reload

Go to New Relic and have fun.

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
hidden-gems-of-bigquery — part-3

Hidden gems of BigQuery — Part 3

Next Post
spearheading-saas-in-2023:-a-closer-look-at-this-year’s-industry-thought-leaders

Spearheading SaaS in 2023: A closer look at this year’s industry thought-leaders

Related Posts