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
plugin is included with the SolarWinds Snap Agent by default, please follow the directions below to enable it for a agent instance.
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
/opt/SolarWinds/Snap/etc/plugins.d/nginx.yaml
configuration 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 configuration file to help you get started quickly. It defines the plugin and task file to be loaded by the agent, but requires you to provide the correct settings for your NGINX server. To enable the plugin:
- Make a copy of the NGINX example configuration file
/opt/SolarWinds/Snap/etc/plugins.d/nginx.yaml.example
, renaming it to/opt/SolarWinds/Snap/etc/plugins.d/nginx.yaml
:
Copy$ sudo cp /opt/SolarWinds/Snap/etc/plugins.d/nginx.yaml.example /opt/SolarWinds/Snap/etc/plugins.d/nginx.yaml
- Update
/opt/SolarWinds/Snap/etc/plugins.d/nginx.yaml
configuration file with settings specific to your NGINX server, for example:
Copycollector:
# Read Nginx's basic status information (ngx_http_stub_status_module)
nginx:
all:
## An array of Nginx stub_status URI to gather stats.
urls: |
http://localhost/server_status
http://otherhost/status
## Optional SSL Config
# tls_ca: /path/to/cafile
# tls_cert: /path/to/certfile
# tls_key: /path/to/keyfile
## Use SSL but skip chain & host verification
# insecure_skip_verify: false
## HTTP response timeout (default: 5s)
response_timeout: "5s"
load:
plugin: snap-plugin-collector-bridge-nginx
task: task-bridge-nginx.yaml
- Restart the agent:
Copy$ sudo service swisnapd restart
- Enable the NGINX plugin in the AppOptics UI
On the Integrations Page you will see the NGINX plugin available if the previous steps were successful. If you do not see the plugin, see Troubleshooting Linux.
Select the NGINX plugin to open the configuration menu in the UI, and enable the plugin.
You should soon see the
nginx
metrics reported to your dashboard.
Metrics and Tags
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 |
When the APM Integrated Experience is enabled, AppOptics shares a common navigation and enhanced feature set with the other integrated experiences' products. How you navigate AppOptics and access its features may vary from these instructions. For more information, go to the APM Integrated Experience documentation.
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.