Curses, It's Glances

There’s definitely an argument to be made for using lightweight apps that minimize installed dependencies in an effort to: (1) minimize the surface area for vulnerabilities and attack vectors, and (2) reduce application complexity for troubleshooting purposes when something inevitably goes wrong. However, there needs to be a balance between security gains and pleasure in using an application, what’s the point in installing it in the first place if you aren’t going to use it?

An application that sits in the sweet spot is Glances.

Glances uses a plugin archiecture. The documentation contains a current list of available plugins. One of the plugins that deserves highlighting is the AMP (Application Monitoring Process) plugin. AMPs are simple regex statements written into the Glances main glances.conf configuration file that allow the user to monitor any running processes. Glances configuration file is written in the human readable INI format.

Installation

On macOS Catalina, I’m using Homebrew as my package manager.

brew install glances

That’s it. Simple. But if you’re like me, you’ll want to adjust the default configuration. The glances directory does not exist by default, so you’ll also need to create it by doing:

mkdir /usr/local/etc/glances

and then,

cat /usr/local/Cellar/glances/3.1.3/share/doc/glances/glances.conf > /usr/local/etc/glances/glances.conf

Keybindings (Interactive Commands)

A sampling of the in-app toggles that I’ve found useful.

Shift+D show/hide Docker module
Shift+A show/hide AMPs module
move through Tasks menus
h show Help
n show/hide Networks module
1 toggle global CPU and per-CPU stats
2 show/hide left sidebar
5 show/hide top menu

Follow up

Of course, ReadTheDocs.

Glances provides several export options for statistical data. One option is Elasticsearch. Indexing the usage data from macOS to be visualized in Kibana running on localhost is a likely next step.

Derek C. Zoladz
Derek C. Zoladz
Software Developer

Focusing on cultural heritage institutions: discovery applications, data (and metadata) wrangling, web development, process automation, and system integration.