Documentation forAppOptics

NGINX

Overview

NGINX is an open source web server with a strong focus on high concurrency, performance and low memory usage. It's one of the most popular web servers on the internet, and can also act as a reverse proxy, a load balancer, or as an HTTP cache.

The SolarWinds Snap Agent allows you to easily monitor the health of your NGINX service(s). It requires that your nginx binary is compiled with the stub_status module enabled.

Setup

The nginx monitoring is accomplished by bridge plugin which is included with the SolarWinds Snap Agent by default. Follow the directions below to enable it for an agent instance. The bridge plugin utilize Telegraf NGINX plugin.

Prerequisites

The NGINX server being monitored must have the stub_status module compiled into its binary. Most distributions have this enabled by default. This can be verified with the following command:

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

Your NGINX server will need a location defined with the stub_status module activated. Here is a sample definition that allows connections from the local agent and works with our default plugin configuration.

server {
    location /server_status {
        stub_status on;
        access_log off;
        allow 127.0.0.1;
        deny all;
    }
}

In addition, you'll need to adjust the URL setting in the task-bridge-nginx.yaml task file to match your particular setup.

The server blocks of the NGINX config are typically in the supplemental configuration files that are referenced by the master config. Locate the master config with:

nginx -t

Open the master configuration file, and search for include near the end of the file. Find the server block in one of the referenced config files and modify it as referenced above, then reload NGINX:

nginx -s reload

Configuration

The agent provides an example task file to help you get started quickly, but requires you to provide the correct settings for your NGINX installation. To enable the task:

  1. Make a copy of the NGINX example task file task-bridge-nginx.yaml.example`, renaming it to task-bridge-nginx.yaml:

    On Windows, using Explorer or PowerShell:

    copy "C:\ProgramData\SolarWinds\Snap\tasks-autoload.d\task-bridge-nginx.yaml.example" "C:\ProgramData\SolarWinds\Snap\tasks-autoload.d\task-bridge-nginx.yaml"

    On Linux using command line:

    sudo cp -p /opt/SolarWinds/Snap/etc/tasks-autoload.d/task-bridge-nginx.yaml.example /opt/SolarWinds/Snap/etc/tasks-autoload.d/task-bridge-nginx.yaml
  2. Edit the task file with settings specific to your NGINX install:

    If you wish to also collect logs for this service, uncomment the last section in the example task file. For more information on collecting logs, see the logs collector docs.

    ---
    version: 2
    
    schedule:
      type: cron
      interval: "0 * * * * *"
    
    plugins:
      - plugin_name: bridge
    
        config:
          nginx:
            ## An array of Nginx stub_status URI to gather stats.
            urls:
              - http://localhost/server_status
    
            ## Optional TLS Config
            # tls_ca: /path/to/cafile
            # tls_cert: /path/to/certfile
            # tls_key: /path/to/keyfile
            
            ## Use TLS but skip chain & host verification
            # insecure_skip_verify: false
    
            ## HTTP response timeout (default: 5s)
            response_timeout: "5s"
    
        publish:
          - plugin_name: publisher-appoptics
    
    ## If you want to gather logs for this integration, uncomment the following section.
    #  - plugin_name: log-files
    #    config:
    #      file_paths:
    #        - /var/log/nginx/access.log
    #        - /var/log/nginx/error.log
    
    #    publish:
    #      - plugin_name: loggly-http-bulk
  3. Restart the agent:

    On Windows command line:

    net stop swisnapd
    net start swisnapd

    On Linux command line:

    sudo service swisnapd restart
  4. Enable the NGINX integration in AppOptics

    On the Integrations Page you will see NGINX integration available if the previous steps were successful. It may take a couple minutes before the NGINX integration is identified. Select the NGINX integration to open the configuration menu in the UI, and enable it. If you do not see it, see Troubleshooting Linux.

Testing Integration

To check if and what metrics can be collected with given configuration, run bridge plugin in debug mode:

On Windows command line:

"C:\Program Files\SolarWinds\Snap\bin\snap-plugin-collector-bridge.exe" --debug-mode --plugin-config "{\"nginx\": {\"urls\": [\"http://localhost/server_status\"]}}"

On Linux command line:

/opt/SolarWinds/Snap/bin/snap-plugin-collector-bridge --debug-mode --plugin-config "{\"nginx\": {\"urls\": [\"http://localhost/server_status\"]}}"

Metrics and Tags

Metrics

The table below lists each of the metrics collected by the NGINX plugin.

Name Description
nginx.accepts Total number of accepted client connections
nginx.active Number of active client connections including waiting connections
nginx.handled Total number of handled connections
nginx.reading Number of connections where nginx is reading the request header
nginx.requests Total number of client requests
nginx.waiting Number of idle connections waiting for a request
nginx.writing Number of connections where nginx is writing the response to the client

Tags

The table below lists each tag available for the NGINX plugin.

Tag Name Description
hostname Name of the host. Instead of using this tag we recommend using the @host alias.
port Port number
server Name of the server

Navigation Notice: When the APM Integrated Experience is enabled, AppOptics shares a common navigation and enhanced feature set with other integrated experience products. How you navigate AppOptics and access its features may vary from these instructions.

The scripts are not supported under any SolarWinds support program or service. The scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.