Giter Club home page Giter Club logo

system_monitor's Introduction

system_monitor

A terminal based graphical system monitor, inspired by gotop.

system_monitor

Building

git clone https://github.com/JaMo42/system_monitor
cd system_monitor
git submodule init
git submodule update
make

Note: by default the program links with the -lncurses library but on some systems you may need to change it to -lncursesw (happens automatically on debian-based distros).

Usage

Command-line options

  • -a show average CPU usage
  • -r rate update rate in milliseconds
  • -c always show CPU graph in range 0~100%
  • -f ASCII art process tree (like the --forest option for ps)
  • -l layout specifies the layout
  • -h show help message

If the layout option for -l is ? the current layout string (either the default or the SM_LAYOUT environment variable) gets printed.

Keybindings

  • q: Quit

  • Process navigation

    • k and <Up>: up
    • j and <Down>: down
    • K: up by 5
    • J: down by 5
    • g: jump to top
    • G: jump to bottom
  • Process sorting

    • c: sort by CPU usage (default)
    • m: sort by memory usage
    • p: sort by PID

    Selecting the same sorting mode again toggles between descending and ascending sorting.

  • f: toggle process ASCII art tree view

  • 't': collapse/expand the selected tree

  • T: toggle visibility of kernel threads

  • S: toggle summation of child processes

  • Process searching

    • /: start search
    • n: select next search result
    • N: select previous search result
  • CPU graph

    • a: toggle average CPU usage
    • C: toggle CPU graph range scaling
  • Context menus

    • k and <Up>: up
    • j and <Down>: down
    • <Space> and <Enter>: confirm
    • anything else: cancel

These can be viewed while the application is running by pressing ?.

Mouse control

Process viewer:

If the mouse cursor is above the process viewer the scroll wheel moves the process cursor. Clicking the PID, CPU%, or MEM% headers chooses that sorting mode or toggles between descending and ascending sorting. Clicking a process selects that process, clicking the selected process again opens the context menu. Clicking a item in the context menu selects it, clicking outside the menu cancels it. The context menu should also highlight the element under the cursor however this may not work in some terminals.

Configuration

File

The is configured using the file ~/.config/sm.ini.

Sections and their properties are:

  • sm

    • layout (string) the layout string
    • interval (number) the update interval
    • graph-scale (number) the graph scale
  • cpu

    • show-average (bool) show the average CPU usage instead of each processor
    • scale-heigh (bool) show only required height instead of 0 to 100 percent
  • proc (process viewer)

    • forest (bool) enable forest mode
    • kthread (bool) show kthreads
  • disk

    • vertical (bool) if true, show filesystems in a column
    • mounting-points (string) comma separated list of mounting points of the filesystems to show
  • temp

    • filter (string) comma or semicolon separated whitelist of temperature zones (like thermal_zone0) or types (like acpitz) to show. If empty (the default) zones are not filtered. Example: acpitz,thermal_zone1,thermal_zone2 is equivalent to acpitz;thermal_zone1;thermal_zone2.
    • show-average (bool) show the average of all zones
  • battery

    • battery (string) the battery to display (one of the directories from /sys/class/power_supply). The default is BAT0.
    • slim (bool) if true, use 1 as minimum height instead of 3. Note: I recommend always setting the size of the battery widget in the layout to 0% to enforce the minimum size.
    • show_status (string) comma separated list of battery statuses to show. The default is Charging,Not charging. See the /sys/class/power_supply/<supply_name>/status section here for valid values: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power.

Boolean values can be given as true, yes, or 1 for true and false, no, or 0 for false.

Number values are unsigned integers.

String values may be quoted.

Graph shapes

The graph shape of the cpu, memory, and network widgets can be configured using these options inside their section:

  • graph-kind (string) one of:

    • straight, line straight lines between data points (default for network)
    • bezir, curve bezir curves between data points (default for cpu)
    • blocks, block draw data points as blocks (default for memory)
  • graph-scale (number) horizontal graph scale (default is 8)

Environment variables

  • SM_DISK_FS: disk filesystems string; comma-separated list of mounting points

  • SM_DISK_VERTICAL: if set, the disk usage widget is displayed vertically

Precedence

The precedence for the different configuration ways is:

  • default value

  • config file

  • environment variable

  • commandline option

Layout

A custom layout can be specified via the -l argument.

If not specified the default is (rows 33% c[2] (cols (rows m[1] n[0]) p[3])).

Another example: strict (cols 66% cpu[3] (rows 33% mem[1] (rows net[0] proc[2]))).

Can also be a single widget: cpu.

Syntax

layout-string: ["strict"] (layout | widget-name)
layout:        "(" shape [percent-fist] child child ")"
shape:         rows | cols
rows:          "rows" | "horizontal"
cols:          "cols" | "columns" | "vertical"
percent-first: <number> "%"
child:         widget | layout
widget:        widget-name "[" priority "]"
widget-name:   "cpu" | "memory" | "network" | "processes" | "disk_usage" | "temperature"
priority:      <number>

percent-first is the relative size of the first child of the layout (top for rows, left for columns). If omitted it defaults to 50%, if the given value is greater than 100% it becomes 100%.

The widget-name can be abbreviated to any length as long as it's not ambiguous.

The priority is used to decide which widgets to hide first when the window is too small.

If the entire layout string is prefixed by strict, automatic widget resizing gets disabled.

Small window sizes

If the window is too small to fit all widgets at their preferred relative size it tries to change the relative size of widgets to fit all of them (unless the layout string starts with strict).

If it still can't fit all of them it hides some based on their priority (lower priority means they get hidden first).

If no widget fits it just displays Window too small.

system_monitor's People

Contributors

jamo42 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.