NGINX

Type of Data

Load Balancer Metrics

Description

NGINX monitoring is a time-based report, based the available data metrics. It provides visibility to customers for metrics that are available in their Openmix applications. The time-based reporting of the NGINX metrics is ingested by Fusion so that customers can see the current and recent performance of the load balancers.

It provides data on NGNIX load balancer and application server health. It displays the metrics of the NGINX Fusion feed in a way that provides feedback to the customer on the health of the NGINX servers. The standard NGINX Fusion integration allows NGINX metrics to be included in Openmix applications.

Data Feed Format

Sample data feed

    {
        "accepts": "5015",
         "active": "4",
         "handled": "5015",
         "reading": "0",
         "requests": "5482",
         "waiting": "3",
         "writing": "1"
    }
<!--NeedCopy-->

Feed values

Metric Feed Value
Accepted Connections accepts
Current Connections activ
Handled Connections handled
Connections Reading reading
Total Requests requests
Connections Idle waiting
Connections Writing writing

Values that can be calculated in the app:

Metric Feed Value
Dropped Connections accepts - handled
Current Requests reading + writing

Configured Info per Load Balancer

Endpoint from where to pull status: http://nginx.org/en/docs/http/ngx_http_stub_status_module.html

Server Configuration

Example Configuration

http://nginx.org/en/docs/http/ngx_http_stub_status_module.html

Metrics collection: NGINX (open-source)

Open source NGINX exposes several basic metrics about server activity on a simple status page, as long as you have the HTTP stub status module enabled.

To check if the module is already enabled, run: nginx -V 2>&1 | grep -o with-http_stub_status_module

The status module is enabled if you see with-http_stub_status_module as output in the terminal. If that command returns no output, you need to enable the status module. You can use the --with-http_stub_status_module configuration parameter when building NGINX from source:

      ./configure \
      … \
      --with-http_stub_status_module
      make
      sudo make install
<!--NeedCopy-->

After verifying the module is enabled or enabling it yourself, you will also need to modify your NGINX configuration to set up a locally accessible URL (for example, /nginx_status) for the status page:

      server {
        location /nginx_status
        {
          stub_status on;
          access_log off;
          allow 127.0.0.1;
          deny all;
        }
      }
<!--NeedCopy-->

Note: The server blocks of the NGINX config are found not in the master configuration file (for example, /etc/nginx/nginx.conf) but in supplemental configuration files that are referenced by the master config. To find the relevant configuration files, first locate the master config by running:

`nginx -t`

Open the master configuration file listed, and look for lines beginning with include near the end of the HTTP block, such as:

`include/etc/nginx/conf.d/*.conf`

In one of the referenced config files you must find the main server block, which you can modify as above to configure NGINX metrics reporting. After changing any configurations, reload the config by executing:

`nginx -s reload`

Now you can view the status page to see your metrics:

      Active connections: 24
      server accepts handled requests
      1156958 1156958 4491319
      Reading: 0 Writing: 18 Waiting : 6
<!--NeedCopy-->

If you are trying to access the status page from a remote machine, you need to whitelist the remote machine’s IP address in your status configuration, just as 127.0.0.1 is white-listed in the configuration snippet above.

The NGINX status page is an easy way to get a quick snapshot of your metrics, but for continuous monitoring you need to automatically record that data at regular intervals. Parsers for the NGINX status page exist for monitoring tools such as Nagios and Datadog, and for the statistics collection daemon collects.

Source: https://www.datadoghq.com/blog/how-to-collect-nginx-metrics/

Set up in Fusion

You can access Fusion Data Feeds from the left navigation pane, under Openmix. For initial steps please refer to the Fusion Integration Documentation.

When you get to the service-specific configuration dialog box, enter the following:

  • Name: The name given to the data feed. This defaults to “Service - Platform Name” if not specified.
  • Run Every: The frequency with which the data feed is updated from the service.
  • Platform: The Platform that is associated with the data feed.
  • URL: The URL is an endpoint on the customer’s network that returns the data that the customer wants to see in Openmix.

Once the installation is complete, it is listed on the Fusion data feeds home page with a green status and monitoring metrics in the log history.

To edit a Fusion data feed click the data feed in the list and then click the Edit button. Once you have changed the configuration, click Save. This brings you back to the data feed list with your changes saved and applied to the data feed.

NGINX