how to monitor nginx
DESCRIPTION
Joined by Rick Nelson, Technical Solutions architect from NGINX Server Density take you though the do's and don'ts of monitoring NGINX. Critical and non critical metrics to monitor, important alerts to configure and the best monitoring tools available.TRANSCRIPT
![Page 1: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/1.jpg)
How to monitor:Nginx
David MyttonHangout on Air - Oct 2014
blog.serverdensity.com/monitor-nginx/
![Page 2: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/2.jpg)
David Mytton
![Page 4: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/4.jpg)
Server Density Architecture
![Page 5: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/5.jpg)
Server Density Architecture
● ~100 servers - Ubuntu 12.04
![Page 6: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/6.jpg)
Server Density Architecture
● ~100 servers - Ubuntu 12.04
● 50:50 virtual/dedicated
![Page 7: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/7.jpg)
Server Density Architecture
● ~100 servers - Ubuntu 12.04
● 50:50 virtual/dedicated
● 200TB/m processed data
![Page 8: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/8.jpg)
Server Density Architecture
● ~100 servers - Ubuntu 12.04
● 50:50 virtual/dedicated
● Nginx, Python, MongoDB
● 200TB/m processed data
![Page 9: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/9.jpg)
Key metrics
● Requests
● Connections
● Status codes
● Server performance
![Page 10: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/10.jpg)
Key metrics
● Requests
● Connections
![Page 11: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/11.jpg)
Key metrics
● Requests
● Connections
Vanity
![Page 12: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/12.jpg)
Key metrics
● Requests
● Connections
Benchmark!
Vanity
![Page 13: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/13.jpg)
ngx_http_stub_status_module
● --with-http_stub_status_module
location /basic_status { stub_status;}
![Page 14: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/14.jpg)
ngx_http_stub_status_module
● --with-http_stub_status_module
Active connections: 291 server accepts handled requests 16630948 16630948 31070465 Reading: 6 Writing: 179 Waiting: 106
accepts should == handled
![Page 15: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/15.jpg)
Key metrics
● Status codes
![Page 16: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/16.jpg)
Status codes
● 2xx = Success
● 3xx = Redirect
● 4xx = Client error
● 5xx = Server error
![Page 17: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/17.jpg)
Status codes
● Mostly 2xx/3xx
● Sudden spikes?
![Page 18: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/18.jpg)
Status codes
server { access_log /var/log/nginx/access_log combined; ...}
![Page 19: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/19.jpg)
Status codes
tail -f /var/log/nginx/access_log
![Page 20: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/20.jpg)
Status codes
$ ngxtoprunning for 411 seconds, 64332 records processed: 156.60 req/sec
Summary:| count | avg_bytes_sent | 2xx | 3xx | 4xx | 5xx ||---------+------------------+-------+-------+-------+-------|| 64332 | 2775.251 | 61262 | 2994 | 71 | 5 |
github.com/lebinh/ngxtop
![Page 21: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/21.jpg)
Key metrics
● Server performance
![Page 22: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/22.jpg)
Server performance
● CPU / load average
● Networking (connections)
![Page 23: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/23.jpg)
Server Density
![Page 24: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/24.jpg)
ngx_http_status_module
● Nginx+
demo.nginx.com/status.html
![Page 25: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/25.jpg)
ngx_http_status_module
● Server Density Plugin
serverdensity.com/nginx/
● Monitor backends, status codes, requests
● Recommended alerts
![Page 26: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/26.jpg)
Summary
● Determine baseline key metrics
![Page 27: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/27.jpg)
Key metrics
● Requests
● Connections
● Status codes
● Server performance
![Page 28: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/28.jpg)
Summary
● Determine baseline key metrics
● Nginx metrics + server performance
![Page 29: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/29.jpg)
Summary
● Determine baseline key metrics
● Nginx metrics + server performance
● Manual tools for real time
![Page 30: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/30.jpg)
Summary
● Determine baseline key metrics
● Nginx metrics + server performance
● Manual tools for real time
● Set up a monitoring product
![Page 31: How to monitor NGINX](https://reader033.vdocuments.site/reader033/viewer/2022050804/55382a194a79595b7a8b46b0/html5/thumbnails/31.jpg)
Useful resources
● http://nginx.org/en/docs/http/ngx_http_stub_status_module.html
● https://www.serverdensity.com/plugins/nginx
● https://blog.serverdensity.com/monitor-nginx
● http://nginx.org/en/docs/http/ngx_http_status_module.html