37

Prof Hound / tui · GitLab

 5 years ago
source link: https://gitlab.com/profhound/tui#preview
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Text-based user interface (TUI)

Components

  • fptuitreemap.pas - Main component atm, attempt to draw a tree map in your terminal. See preview below for example output.
  • ezcrt.pas - ScreenWidth, ScreenHeight and other helper methods.
  • ezutils.pas - StringListFromRes to read Resources as StringList(s) from exe binary.

Binaries (Continuous Integration)

curl -L https://gitlab.com/profhound/tui/-/jobs/artifacts/master/raw/fptuitreemap?job=compile_macos > fptuitreemap
curl -L https://gitlab.com/profhound/tui/-/jobs/artifacts/master/raw/fptuitreemap?job=compile_deb64 > fptuitreemap
curl -L https://gitlab.com/profhound/tui/-/jobs/artifacts/master/raw/fptuitreemap.exe?job=compile_win64 > fptuitreemap.exe
./fptuitreemap --help # might need to `chmod +x fptuitreemap` to execute binary

Preview

fptuitreemap Help

-?, --help: This help.
-v, --version: Version.
-f, --file <file>: File to use to read ps listing from. default to ps.tmp if avail, otherwise run the `ps` command below.
                   To generate on a gnu+linux system use: `ps -eo pmem,rss,pid,cmd > ps.tmp`
                   To generate on a macos system use:     `ps -eo pmem,rss,pid,command > ps.tmp`
                   To generate on a busybox system use:   `ps -eo vsz,rss,pid,comm > ps.tmp`
-n, --interval <ms>: Redraw every <ms> milliseconds.
--html <filename>: Creates a Google Chart Treemap HTML file.
--zabbix-discovery [--output <filename>]: Creates a JSON Meta data string with {#NAME} {#PID} object sets.
--zabbix-trapper: Creates a JSON trapper data string.
--readln. Wait after draw for <enter>, --readline=1 by default on windows, except when using a --zabbix-* option.

Download (win64)(502KB) | Download (macos)(416KB) | Download (deb64)(767KB)

Compile from Source(Ubuntu/debian/WSL)

git clone https://gitlab.com/profhound/tui.git
cd tui
sudo apt-get install fp-compiler fp-units-fcl -y
fpc fptuitreemap.pas
ps -eo pmem,rss,pid,cmd > ps.tmp && ./fptuitreemap
# magic... or ./fptuitreemap --help

Zabbix

For more information on Zabbix see the What is Zabbix? section.

You will need to import zbx_export_templates.xml into zabbix and create a <host_name> attached to the template for auto discovery and trapping to work.

Discovery

fptuitreemap.exe --zabbix-discovery -h <host_name> -k process.memory.usage -o <output_file.json>
zabbix_sender -z <example.zabbix.server.com> -p <port> -i <output_file.json>

Trapper

fptuitreemap.exe --zabbix-trapper -h <host_name> -o <output_file.json>
zabbix_sender -z <example.zabbix.server.com> -p <port> -i <output_file.json>

License

MIT/(L)GPL


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK