186 karma · joined June 28, 2010
[ my public key: https://keybase.io/lebinh; my proof: https://keybase.io/lebinh/sigs/9B2jNoHnF4zRcb06uYKQe76vBRPTfiCzx4iM3rnVHCQ ]
[0] https://github.com/lebinh/ngxtop [1] https://luameter.com/
* Don't write your own data structure, stick to the standard library or, in some rare cases, popular and well-known 3-rd party lib.
* Always prefer a Hash or a Set over anything else.
* Beware of any nested loops.
* Have some local / external caches and try memoization.
* Try parallelizing or better, non-blocking wait for all I/O operations.
About a year ago I open sourced a tool for quick monitoring and troubleshooting Nginx, ngxtop [1], and received some very positive interests from HN community. However quite a few people are using it as a monitoring solution for their Nginx server, which is not ideal. Ngxtop was designed to be like the `top` command, you fire it up to check for at most 5-10 minutes and stop. It was not meant to be a long monitoring process that can be used to plug to your monitoring system such as Zabbix or Nagios or graphed by Graphite. Nginx has an official status module for this [2], but it requires Nginx Plus, a > $1k product. Other solutions would normally require a log processing process piping to an external system to calculate and store the metrics. While an ELK stack [3] could provide you a lot more useful data, its setup and maintenance efforts can be significant. And that's why I created Luameter.
It easier to setup, flexible to configure, and equally easy to be plugged into external system given its JSON api.
[1]: https://github.com/lebinh/ngxtop [2]: http://nginx.com/products/live-activity-monitoring/ [3]: http://www.elasticsearch.org/overview/
Yes, ncurses would be much better but I haven't had time for it yet. Clearing screen is simple enough and work pretty well for me so far so here we are :)
pip install -r requirements.txt
to install required dependencies.