8 ms·
Show HN: Top, but for Nginx
- eterps 6y agoI wouldn't mind a screenshot before installing it.
- theblackcat1002 6y agoIt seems to be a rewrite of ngxtop https://github.com/lebinh/ngxtop https://github.com/lebinh/ngxtop
- dazzawazza 6y agoIt does seem to be that except it doesn't "tail log files" like the original (see limitations at the bottom if the readme.
- fb03 6y agoI thought the same thing. I was expecting to see some kind of screenshot so I could have a glimpse of the software. EDIT: 1# I'm gonna compile it and provide a screenshot via a pull request. 2# Compilation failed because it needed sqlite3 headers and this is not reported in the app. I'm gonna edit that in the readme too :) This year (specially with the whole covid thingy) I set a goal to contribute more to open source. I'm trying to find every little issue I can find and contribute to :P
- squiguy7 6y agoThanks for submitting a patch! I have been throwing around the idea of using the "bundled" feature flag listed here: https://github.com/rusqlite/rusqlite#optional-features https://github.com/rusqlite/rusqlite#optional-features. I was hesitant to initially because it would force users to have a specific version of SQLite.
- fb03 6y agohttps://github.com/gsquire/topngx/pull/1 https://github.com/gsquire/topngx/pull/1 o/
- squiguy7 6y agoI can work on adding that into the README now.
- jrumbut 6y agoThis is the tool I've wanted (and half written 3-4 times) my whole career. From reading the github it looks lightweight, not a big infrastructure addition, and that it helps you figure out wtf is going on with the web server. Regarding the branding, for me top is a real-time tool rather than a logging tool. I was picturing something that may have been more useful for older style Apache httpd installs where you have several virtual hosts on a server and you'd want to know who is hogging the resources or causing the problems.
- deleted 6y ago[deleted]
- squiguy7 6y agoThanks for the feedback. I wanted to capture the same idea as the original tool I listed in the README. In the future I hope to add functionality to tail a log file in real time and do live updates of the stats. This is where the idea of top comes from.
- deleted 6y ago[deleted]
- markstos 6y agoAgreed. The defining feature of `top` is that it updates in real time.
- jluxenberg 6y agoPro tip: you can make any command into a real-time one with `watch`: watch bash -c "topngx < /path/to/access.log" Will run `topngx` against access.log every two seconds and display the output.
- gregoriol 6y agoThat's not "real time"! And definitely won't behave well if the processing takes more than 2 seconds (imagine log files of many millions rows)
- gregoriol 6y agoMaybe not as lightweight, but GoAccess (https://github.com/allinurl/goaccess https://github.com/allinurl/goaccess) does an awesome job at parsing the logs and displaying statistics, works for nginx and other webservers too
- squiguy7 6y agoI hadn't heard of this tool but it looks much more complete! Thanks for sharing.
- guanzo 6y agoGoaccess used to work perfectly, but recently when ever I try to run the real time HTML command, it exits without any error messages after ~2 million records. Maybe out of memory.. any ideas?
- joshyi 6y agoDoubt very much that ~2M will be a memory issue (unless you got less than ~130MB). https://goaccess.io/faq#performance https://goaccess.io/faq#performance We're running v1.4 in production and it has been working pretty nice for us.
- mekster 6y agoLast time I tried it was a pain to set it up to keep up with log rotations and retain all the records.
- joshyi 6y agoFor us it was literately an `apt install goaccess`, picked the COMBINED log format and it's been running for over a month in prod without issues (rotating weekly). You should post the issue on their https://github.com/allinurl/goaccess https://github.com/allinurl/goaccess, they may be able to help you.
- deft 6y agoHow does this compare to goaccess? Similar tool that I've used briefly. One issue I had was how complicated it was, I'm assuming since this is nginx specific it's simpler.
- jimjag 6y agoHmmm... looks like nothing more than a weblog analyzer. Someone correct me if I'm wrong. It's not "real time" since it can only report on what the web-server has done not what it is doing. AFAIK, nginx has nothing like Apache httpd's mod_status... at least, nothing open source.
- mrits 6y agothe latency between weblog and web server is a lot more real time than most things
- oefrha 6y agoOpen source nginx has stub_status. It's just not very (very not) featureful. https://nginx.org/en/docs/http/ngx_http_stub_status_module.html https://nginx.org/en/docs/http/ngx_http_stub_status_module.h...
- dijital 6y agoIf you're in a Kubernetes environment, the NGINX Ingress Controller has a pretty decent set of realtime metrics: https://kubernetes.github.io/ingress-nginx/user-guide/monitoring/ https://kubernetes.github.io/ingress-nginx/user-guide/monito... Which presumably means those metrics are available in the OSS edition somehow...
- cholmon 6y agoWhat frustrates me about Apache's mod_status is that it's powered by a normal request handler. If all the child workers are busy, your request for a status report will timeout, even if you're running it locally from the command line. Not super helpful when you're troubleshooting in real time. Anyone know if there's a "deeper" way to get the same stats info about what Apache is doing without having to basically wait in line with all the other incoming requests?
- maxmalysh 6y agoMonitoring capabilities are missing from Nginx on purpose. They are not and will never be available for free because there is "NGINX Plus". This is why I recommend switching to HAProxy.
- cinericius 6y agoHAProxy also has an 'enterprise' offering[1], what makes this different from nginx plus? [1] https://www.haproxy.com/products/haproxy-enterprise-edition/ https://www.haproxy.com/products/haproxy-enterprise-edition/
- sciurus 6y agoHaproxy's full monitoring capabilities are available in the open source version. Nginx's are not. The stub_status module is very limited. Compare https://www.haproxy.com/blog/exploring-the-haproxy-stats-page/ https://www.haproxy.com/blog/exploring-the-haproxy-stats-pag... with https://nginx.org/libxslt/en/docs/http/ngx_http_stub_status_module.html https://nginx.org/libxslt/en/docs/http/ngx_http_stub_status_...
- cyberpunk 6y agoWhat exactly do you need to monitor on your nginxes? We collect logs, scrape metrics from the nginx pods and... that's enough..
- shockinglytrue 6y agoWish all distros shipped https://github.com/vozlt/nginx-module-vts https://github.com/vozlt/nginx-module-vts by default. It's a minor pain to self-build
- throwaway888abc 6y agoThis is cool!
- rcostin2k2 6y ago
- hk__2 6y ago> This tool is a rewrite of ngxtop to make it more easily installed and hopefully quicker. Why make a whole new tool with limitations instead of improving the existing one?
- dheera 6y agoInteresting, but I would have thought "top" for nginx would be a tool that shows you all the connections, paths, and resource usage live, like the "top" command. Is there a tool that does that?
- madsmtm 6y agoI made something similar in Python [0], but for parsing the error_log directive. Just for the odd time you need to parse that. [0] https://github.com/madsmtm/nginx-error-log https://github.com/madsmtm/nginx-error-log
- randomstring 6y agoMy last company had something like that and included response time percentiles (50th, 90th, 95th, 99th) and we had these values graphed and displayed on a big screen in our office. Along with a ton of other performance stats: queries per second, various measures of system load, etc. Averages can lie, especially when something like an empty query can take close to zero time compared to a non-trivial transaction. If some robot or other artifact of your site is generating a some amount of null queries that will make your average response time look better than it actually is. Percentiles, particularly on the tail of 90th or above, tell a better story of how well and consistently you're responding to traffic under load.
- harpratap 6y agoHow "recent" are your percentiles? I have found that calculating percentiles is a pretty CPU heavy task. And you if you have a giant Grafana querying every 30s it can stress out your prometheus/graphite whatever. But if you take small data size, like 95th percentile of latencies in the last 2minutes, it's not really a very accurate representation either. And ofcourse there is another problem of correctly storing all your latencies accurately which becomes pretty hard if you are using something like prometheus.
- superkuh 6y ago>a rewrite of ngxtop to make it more easily installed and hopefully quicker. What world does this guy live in that a program in Rust is easier to get running on any random machine than python script?
- Kaze404 6y agoI've never had issues shipping Rust binaries to people, unlike in Python where they usually have to install dependencies.
- jblarneyforward 6y agoI had the vague sense that it was as easy to cross-compile rust binaries as it is for go. Distributing single binary would be easier, but `cargo install xyz` seems harder than python script
- squiguy7 6y agoI made a new GitHub release with binaries for Mac and Linux pretty recently. In this sense, you can just download the binary and get up and running.
- deleted 6y ago[deleted]