Zenith - sort of like top or htop but with zoom-able charts, CPU, GPU, network, and disk usage

Overview

Zenith

In terminal graphical metrics for your *nix system written in Rust

Running zenith on iTerm2 on MacOS

Features

  • Optional CPU, Memory, Network, and Disk usage charts
  • Quick glances at Disk free space, NIC IP addresses, CPU frequency
  • Highlight top users of CPU, Memory, & Disk
  • Battery percentage, time to charge or discharge, power used
  • A top-like filterable process table that includes per process disk usage
  • Change process priority
  • Zoomable chart views (with support to scroll back in time)
  • Managing processes with signals
  • Performance data saved between runs
  • GPU Utilization Metrics for NVIDIA GPUs (with --features nvidia)

Planned Features

  • CPU steal percentage and general virtualization awareness
  • Sensor Temperature charts
  • Per process network usage (Linux)
  • Messaging about adverse system events, like errors in kernel ring buffer (Linux)
  • Docker support
  • ZFS (pool status)
  • GPU utilization metrics for AMD GPUS
  • Disk metrics like IO ops / latency
  • Support Memory pressure

Current Platforms

  • Linux
  • MacOS

Planned Platforms

  • BSD (OpenBSD/FreeBSD)
  • Perhaps Redox OS.

Installation

Packaging status

Binary

Download one of the compiled releases.

Debian/Ubuntu based Linux distributions (64-bit)

The latest 64-bit deb packages are available here and require distributions based on Debian >= 9 or Ubuntu >= 16.04

Arch Linux

Three packages for zenith are available in AUR: zenith, zenith-git and zenith-bin

The zenith-bin package uses the deb package mentioned in previous section and can be used to avoid building the package from source. The first two depend on rust/cargo and it is recommended to install the rustup package from AUR instead of the rust package from official repositories. This allows for easy installation of rust components as per what rust officially documents. You will need to install a toolchain separately with rustup so use something like:

yay -S rustup
rustup toolchain install stable
rustup default stable

Change the 'stable' toolchain above to beta/nightly/... if you have some specific preference. After this install the zenith or zenith-git package (latter will track the latest git revision): yay -S zenith

Homebrew

brew install zenith

Building

This builds under rustc version >= 1.40.0.

cd zenith
cargo build --release

For NVIDIA GPU support, build with feature nvidia:

cargo build --release --features nvidia

The minimum supported NVIDIA driver version is 418.56

There is also a Makefile that detects the presence of NVIDIA driver on the current system and builds the appropriate flavor on Linux.

make && sudo make install

If for some reason the Makefile incorrectly detects NVIDIA driver installation or in case of a broken installation (e.g. libnvidia-ml.so.1 present but no libnvidia-ml.so) then explicitly skip it using the base target:

make base && sudo make install

The default installation path is /usr/local so make install requires root privileges above. To install in a custom location use PREFIX like below:

make && make install PREFIX=$HOME/zenith

There is also an 'all' target in the Makefile that will build both the flavors on Linux, if NVIDIA driver is detected, and 'make install' will then copy a wrapper 'zenith' script that chooses the appropriate binary at runtime.

Static build

The make file provides for building fully static versions on Linux against the musl C library. It requires musl-gcc to be installed on the system. Install "musl-tools" package on debian/ubuntu derivatives, "musl-gcc" on fedora and equivalent on other distributions from their standard repos.

Use the target "linux-static" to build it. This will create a tarball containing the executable accompanied with file containing sha256 sum.

NVIDIA drivers normally do not ship with static versions of the libraries, so the static build skips that configuration. However, if you somehow get hold of static NVIDIA libraries or are okay for dynamic linking for that executable, then you can explicitly set the BUILD_NVIDIA flag to true:

make linux-static BUILD_NVIDIA=true

Building with NVIDIA support in a virtual environment

If one needs to build with NVIDIA support in a virtual environment, then it requires some more setup since typically the VM software is unable to directly expose NVIDIA GPU. Unlike the runtime zenith script, the Makefile has been setup to detect only the presence of required NVIDIA libraries, so it is possible to build with NVIDIA support even when without NVIDIA GPU.

Install the nvidia driver package as per the distribution recommended way. For example in Ubuntu < 18.04 add the NVIDIA PPA (https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa) and install the nvidia-430 package. For newer versions install nvidia-driver-440/450 package.

After that disable the actual use of the driver using "sudo prime-select intel". Then while building with Makefile you will need to explicitly add the NVIDIA library path to LD_LIBRARY_PATH. For instance on Ubuntu and derivatives, something like:

  export LD_LIBRARY_PATH=/usr/lib/nvidia-430
  make && sudo make install

Building deb package

Debian package support is present in the source tree. Install devscripts package and use standard options like "debuild -b -uc -us" to build an unsigned deb package in the directory above. In a virtual environment build, LD_LIBRARY_PATH can be explicitly set like:

debuild -eLD_LIBRARY_PATH=/usr/lib/nvidia-430 -b -uc -us

Cargo can be installed from the repositories or the standard rustup way. Latter would be normally recommended if one needs to do anything more than just building in a virtual environment. For that case $HOME/.cargo/bin should be in PATH and mark PATH so that debuild does not sanitize it:

debuild -ePATH -eLD_LIBRARY_PATH=/usr/lib/nvidia-430 -b -uc -us

Clean up using "./debian/rules clean" rather than "make clean" to clear debian build files too.

Usage

Running with no arguments starts zenith with the default visualizations for CPU, Disk, and Network and a refresh rate of 2000 ms (2 seconds). These can be changed with command line parameters:

    zenith [FLAGS] [OPTIONS]

FLAGS:
        --disable-history    Disables history when flag is present
    -h, --help               Prints help information
    -V, --version            Prints version information

OPTIONS:
    -c, --cpu-height         Min Percent Height of CPU/Memory visualization. [default: 17]
        --db              Database to use, if any. [default: ~/.zenith]
    -d, --disk-height        Min Percent Height of Disk visualization. [default: 17]
    -n, --net-height         Min Percent Height of Network visualization. [default: 17]
    -p, --process-height     Min Percent Height of Process Table. [default: 32]
    -r, --refresh-rate       Refresh rate in milliseconds. [default: 2000]
    -g, --graphics-height    Min Percent Height of Graphics Card visualization. [default: 17]

The graphics-height option only applies when NVIDIA GPU support has been enabled.

Don't want a section? Remove it by setting the height to 0.

For example: zenith -c 0 removes the CPU chart.

Up/down arrow keys move around the process table. Return (enter) will focus on a process. Tab switches the active section. Active sections can be expanded (e) and minimized (m). +/- (or =/-) will zoom in / out all of the charts. Arrow keys (←/→) move forward/backward in time. Back tick (`) resets the chart to current time and max zoom. Using these options you can create the layout you want.

In zenith 'h' key will show this help:

Running zenith on iTerm2 on MacOS

Built using these great crates

Comments
  • Increasing memory usage

    Increasing memory usage

    Frequently, after using zenith for more than 24-28h memory usage follows a steady trend, reaching over 200MiB (used, not virtual) memory, as reported by zenith itself. This is not a sudden recent behavior, it has been there for at least one release.

    Even when loading history, zenith starts at a much more reasonable ~18MiB.

    Here are 2 memory profiles, that have run for over 24h. They were taken using valgrind's massif, with zenith built locally at d66adc51291

    For viewing, massif-visualizer is a pretty good tool to explore the profiles.

    bug 
    opened by alexmaco 22
  • Zenith does not start

    Zenith does not start

    What happens

    Zenith launches to a blank screen and appears to hang. No information is shown. No response to ^C or ^D.

    I tried using --disable-history, but it didn't change anything.

    System Info

    Version: 0.7.7 Distro: Arch Linux 5.5.13-zen2-1-zen Terminals: Kitty, Alacritty, Konsole

    $ hwinfo --short
    cpu:
                           AMD Ryzen 7 1700X Eight-Core Processor, 2770 MHz
    graphics card:
                           ATI RX Vega64
    storage:
                           Samsung Electronics NVMe SSD Controller SM961/PM961
                           ASRock In Fatal1ty X370 Professional Gaming
                           AMD FCH SATA Controller [AHCI mode]
    network:
      enp37s0              Intel I211 Gigabit Network Connection
      wlp36s0              Intel Dual Band Wireless-AC 7265
    
    bug 
    opened by iicurtis 17
  • Outdated Cargo.lock file?

    Outdated Cargo.lock file?

    zenith is currently failing to build for Homebrew with Rust 1.49 on Apple Silicon: https://github.com/Homebrew/homebrew-core/pull/68089, https://github.com/Homebrew/homebrew-core/pull/68720

    It appears this is due to a stale lock file, causing cargo install --locked to pull in dependencies that do not work for zenith on Apple Silicon. Is it possible for the Cargo.lock file to be updated? If this could be done with a new release, that would be especially helpful.

    I've already tried to use the updated lock file at https://github.com/bvaisvil/zenith/pull/90, but that, too, still leads to a failed build.

    Related: https://github.com/Homebrew/homebrew-core/issues/68301

    opened by carlocab 16
  • Support for deb package build

    Support for deb package build

    Initially was playing around with creating a flatpak package but discovered that its sandboxed environment does not allow access to main /proc. The sandbox /proc only lists the flatpak processes, and the filesystems are also virtual ones of the sandbox so dropped the idea. This PR adds deb package creation which will work on a large number of systems. No RPM since I don't use them and it has been a very long time I had last taken a look at RPM spec files. I can also host a PPA on Ubuntu launchpad if required.

    • Added debian directory with required build files, as also desktop and icon files to launch it from standard menus. A Makefile at the top encapsulates the various build actions.

    • The icon file is a generic one taken from pngkey which is royalty and attribution free. It has been compressed from its initial size.

    • Makefile build creates both the normal build and an NVIDIA enabled one. A wrapper shell script then chooses the appropriate binary depending on whether NVIDIA device and library is present.

    • Removed build-linux-static.sh which is now covered in "make linux-static". Like above, the new target creates two binaries, and then tarball containing the two with the wrapper script is created by the target (as also the sha256 file).

    opened by sumwale 16
  • Using PPA, can't upgrade from v0.11.0 to v0.12.0

    Using PPA, can't upgrade from v0.11.0 to v0.12.0

    I'm using the amd64 PPA, and my system shows zenith 0.12.0 is available, but when I try to upgrade, I get this message:

    ✦ ➜  sudo apt upgrade zenith
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Calculating upgrade... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     zenith : Depends: libgcc-s1 (>= 4.2) but it is not installable
    E: Broken packages
    
    bug 
    opened by dwvisser 12
  • Arch Linux -- . zenith.lock

    Arch Linux -- . zenith.lock

    Anytime I restart zenith I get an error advising me that the dot zenith dot lock file is still active even though I quit zenith or closed window.

    And this happens even after reboot. It's not a huge problem rm .zenith.lock But it is a major annoyance and inconvenience.

    Thanks. Really like this program.

    bug 
    opened by dedguy21 12
  • Allow zenith to start when another instance is running, and add warnings

    Allow zenith to start when another instance is running, and add warnings

    related: #107

    Right now, this only starts without writing to the db.

    It adds a warning in the top right on the main screen, and an explanation on the help screen. The wording and formatting of the warnings are subject to bikeshedding :).

    I think the original issue could remain open, until a more complete handling for this scenario lands.

    opened by alexmaco 9
  • Use percentages for relative heights of panels

    Use percentages for relative heights of panels

    To avoid cutting off panels altogether, use percentages for the various panels instead of fixed heights (for all but process panel).

    By default the process panel occupies 10% more space than other non-zero ones.

    See the comparison in the two attached screenshots for before and after the patch in my default terminal having a size of 140x40.

    original updated

    These screenshots compare maximized terminal windows for before and after where the two are similar. original-fullscreen updated-fullscreen

    opened by sumwale 8
  • high cpu usage

    high cpu usage

    On a Intel i7-9850H (6 core), zenith is using 1-2% CPU according to itself. On a AMD 3995WX (64 core), it is at a steady 30-35% + has a perceptible lag when starting/stopping. It seems like something scaling badly with the CPU count.

    opened by fkm3 7
  • [ISSUE-64] Account for refresh rate in network/disk updates

    [ISSUE-64] Account for refresh rate in network/disk updates

    • added "tick" field to CPUTimeApp for the configured refresh rate (note that HistogramMap.tick cannot be used since it may be recovered from previous database having an old tick value)
    • likewise added the "tick" field to ZProcess
    • use the above to convert the raw value to rate in CPUTimeApp.update_networks and ZProcess get_read_bytes_sec and get_write_bytes_sec
    opened by sumwale 7
  • Aborted (core dump) on ARMv7 Linux

    Aborted (core dump) on ARMv7 Linux

    Hi @bvaisvil,

    I've tried zenith 0.10.0 on the ARMv7 Linux board. It is custom yocto-based Linux build:

    # uname -a
    Linux msm8909 3.18.71 #1 SMP PREEMPT Wed Aug 12 17:26:02 UTC 2020 armv7l armv7l armv7l GNU/Linux
    

    I've cross-compiled zenith on Ubuntu 18.04 for the armv7-unknown-linux-gnueabihf target. I always get crush at the startup.

    # RUST_LOG=debug zenith --db=/tmp/zenith
    [DEBUG zenith::render] Setup Constraints
    [DEBUG zenith::render] Create Metrics App
    [DEBUG zenith::metrics] Create Histogram Map
    [DEBUG zenith::histogram] Opening DB
    [DEBUG zenith::histogram] Starting a new database.
    
    thread 'main' has overflowed its stack
    fatal runtime error: stack overflow
    Aborted (core dumped)
    

    Db path need to be changed because home folder is read-only.

    bug 
    opened by lexxvir 7
  • install: cannot stat 'build/static/zenith.base': No such file or directory

    install: cannot stat 'build/static/zenith.base': No such file or directory

    I tried to make a musl build, but get this error:

    mkdir -p build/dynamic
    rm -f build/dynamic/zenith.nvidia
    install -m 755 target/release/zenith build/dynamic/zenith.nvidia
    make[1]: Leaving directory '/tmp/zenith'
    mkdir -p build/static-bundle
    install: cannot stat 'build/static/zenith.base': No such file or directory
    make: *** [Makefile:105: linux-static] Error 1
    
    opened by rongcuid 4
  • ZFS Pool usage over 100% when FS gets resized

    ZFS Pool usage over 100% when FS gets resized

    When using ZFS as a file system, the various zvols have a "maximum capacity" of what is free on the root pool. This results in Zenith assuming that over 100% is free when the free capacity exceeds the maximum capacity.

    image

    bug 
    opened by 5trubel 3
  • Reducing the necessity for `--disable-history`

    Reducing the necessity for `--disable-history`

    Frequently, when I open a new terminal session to a machine that's already running zenith from somewhere else, it fails to start, and I have to pass --disable-history, which is also a bit long to type.

    I suggest we could add some smarter behavior for this situation - if zenith detects another instance running, it should still start, and display metrics. This could either mean it starts independently of the database, and perhaps shows an indicator to this effect in the top right. or automatically start reading history, but not writing it.

    For the second case, when the other zenith instance is stopped, the current instance could race with any other instance to take ownership of the history db, and keep recording.

    enhancement 
    opened by alexmaco 1
  • Improvements to TUI controls

    Improvements to TUI controls

    How would you feel about making the keyboard controls more in line with other TUI applications?

    / usually means search/filter, in htop, less, vim, etc. However zenith uses this to reverse the sort order in the process table. I think something like ; (or anything else) would be better for reordering, which frees up / to do the usual free that's already in many muscle memories.

    Second, after returning from a per-process view, the filtering mode is not active anymore. So before clearing it, to go back one step further to the unfiltered view, one has to press a key to activate it again. I don't know if this is intended for a usecase, so I would suggest either:

    • that filtering stay active if it was active before zooming into a process
    • use a sort of background highlight/inverted view to emphasize the input field for filtering when it is actually active

    Thoughts?

    enhancement 
    opened by alexmaco 1
  • Add Support for Intel GPUs on Linux

    Add Support for Intel GPUs on Linux

    Hi, I recently discovered your project and found it really cool and well done.

    When I've tried the GPU support for Nvidia, it worked perfectly! But when I wanted to see if you had implemented the same for Intel GPU's, I saw nothing in the Graphics Devices part.

    It would be nice to implement the support for Intel GPUs along the others that are planned in #27.

    For now I'm using intel_gpu_top from the debian/ubuntu package intel-gpu-tools and here is how it looks so far:

    image

    I don't know if that's possible in rust, maybe there is no library for that 🤔

    BTW, in case you don't find anything useful within the intel-gpu-tools package, you can give a try to the package/command clinfo:

    $ clinfo
    Number of platforms                               1
      Platform Name                                   Intel Gen OCL Driver
      Platform Vendor                                 Intel
      Platform Version                                OpenCL 2.0 beignet 1.3
      Platform Profile                                FULL_PROFILE
      Platform Extensions                             cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_3d_image_writes cl_khr_image2d_from_buffer cl_khr_depth_images cl_khr_spir cl_khr_icd cl_intel_accelerator cl_intel_subgroups cl_intel_subgroups_short cl_khr_gl_sharing
      Platform Extensions function suffix             Intel
    
      Platform Name                                   Intel Gen OCL Driver
    Number of devices                                 1
      Device Name                                     Intel(R) HD Graphics Kabylake ULT GT3
      Device Vendor                                   Intel
      Device Vendor ID                                0x8086
      Device Version                                  OpenCL 2.0 beignet 1.3
      Driver Version                                  1.3
      Device OpenCL C Version                         OpenCL C 2.0 beignet 1.3
      Device Type                                     GPU
      Device Profile                                  FULL_PROFILE
      Device Available                                Yes
      Compiler Available                              Yes
      Linker Available                                Yes
      Max compute units                               48
      Max clock frequency                             1000MHz
      Device Partition                                (core)
        Max number of sub-devices                     1
        Supported partition types                     None, None, None
    

    I don't know how to code in rust yet but let me know if I can help for testing things. 😉

    opened by Jiab77 1
Releases(0.13.1)
Owner
Benjamin Vaisvil
Software Engineer, Computer Scientist, Accidental Biologist doing Bioinformatics, Statistics, and Biology.
Benjamin Vaisvil
A blazingly fast Insertion Sort and Quick Sort visualizer built with Rust and WASM.

sortysort A blazingly fast Insertion Sort and Quick Sort visualizer built with Rust and WASM. Try it in your browser from here Testing locally cargo r

null 3 Jan 28, 2022
Yet another sort crate, porting Golang sort package to Rust.

IndexSort IndexSort Yet another sort crate (in place), porting Golang's standard sort package to Rust. Installation [dependencies] indexsort = "0.1.0"

Al Liu 4 Sep 28, 2022
🎦 ezz is a simple CLI tool to schedule Zoom meetings

ezz ezz (cheesy abbreviation for easy Zoom) is a simple CLI tool to schedule Zoom meetings. Install With cargo installed: $ cargo install --path . Aut

Eduardo Cuducos 6 Dec 23, 2022
A CLI tool which can help you automatically kill process of your choice. Useful for freeing up memory and CPU usage!

Quickiller There are always programs such as chrome that keep eating up your resources even when closed! The only way to prevent this is to kill all o

Codingsquirrel 1 Dec 8, 2021
App to collect ram/cpu usage from OS and show it in pretty graphs

System info collector This is simple app to collect data about system cpu and memory usage over time. After collecting results into csv file, html fil

Rafał Mikrut 3 Jul 11, 2023
Raspberry Pi's CPU and GPU temperature exporter for Prometheus consumption.

Pi Temperature Exporter A simple application for collecting Raspberry Pi's CPU and GPU temperatures and exporting them for Prometheus consumption. Ins

Sergei 11 Mar 12, 2023
A small script in rust to get the cpu usage in %'s with a gradient color for the text

cpu_usage-polybar A small script in rust to get the cpu usage in %'s with a gradient color for the text To get it to work on your PC you will have to

Sara 4 Apr 18, 2023
A bit like tee, a bit like script, but all with a fake tty. Lets you remote control and watch a process

teetty teetty is a wrapper binary to execute a command in a pty while providing remote control facilities. This allows logging the stdout of a process

Armin Ronacher 259 Jan 3, 2023
CLI app to display list of trending anime, music charts or recommend anime to watch or song to listen to.

Description Anitrendz is a cli app that uses data from the anitiop api to list the top anime and songs or recommend a random anime to watch or song to

Jimmy 9 Jun 11, 2022
a rust crate for drawing fancy pie charts in the terminal

piechart piechart is a rust crate for drawing fancy pie charts in the terminal. Example usage: use piechart::{Chart, Color, Data}; fn main() { le

Jakob Hellermann 35 Dec 30, 2022
Human numeric sorting program — does what `sort -h` is supposed to do!

hns — Human Numeric Sort v0.1.0 (⏫︎2022-09-20) © 2022 Fredrick R. Brennan and hns Authors Apache 2.0 licensed, see LICENSE. man page Packages hns_0.1.

Fredrick Brennan 7 Sep 25, 2022
Filter, Sort & Delete Duplicate Files Recursively

Deduplicator Find, Sort, Filter & Delete duplicate files Usage Usage: deduplicator [OPTIONS] [scan_dir_path] Arguments: [scan_dir_path] Run Dedupl

Sreedev Kodichath 108 Jan 27, 2023
A library for loading and executing PE (Portable Executable) from memory without ever touching the disk

memexec A library for loading and executing PE (Portable Executable) from memory without ever touching the disk This is my own version for specific pr

FssAy 5 Aug 27, 2022
garbage-collecting on-disk object store, supporting higher level KV stores and databases.

marble Garbage-collecting disk-based object-store. See examples/kv.rs for a minimal key-value store built on top of this. Supports 4 methods: read: de

Komora 215 Dec 30, 2022
Terminal disk space navigator 🔭

Given a path on your hard-drive (which could also be the root path, eg. /). diskonaut scans it and indexes its metadata to memory so that you could explore its contents (even while still scanning!).

Aram Drevekenin 1.6k Dec 30, 2022
Executables on Disk? Bleh 🤮

Executables on Disk? Preposterous! Saving executables to disk is like telling EDRs that "Hey! Take a look at this thing I just fetched from the Intern

whokilleddb 87 Dec 18, 2022
A user-friendly, lightweight TUI for disk imaging

Caligula Burning Tool Caligula is a user-friendly, lightweight TUI for imaging disks. $ caligula burn -h Burn an image to a disk Usage: caligula burn

Astrid Yu 25 Mar 26, 2023
💾Saving Your Hard Disk, One Project at a Time

nodemore ?? Nodemore Recursively Searches Directories for Unused Projects Contents Why? Installation Usage Configuration Why? NodeJS has a horrible wa

Will 13 Apr 16, 2023
A simple disk benchmark tool.

simple-disk-benchmark A simple disk benchmark tool. Operating Systems Currently, macOS and Linux are tested. Windows may work but is not tested. Devel

Jonathan Wight 7 Jul 31, 2023