Skip to content

graphdat/plugin-nginx

Repository files navigation

Boundary Nginx Free Plugin

A Boundary plugin that collects metrics from an Nginx Free instance. This plugin is not intended for the Nginx Plus edition as other metrics are relevant and available there.

Prerequisites

Supported OS

OSLinuxWindowsSmartOSOS X
Supportedvvvv

Boundary Meter versions v4.2 or later

For Boundary Meter earlier than v4.2

Runtimenode.jsPythonJava
Required+

Plugin Setup

To collect statistics from nginx, it needs to built with the nginx HttpStubStatusModule. If you used a package manager to install Nginx, it should be compiled by default, if you built Nginx yourself, you may need to recompile it.

Verify That nginx Includes HttpStubStatusModule

  1. To check if your nginx has been build with the nginx HttpStubStatusModule run the following command, which will display the modules that are compiled in your version of nginx:

$ nginx -V ``` 2. If the string --with-http_stub_status_module is in the output then the installed `nginx` includes the `HttpStubStatusModule`. If the string is not there, you will need to install a package that includes the module or compile a version that includes it. Information on installing and/or compiling `nginx` can found here: http://nginx.org/en/docs/install.html

HttpStubStatusModule Configuration

nginx requires configuration to provide URL path which will present the nginx statistics.

  1. Edit your default /etc/nginx/conf.d/virtual.conf file (or whatever .conf file you are using) and add the following configuration in your server{} block:

location /nginx_status{# activate stub_status module stub_status on;

# do not log graphdat polling the endpoint access_log off; # restrict access to local only allow 127.0.0.1; deny all; # optional, should be JSON by default status_format json; 

} ``` 2. Ensure that a listen address is configured in /etc/nginx/conf.d/virtual.conf under the server{} block as well. An complete example that configures the HttpStubStatusModule is shown here:

 ``` server{listen 8000; location /nginx_status{# activate stub_status module stub_status on; # do not log graphdat polling the endpoint access_log off; # restrict access to local only allow 127.0.0.1; deny all} } ``` 
  1. Once you make the update, reload your nginx configuration:
     $ sudo service nginx reload

Verify HttpStubStatusModule is Collecting Statistics

  1. Run the following command, which shows the expected output:
    $ curl http://localhost:8000/nginx_status Active connections: 1 server accepts handled requests 5 5 5 Reading: 0 Writing: 1 Waiting: 0

Plugin Configuration Fields

Field NameDescription
SourceThe Source to display in the legend for the nginx data. It will default to the hostname of the server
Statistics URLThe URL endpoint of where the nginx statistics are hosted.
Strict SSLUse Strict SSL checking when HTTPS is enabled, enabled by default
UsernameIf the endpoint is password protected, what username should graphdat use when calling it.
PasswordIf the endpoint is password protected, what password should graphdat use when calling it.

Metrics Collected

For All Versions

Metric NameDescription
Nginx Active ConnectionsActive connections to nginx
Nginx ReadsConnections with Nginx reading request headers
Nginx WritesConnections with Nginx reading request body, processing request or writing response to client.
Nginx WaitingKeep-alive connections with Nginx in a wait state
Nginx Connections HandledConnections handled by nginx
Nginx Connections Not HandledConnections accepted, but not handled
Nginx RequestsRequests to nginx
Nginx Requests per ConnectionRequests per handled connections for nginx

Dashboards

  • NGINX Free

References

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 7