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.
- Install ngxtop
pip install ngxtop
- On my forge server, I had to add ngxtop to my path
sudo nano ~/.bash_profile
- Then type and use ctrl +x to save
export PATH=$PATH:./.local/bin/
- Reload bash profile
source ~/.bash_profile
- 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.LY, Weather Extension, and Link Shortener Extension. If you are interested in the tech I use daily, check out my uses page.