github.com/netdata/go.d.plugin@v0.58.1/modules/nginx/integrations/nginx.md (about) 1 <!--startmeta 2 custom_edit_url: "https://github.com/netdata/go.d.plugin/edit/master/modules/nginx/README.md" 3 meta_yaml: "https://github.com/netdata/go.d.plugin/edit/master/modules/nginx/metadata.yaml" 4 sidebar_label: "NGINX" 5 learn_status: "Published" 6 learn_rel_path: "Data Collection/Web Servers and Web Proxies" 7 most_popular: True 8 message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE" 9 endmeta--> 10 11 # NGINX 12 13 14 <img src="https://netdata.cloud/img/nginx.svg" width="150"/> 15 16 17 Plugin: go.d.plugin 18 Module: nginx 19 20 <img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" /> 21 22 ## Overview 23 24 This collector monitors the activity and performance of NGINX servers, and collects metrics such as the number of connections, their status, and client requests. 25 26 27 It sends HTTP requests to the NGINX location [stub-status](https://nginx.org/en/docs/http/ngx_http_stub_status_module.html), which is a built-in location that provides metrics about the NGINX server. 28 29 30 This collector is supported on all platforms. 31 32 This collector supports collecting metrics from multiple instances of this integration, including remote instances. 33 34 35 ### Default Behavior 36 37 #### Auto-Detection 38 39 By default, it detects NGINX instances running on localhost that are listening on port 80. 40 On startup, it tries to collect metrics from: 41 42 - http://127.0.0.1/basic_status 43 - http://localhost/stub_status 44 - http://127.0.0.1/stub_status 45 - http://127.0.0.1/nginx_status 46 - http://127.0.0.1/status 47 48 49 #### Limits 50 51 The default configuration for this integration does not impose any limits on data collection. 52 53 #### Performance Impact 54 55 The default configuration for this integration is not expected to impose a significant performance impact on the system. 56 57 58 ## Metrics 59 60 Metrics grouped by *scope*. 61 62 The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels. 63 64 65 66 ### Per NGINX instance 67 68 These metrics refer to the entire monitored application. 69 70 This scope has no labels. 71 72 Metrics: 73 74 | Metric | Dimensions | Unit | 75 |:------|:----------|:----| 76 | nginx.connections | active | connections | 77 | nginx.connections_status | reading, writing, idle | connections | 78 | nginx.connections_accepted_handled | accepted, handled | connections/s | 79 | nginx.requests | requests | requests/s | 80 81 82 83 ## Alerts 84 85 There are no alerts configured by default for this integration. 86 87 88 ## Setup 89 90 ### Prerequisites 91 92 #### Enable status support 93 94 Configure [ngx_http_stub_status_module](https://nginx.org/en/docs/http/ngx_http_stub_status_module.html). 95 96 97 98 ### Configuration 99 100 #### File 101 102 The configuration file name for this integration is `go.d/nginx.conf`. 103 104 105 You can edit the configuration file using the `edit-config` script from the 106 Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#the-netdata-config-directory). 107 108 ```bash 109 cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata 110 sudo ./edit-config go.d/nginx.conf 111 ``` 112 #### Options 113 114 The following options can be defined globally: update_every, autodetection_retry. 115 116 117 <details><summary>Config options</summary> 118 119 | Name | Description | Default | Required | 120 |:----|:-----------|:-------|:--------:| 121 | update_every | Data collection frequency. | 1 | no | 122 | autodetection_retry | Recheck interval in seconds. Zero means no recheck will be scheduled. | 0 | no | 123 | url | Server URL. | http://127.0.0.1/stub_status | yes | 124 | timeout | HTTP request timeout. | 1 | no | 125 | username | Username for basic HTTP authentication. | | no | 126 | password | Password for basic HTTP authentication. | | no | 127 | proxy_url | Proxy URL. | | no | 128 | proxy_username | Username for proxy basic HTTP authentication. | | no | 129 | proxy_password | Password for proxy basic HTTP authentication. | | no | 130 | method | HTTP request method. | GET | no | 131 | body | HTTP request body. | | no | 132 | headers | HTTP request headers. | | no | 133 | not_follow_redirects | Redirect handling policy. Controls whether the client follows redirects. | no | no | 134 | tls_skip_verify | Server certificate chain and hostname validation policy. Controls whether the client performs this check. | no | no | 135 | tls_ca | Certification authority that the client uses when verifying the server's certificates. | | no | 136 | tls_cert | Client TLS certificate. | | no | 137 | tls_key | Client TLS key. | | no | 138 139 </details> 140 141 #### Examples 142 143 ##### Basic 144 145 A basic example configuration. 146 147 ```yaml 148 jobs: 149 - name: local 150 url: http://127.0.0.1/stub_status 151 152 ``` 153 ##### HTTP authentication 154 155 Basic HTTP authentication. 156 157 <details><summary>Config</summary> 158 159 ```yaml 160 jobs: 161 - name: local 162 url: http://127.0.0.1/stub_status 163 username: username 164 password: password 165 166 ``` 167 </details> 168 169 ##### HTTPS with self-signed certificate 170 171 NGINX with enabled HTTPS and self-signed certificate. 172 173 <details><summary>Config</summary> 174 175 ```yaml 176 jobs: 177 - name: local 178 url: http://127.0.0.1/stub_status 179 tls_skip_verify: yes 180 181 ``` 182 </details> 183 184 ##### Multi-instance 185 186 > **Note**: When you define multiple jobs, their names must be unique. 187 188 Collecting metrics from local and remote instances. 189 190 191 <details><summary>Config</summary> 192 193 ```yaml 194 jobs: 195 - name: local 196 url: http://127.0.0.1/stub_status 197 198 - name: remote 199 url: http://192.0.2.1/stub_status 200 201 ``` 202 </details> 203 204 205 206 ## Troubleshooting 207 208 ### Debug Mode 209 210 To troubleshoot issues with the `nginx` collector, run the `go.d.plugin` with the debug option enabled. The output 211 should give you clues as to why the collector isn't working. 212 213 - Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on 214 your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`. 215 216 ```bash 217 cd /usr/libexec/netdata/plugins.d/ 218 ``` 219 220 - Switch to the `netdata` user. 221 222 ```bash 223 sudo -u netdata -s 224 ``` 225 226 - Run the `go.d.plugin` to debug the collector: 227 228 ```bash 229 ./go.d.plugin -d -m nginx 230 ``` 231 232