is generally considered to be a code smell. The problem being that when you're catching all exception information and throwing it away you will never know what went wrong and where. If you're doing a try/except Exception nested inside another except Exception then I would humbly suggest that you really need to think about refactoring and restructuring.
Also, anywhere that you see a repeating pattern, you might be better off wrapping it in a function or method rather than typing it out each time. For example in your __update__ method starting at about line 400 you've got pretty much the same code in two places with just a variable different between the two.
You should essentially never use sudo to install any package, since even besides any security issues, it can clobber things on your system that are necessary for your OS (by say, upgrading a package that your OS ships with).
I happen to not use my system's shipped Python at all, since I'm on OSX, but if you are using it, you want to use `pip install --user mything`, no sudo necessary.
The psutil library doesn't use process accounting, does it? Without it, Glances will miss processes whose lifetime is within a single check interval.
As always when this topic comes up, I have to give a recommendation for atop. This LWN article goes into why it is awesome- https://lwn.net/Articles/387202/ . The logging and interactive examination of historical process-level metrics is the killer feature for me. Here are some screenshots- http://atoptool.nl/screenshots.php
Of course, nothing beats tools like Munin. I even put business metrics there.
You can also launch glances.py directly so if it is going to show up on the process list it will be as 'glances.py' and not just 'python'.
Would you run this or would you run htop? I'm not sure when I'd use one over the other.
Maybe someone less dense than I knows more and can tell me what the differences are?
Normally to get network and disk stats I have to run a combination of dstat, iotop. A simple screenshot comparison: http://i.imgur.com/eQPuQ.png
OTOH htop takes up ~2MB per instance, while glances is taking up ~13MB. Glances also doesn't have the ability to sort by columns except by CPU/mem %. You can't kill browse or kill processes from the list either.
Again, I have no idea how to present that nicely.
One thing that iStat menus lacks, and I was hoping Glances had (but appears not to) is a "top" like viewer for what is using bandwidth. Both applications only give the overall bandwidth usage. I'll see my bandwidth shoot up hundreds of Kbps out of nowhere and quickly try to determine what's using it through combinations of looking at open programs (maybe they're updating in the background), lsof -i, nettop if I can remember the name, but haven't been particularly keen on any of them. Any recommendations?
uch a tease:
The excellent Amit Singh rants about how useful procfs is and how Mac doesn't have it, but then says it's not really needed, and then almost builds it anyway, then gives up due to unrelated hardware problems:
This case is one of the more blatant demonstrations showing the superiority of The Unix Way of "everything is a file. "
There used to be this small, simple tool called "ntop" which did exactly that - top, but for active network connections.
Then the authors decided to go apeshit and add everything and the kitchen sink to it ... a GUI, an http server, all kinds of crazy features as they attempted to slot it as some kind of end-all-be-all enterprise monitoring software.
I had some hacked up source tarballs that continued to allow me to run the old, circa 2002 ntop on systems as old as FreeBSD 6.x, but it no longer compiles under 8.x.
tl;dr: ntop used to exist but the devs had dollar signs in their eyes and mutated it beyond all recognition.
sudo add-apt-repository ppa:arnaud-hartmann/glances-stable && sudo apt-get update && sudo apt-get install glances
1. Install Homebrew if you don't have it already
brew install brew-pip
export PYTHONPATH=$(brew --prefix)/lib/python2.7/site-packages
brew pip Glances
I have to say, I think this will replace htop for me on my mac. It's actually more useful than Activity Monitor is since it also shows network interfaces.
% wget https://github.com/downloads/nicolargo/glances/glances-1.4.tar.gz
% tar zxvf glances-1.4.tar.gz
% cd glances-1.4
% sudo python setup.py install
"ERROR: Certificate verification error for github.com: unable to get local issuer certificate"
Anyhow, I agree that using --no-check-certificate is usually a bad idea.
I was playing with htop but it's not really any better than top.
Shameless plug: http://www.youtube.com/watch?v=yFKRsLj_Jhg
It's available through the EPEL yum repository http://dl.fedoraproject.org/pub/epel/6/x86_64/repoview/atop....
I'm not sure what being on a VM has to do with anything.
It would be nice if there was a way (e.g. a command-line argument or atoprc setting) to disable the ability to kill processes from within atop; then it would be safer for an admin to make it executable as root by regular users.
For interactive use it is sufficient to install ATOP with the command (as root):
This is a CLI. Usually the font is chosen by the term emulator, not the program.