Nginx Real Time Metrics

To get a better idea of how my server for Weather was handling request, I needed a way to get some insights into nginx. I wanted to calculate request per second and routes being accessed. I came across a great tool call ngxtop, a real-time metrics for nginx server. After a few commands ngxtop was up and running on my Digital Ocean Forge server.

  1. Install ngxtop
  • pip install ngxtop
  1. On my forge server, I had to add ngxtop to my path
  • sudo nano ~/.bash_profile
  1. Then type and use ctrl +x to save
  • export PATH=$PATH:./.local/bin/
  1. Finally I had to edit my Nginx Config on Forge and removed this line and restarted nginx
  • # access_log off

Some useful commands

  • Run ngxtop
  • ngxtop
  • View top source IPs of clients
  • ngxtop top remote_addr
  • View 404 status codes
  • ngxtop -i ‘status == 404’

Originally published at Tim Leland.

Show your support

Clapping shows how much you appreciated Tim’s story.