How to monitor NGINX

32
How to monitor: Nginx David Mytton Hangout on Air - Oct 2014 blog.serverdensity.com/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 of How to monitor NGINX

Page 1: How to monitor NGINX

How to monitor:Nginx

David MyttonHangout on Air - Oct 2014

blog.serverdensity.com/monitor-nginx/

Page 2: How to monitor NGINX

David Mytton

Page 4: How to monitor NGINX

Server Density Architecture

Page 5: How to monitor NGINX

Server Density Architecture

● ~100 servers - Ubuntu 12.04

Page 6: How to monitor NGINX

Server Density Architecture

● ~100 servers - Ubuntu 12.04

● 50:50 virtual/dedicated

Page 7: How to monitor NGINX

Server Density Architecture

● ~100 servers - Ubuntu 12.04

● 50:50 virtual/dedicated

● 200TB/m processed data

Page 8: How to monitor NGINX

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

Key metrics

● Requests

● Connections

● Status codes

● Server performance

Page 10: How to monitor NGINX

Key metrics

● Requests

● Connections

Page 11: How to monitor NGINX

Key metrics

● Requests

● Connections

Vanity

Page 12: How to monitor NGINX

Key metrics

● Requests

● Connections

Benchmark!

Vanity

Page 13: How to monitor NGINX

ngx_http_stub_status_module

● --with-http_stub_status_module

location /basic_status { stub_status;}

Page 14: How to monitor NGINX

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

Key metrics

● Status codes

Page 16: How to monitor NGINX

Status codes

● 2xx = Success

● 3xx = Redirect

● 4xx = Client error

● 5xx = Server error

Page 17: How to monitor NGINX

Status codes

● Mostly 2xx/3xx

● Sudden spikes?

Page 18: How to monitor NGINX

Status codes

server { access_log /var/log/nginx/access_log combined; ...}

Page 19: How to monitor NGINX

Status codes

tail -f /var/log/nginx/access_log

Page 20: How to monitor NGINX

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

Key metrics

● Server performance

Page 22: How to monitor NGINX

Server performance

● CPU / load average

● Networking (connections)

Page 23: How to monitor NGINX

Server Density

Page 24: How to monitor NGINX

ngx_http_status_module

● Nginx+

demo.nginx.com/status.html

Page 25: How to monitor NGINX

ngx_http_status_module

● Server Density Plugin

serverdensity.com/nginx/

● Monitor backends, status codes, requests

● Recommended alerts

Page 26: How to monitor NGINX

Summary

● Determine baseline key metrics

Page 27: How to monitor NGINX

Key metrics

● Requests

● Connections

● Status codes

● Server performance

Page 28: How to monitor NGINX

Summary

● Determine baseline key metrics

● Nginx metrics + server performance

Page 29: How to monitor NGINX

Summary

● Determine baseline key metrics

● Nginx metrics + server performance

● Manual tools for real time

Page 30: How to monitor NGINX

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

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

Page 32: How to monitor NGINX

どもありがとうございます

@davidmytton

[email protected]

blog.serverdensity.com