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
  2. On my forge server, I had to add ngxtop to my path
    sudo nano ~/.bash_profile
  3. Then type and use ctrl +x to save
    export PATH=$PATH:./.local/bin/
  4. Reload bash profile
    source ~/.bash_profile
  5. 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'

Thanks for reading. Make sure you follow me on Twitter to stay up to date on the progress of my side projects T.LYWeather Extension, and Link Shortener Extension. If you are interested in the tech I use daily, check out my uses page.  

Leave a Reply

Your email address will not be published. Required fields are marked *