A basic terminal-based observer for the Erlang VM. At a minimally viable stage now.
It's being developed in parallel with ex_termbox and Ratatouille, which respectively provide termbox bindings and a terminal UI kit for Elixir / Erlang.
First, clone the repo and run mix deps.get
. Then to run the application:
COOKIE=$(ps -ef | grep $NAME_OF_APP_TO_BE_MONITORED | grep beam | awk -F"setcookie " '{print $2}' | awk '{print $1}')
iex --sname toby --erl "-setcookie $COOKIE" -S mix
The default configuration in config.exs only discovers nodes on the same host via epmd. Other connections should be possiblewith a different libcluster config.
mix release
RELEASE_COOKIE=$COOKIE _build/dev/rel/toby/bin/toby start
It's also possible to create a distributable, self-contained executable via Distillery. I'd like to provide these for download in the future, but for now you can build one yourself using the provided config.
Releases built on a given architecture can generally be run on machines of the same architecture.
MIX_ENV=prod mix release --executable --transient
See the output for the location of the built executable (most likely at
_build/prod/rel/toby/bin/toby.run
).
This is a Distillery release that bundles the Erlang runtime and the toby application. Start it in the foreground:
_build/prod/rel/toby/bin/toby.run foreground
You can also move this executable somewhere else (e.g., to a directory in your $PATH). A current caveat is that it must be able to unpack itself, as Distillery executables are self-extracting archives.
These are nice tools written in pure Erlang, but I was looking for a user experience closer to htop or terminal vim/emacs. Pure-Erlang tools cannot access raw terminal events; they can only get line-buffered input (i.e., some characters and then a return).
Because toby uses the termbox library (an alternative to ncurses) under the hood, it can support interactions like scrolling with the keyboard or mouse, clicking, or pressing a single key to perform an action. It also doesn't flicker on updates, and it can respond to window resizes by automatically performing a relayout of the content. These things unfortunately aren't possible in pure Erlang, as it requires putting the terminal into "raw" mode. Toby relies on NIFs from ex_termbox in order to do this.
Yes, it certainly is, but the idea isn't to run this in the same VM as your production code.
Rather, it's to run toby as a separate, hidden node and simply connect it to your node or cluster via Erlang distribution protocol. This is similar to how a C node works. By running toby in a separate VM, even if one of the NIFs causes a segfault in the observer node, it should not affect the node(s) being observed.
- Implement views from observer on a basic level:
- System
- Load Charts
- Memory Allocators
- Applications
- Processes
- Ports
- Tables
- Node information
- Support connecting to other nodes:
- Via the application UI
- Via the CLI
- Actions on applications, ports, processes and tables.
- Sorting
- Processes
- Tables
- Tracing integration