Monitor Nginx Web Server using NGINX Amplify Agent

Nginx Amplify is a cloud based open-source monitoring tool for Nginx, PHP and MySQL applications. It can be used to monitor the performance of your Nginx webserver and also point out errors in your configuration if any, for troubleshooting.

The agent is installed to the host where Nginx is running, it then intelligently collects various metrics and metadata and sends them to the backend for storage and visualization.

Nginx Amplify collects the following metadata from your instance:

  • NGINX metrics – Nginx log files, Nginx process state, Nginx plus status API etc.
  • System metrics – Various metrics from the instance where Nginx is installed e.g CPU usage, network traffic and memory usage.
  • MySQL metrics – MySQL process status, other general metrics e.g current connections, current queries etc.
  • PHP-FPM metrics – PHP-FPM pool status.
  • System Metadata – The basic information about the Operating System where the the agent runs.

Installing Nginx Amplify

Add the following configuration file to the /etc/nginx/conf.d/ directory that will be used to scrap metrics for nginx status.

    $ sudo vim /etc/nginx/conf.d/stub_status.conf
    
    server {
        listen 127.0.0.1:80;
        server_name 127.0.0.1;
        location /nginx_status {
            stub_status on;
            access_log off;
            allow 127.0.0.1;
            deny all;
        }
    }

    Confirm that configuration files in /etc/nginx/conf.d/ have been included in the main configuration file:

    grep -i include\.*conf nginx.conf

    Check if the Nginx configuration syntax is okay :

    $ sudo nginx -t 
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful

    Restart Nginx process:

    sudo service nginx reload

    You can verify if the metrics are being scrapped by using curl.

    $ curl http://127.0.0.1/nginx_status
    Active connections: 2 
    server accepts handled requests
     3280 3280 11339 
    Reading: 0 Writing: 1 Waiting: 1 

    Now, you need to create a free account at Nginx Amplify portal. Upon signing up, you will be prompted with agent installation instructions, which have the API key for your account. Run the commands on your instance as indicated below.

    Also, modify the logging attribute to enable Nginx Amplify agent to get the metrics from the logs:

    After a successful installation, you will be able to see the metrics appear on the Amplify dashboard for the host after one minute. The metrics are normally sent to the dashboard with an interval of one minute.

    You can also get the system metrics for the host:

    You can also configure alerts to your email address.

    That’s it! Your Nginx dashboard is ready for use. Cheers!

    More guides:

    Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

    Recent Post

    Unlock the Right Solutions with Confidence

    At CloudSpinx, we don’t just offer services - we deliver clarity, direction, and results. Whether you're navigating cloud adoption, scaling infrastructure, or solving DevOps challenges, our seasoned experts help you make smart, strategic decisions with total confidence. Let us turn complexity into opportunity and bring your vision to life.

    Leave a Comment

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

    Related Post

    How do I remove a Control Plane or Etcd node from a Kubernetes cluster managed by Kubespray? This guide walks […]

    Both VirtualBox and KVM are hypervisors that can be installed on our local systems as type 2 hypervisors. A hypervisor […]

    OpenSUSE Tumbleweed, created by OpenSUSE project, and among the many worldwide free and opensource community software, is a rolling release […]

    Let's Connect

    Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
    You will get a response from our solutions specialist within 12 hours
    We understand emergencies can be stressful. For immediate assistance, chat with us now

    Contact CloudSpinx today!

    Download CloudSpinx Profile

    Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.