This commit is contained in:
parent
3e50a67047
commit
03f5163ccf
153
README.md
153
README.md
|
@ -6,81 +6,44 @@
|
|||
</div>
|
||||
<br><br>
|
||||
|
||||
Another terminal based graphical activity monitor, inspired by [gtop](https://github.com/aksakalli/gtop) and [vtop](https://github.com/MrRio/vtop), this time written in [Go](https://golang.org/)!
|
||||
一个基于终端的图形活动监视器, 基于[xmtop](https://github.com/xxxserxxx/gotop) 使用Go语言编写
|
||||
|
||||
Join us in [\#gotop:matrix.org](https://app.element.io/#/room/#gotop:matrix.org) ![](https://img.shields.io/matrix/gotop:matrix.org) ([matrix clients](https://matrix.to/#/#gotop:matrix.org)).
|
||||
|
||||
> Badges? We don't need no stinking badges!
|
||||
|
||||
<div align="center">
|
||||
|
||||
![](https://github.com/xxxserxxx/gotop/workflows/Build%20Go%20binaries/badge.svg)
|
||||
![](https://img.shields.io/librariesio/github/xxxserxxx/gotop)
|
||||
[![](https://img.shields.io/badge/go%20report-A-green.svg?style=flat)](https://goreportcard.com/report/github.com/xxxserxxx/gotop/v4)
|
||||
|
||||
![](https://img.shields.io/github/v/release/xxxserxxx/gotop)
|
||||
![](https://img.shields.io/github/release-date/xxxserxxx/gotop)
|
||||
![](https://img.shields.io/github/downloads/xxxserxxx/gotop/total?sort=semver)
|
||||
|
||||
</div>
|
||||
|
||||
See the [change log](/CHANGELOG.md) for release updates.
|
||||
看看 [更新日志](/更新日志.md) 最新版本都带来那些变化
|
||||
|
||||
<img src="./assets/screenshots/demo.gif" />
|
||||
|
||||
</div>
|
||||
|
||||
## Installation
|
||||
## 安装
|
||||
|
||||
Working and tested on Linux, FreeBSD and MacOS. Windows binaries are provided, but have limited testing. OpenBSD works with some caveats; cross-compiling is difficult and binaries are not provided.
|
||||
目前xmtop主要适配 龙架构 和 x86架构 的linux系统
|
||||
|
||||
If you install gotop by hand, or you download or create new layouts or colorschemes, you will need to put the layout files where gotop can find them. To see the list of directories gotop looks for files, run `gotop -h`. The first directory is always the directory from which gotop is run.
|
||||
如果您手动安装xmtop,或者您下载或创建新的布局或配色方案,则需要将布局文件放在xmtop可以找到的地方。要查看xmtop查找文件的目录列表,请运行`xmtop -h`。第一个目录始终是运行xmtop的目录。
|
||||
|
||||
- **Arch**: ![](https://img.shields.io/aur/last-modified/gotop) Install from AUR, e.g. `yay -S gotop-bin`. There is also `gotop` and `gotop-git`
|
||||
- **Gentoo**: gotop is available on [guru](https://gitweb.gentoo.org/repo/proj/guru.git) overlay.
|
||||
```shell
|
||||
sudo layman -a guru
|
||||
sudo emerge gotop
|
||||
- **二进制安装**:
|
||||
```
|
||||
wget
|
||||
|
||||
```
|
||||
- **Nix**: you can run `gotop` with `nix-shell -p gotop --run gotop` or add the package `gotop` to your environment
|
||||
- **OSX**: gotop is in *homebrew-core*. `brew install gotop`. Make sure to uninstall and untap any previous installations or taps.
|
||||
- **Windows**: gotop is in the [Main](https://github.com/ScoopInstaller/Main) bucket. `scoop install gotop`.
|
||||
- **Prebuilt binaries**: Binaries for most systems can be downloaded from [the github releases page](https://github.com/xxxserxxx/gotop/releases). RPM and DEB packages are also provided.
|
||||
- **Source**: This requires Go >= 1.16. `go install github.com/xxxserxxx/gotop/v4/cmd/gotop@latest`
|
||||
|
||||
### Extensions update
|
||||
|
||||
Extensions have proven problematic; go plugins are not usable in real-world cases, and the solution I had running for a while was hacky, at best. Consequently, extensions have been moved into the main code base for now.
|
||||
### 控制台(Console)用
|
||||
|
||||
- nvidia support: use the `--nvidia` flag to enable. You must have the `nvidia-smi` package installed, and gotop must be able to find the `nvidia-smi` executable, for this to work.
|
||||
- remote: allows gotop to pull sensor data from applications exporting Prometheus metrics, including remote gotop instances themselves.
|
||||
|
||||
### Console Users
|
||||
|
||||
gotop requires a font that has braille and block character Unicode code points; some distributions do not provide this. In the gotop repository is a `pcf` font that has these points, and setting this font may improve how gotop renders in your console. To use this, run these commands:
|
||||
xmtop需要一些特殊符合和Unicode代码点的字体;一些发行版不提供此功能。在xmtop存储库中有一种字体,使用此字体可能会改善xmtop在终端中的呈现方式。使用方法如下:
|
||||
|
||||
```shell
|
||||
curl -O -L https://raw.githubusercontent.com/xxxserxxx/gotop/master/fonts/Lat15-VGA16-braille.psf
|
||||
setfont Lat15-VGA16-braille.psf
|
||||
```
|
||||
|
||||
### Platform-specific features
|
||||
### 编译
|
||||
|
||||
Sometimes libraries that gotop uses to introspect the hardware only support a subset of operating systems. Rather than cripple gotop to the LCD, I'm allowing features that may only work on some platforms. These will be listed here:
|
||||
|
||||
- nvidia -- only available on systems with an nvidia GPU
|
||||
- SMART NVME hard drive temperatures -- Linux & Darwin
|
||||
|
||||
### Building
|
||||
|
||||
This is the download & compile approach.
|
||||
|
||||
gotop requires Go 1.16 or later to build, as it relies on the embed feature released with 1.16; a library it uses, lingo, uses both embed and the `io/fs` package. For a version of gotop that builds with earlier versions, check out one of the tags prior to v4.2.0.
|
||||
xmtop需要使用go1.21或以后的版本编译
|
||||
|
||||
```shell
|
||||
git clone https://github.com/xxxserxxx/gotop.git
|
||||
cd gotop
|
||||
git clone ssh://git@gitea.whlug.cn:33262/LK/xmtop.git && cd xmtop
|
||||
# This ugly SOB gets a usable version from the git tag list
|
||||
# 这个丑陋的SOB从git标签列表中获取可用版本
|
||||
VERS="$(git tag -l --sort=-v:refname | sed 's/v\([^-].*\)/\1/g' | head -1 | tr -d '-' ).$(git describe --long --tags | sed 's/\([^-].*\)-\([0-9]*\)-\(g.*\)/r\2.\3/g' | tr -d '-')"
|
||||
DAT=$(date +%Y%m%dT%H%M%S)
|
||||
go build -o gotop \
|
||||
|
@ -88,48 +51,41 @@ go build -o gotop \
|
|||
./cmd/gotop
|
||||
```
|
||||
|
||||
If you want to compact the executable as much as possible on Linux, change the `ldflags` line to this:
|
||||
如果您想在Linux上尽可能压缩可执行文件,请将`ldflags`行更改为:
|
||||
|
||||
```
|
||||
-ldflags "-X main.Version=v${VERS} -X main.BuildDate=${DAT} -extldflags '-s -w'" \
|
||||
```
|
||||
|
||||
Now move the `gotop` executable to somewhere in your `$PATH`.
|
||||
编译完成后将`xmtop`可执行文件移动到$PATH中的某个位置。
|
||||
|
||||
If Go is not installed or is the wrong version, and you don't have root access or don't want to upgrade Go, a script is provided to download Go and the gotop sources, compile gotop, and then clean up. See `scripts/install_without_root.sh`.
|
||||
如果Go没有安装或者是错误的版本,并且您没有root访问权限或不想升级Go,则会提供一个脚本来下载Go和gotops源,编译gotops,然后进行清理。请参见`scripts/install_without_root.sh`。
|
||||
|
||||
#### go generate
|
||||
## 使用
|
||||
|
||||
With Go 1.16, it is no longer necessary to call `go generate`. Translations and Apple SMC tags are embedded with `go:embed`.
|
||||
运行`-h`可以获取帮助菜单。其中许多功能都可以通过创建配置文件来配置; 有关更多信息,请参见下一节。键绑定可以在xmtop运行时通过按`?`键,或者可以使用`——list keys`命令打印出来。
|
||||
|
||||
## Usage
|
||||
除了键绑定之外,还可以使用鼠标来控制进程列表:
|
||||
|
||||
Run with `-h` to get an extensive list of command line arguments. Many of these can be configured by creating a configuration file; see the next section for more information. Key bindings can be viewed while gotop is running by pressing the `?` key, or they can be printed out by using the `--list keys` command.
|
||||
- 点击选择流程
|
||||
- 鼠标滚轮滚动浏览进程
|
||||
|
||||
In addition to the key bindings, the mouse can be used to control the process list:
|
||||
有关其他主题的更多信息,请参阅
|
||||
|
||||
- click to select process
|
||||
- mouse wheel to scroll through processes
|
||||
- [Layouts](./docs/layouts.md)
|
||||
- [Configuration](./docs/configuration.md)
|
||||
- [Color schemes](./docs/colorschemes.md)
|
||||
- [Device filtering](./docs/devices.md)
|
||||
- [Extensions](./docs/extensions.md)
|
||||
|
||||
For more information on other topics, see:
|
||||
|
||||
- [Layouts](https://github.com/xxxserxxx/gotop/blob/master/docs/layouts.md)
|
||||
- [Configuration](https://github.com/xxxserxxx/gotop/blob/master/docs/configuration.md)
|
||||
- [Color schemes](https://github.com/xxxserxxx/gotop/blob/master/docs/colorschemes.md)
|
||||
- [Device filtering](https://github.com/xxxserxxx/gotop/blob/master/docs/devices.md)
|
||||
- [Extensions](https://github.com/xxxserxxx/gotop/blob/master/docs/extensions.md)
|
||||
|
||||
Monitoring remote machines
|
||||
## 监控远程机器
|
||||
--------------------------
|
||||
|
||||
gotop can monitor gotops running on remote machines and display (some of the)
|
||||
metrics within a single instance. gotop expects to be behind a proxy, or within
|
||||
a secure intranet, so while it's not exactly hard to set up, it's also not
|
||||
trivial. An example set-up is explained in the
|
||||
[Remote Monitoring](https://github.com/xxxserxxx/gotop/blob/master/docs/remote-monitoring.md)
|
||||
document.
|
||||
gotops可以监视在远程计算机上运行的gotops,并在单个实例中显示 (某些) 指标。Gottop希望在代理后面,或者在安全的内部网内。文档中提供了一个
|
||||
[远程监控实例](./docs/remote-monitoring.md)
|
||||
设置
|
||||
|
||||
## More screen shots
|
||||
## 截图
|
||||
|
||||
#### '-l kitchensink' + colorscheme
|
||||
<img src="./assets/screenshots/kitchensink.gif" />
|
||||
|
@ -143,12 +99,6 @@ document.
|
|||
#### Custom (layouts/procs)
|
||||
<img src="./assets/screenshots/procs.png" />
|
||||
|
||||
|
||||
## Contributors
|
||||
|
||||
Many people ![](https://img.shields.io/github/contributors/xxxserxxx/gotop) have contributed code to gotop. Most of the work was by the original author, Caleb Bassi, who was seduced by the dark side (Rust) and had to be thrown into a volcano. Thanks to [everyone who's submitted a PR](https://github.com/xxxserxxx/gotop/CONTRIBUTORS.md), or otherwise contributed to the project!
|
||||
|
||||
|
||||
## Built With
|
||||
|
||||
- [gizak/termui](https://github.com/gizak/termui)
|
||||
|
@ -157,39 +107,12 @@ Many people ![](https://img.shields.io/github/contributors/xxxserxxx/gotop) have
|
|||
- [shirou/gopsutil](https://github.com/shirou/gopsutil)
|
||||
- [goreleaser/nfpm](https://github.com/goreleaser/nfpm)
|
||||
- [distatus/battery](https://github.com/distatus/battery)
|
||||
- [VictoriaMetrics/metrics](https://github.com/VictoriaMetrics/metrics) Check this out! The API is clean, elegant, introduces many fewer indirect dependencies than the Prometheus client, and adds 50% less size to binaries.
|
||||
- [lingo](https://github.com/xxxserxxx/lingo) is forked from [jdkeke142's](https://github.com/jdkeke142/lingo-toml) lingo, which was in turn forked from [kortemy's](https://github.com/kortemy/lingo) original project.
|
||||
- [VictoriaMetrics/metrics](https://github.com/VictoriaMetrics/metrics) 看看这个!该API干净、优雅,引入的间接依赖比Prometheus客户端少得多,并且将二进制文件的大小减少了50%。
|
||||
- [lingo](https://github.com/xxxserxxx/lingo) 基于 [jdkeke142's](https://github.com/jdkeke142/lingo-toml) 派生于 [kortemy's](https://github.com/kortemy/lingo) 的lingo.
|
||||
|
||||
|
||||
## History
|
||||
## 项目历史
|
||||
|
||||
**ca. 2020-01-25** The original author of gotop started a new tool in Rust, called [ytop](https://github.com/cjbassi/ytop), and deprecated his Go version. This repository is a fork of original gotop project with a new maintainer to keep the project alive and growing. An objective of the fork is to maintain a small, focused core while providing a path to extend functionality for less universal use cases; examples of this is sensor support for NVidia graphics cards, and for aggregating data from remote gotop instances.
|
||||
|
||||
## Alternatives
|
||||
|
||||
I obviously think gotop is the Bee's Knees, but there are many alternatives. Many of these have been around for years. All of them are terminal-based tools.
|
||||
|
||||
- Grandpa [top](http://sourceforge.net/projects/unixtop/). Written 36 years ago, C, installed by default on almost every Unix descendant.
|
||||
- [bashtop](https://github.com/aristocratos/bashtop), in pure bash! Beautiful and space efficient, and [deserves special comment](docs/bashtop.md).
|
||||
- [bpytop](https://github.com/aristocratos/bpytop), @aristocratos, the author of bashtop, rewrote it in Python in mid-2020; it's the same beautiful interface, and a very nice alternative.
|
||||
- [htop](https://hisham.hm/htop/). A prettier top. Similar functionality. 16 years old!
|
||||
- [atop](https://www.atoptool.nl/). Detailed process-focused inspection with a table-like view. Been around for 9 long years.
|
||||
- [iftop](http://www.ex-parrot.com/~pdw/iftop/), a top for network connections. More than just data transfer, iftop will show what interfaces are connecting to what IP addresses. Requires root access to run.
|
||||
- [iotop](http://guichaz.free.fr/iotop/), top for disk access. Tells you *which* processes are writing to and from disk space, and how much. Also requires root access to run.
|
||||
- [nmon](http://nmon.sourceforge.net) a dashboard style top; widgets can be dynamically enabled and disabled, pure ASCII rendering, so it doesn't rely on fancy character sets to draw bars.
|
||||
- [ytop](https://github.com/cjbassi/ytop), a rewrite of gotop (ca. 3.0) in Rust. Same great UI, different programming language.
|
||||
- [slabtop](https://gitlab.com/procps-ng/procps), part of procps-ng, looks like top but provides kernel slab cache information! Requires root.
|
||||
- [systemd-cgtop](https://www.github.com/systemd/systemd), comes with systemd (odds are your system uses systemd, so this is already installed), provides a resource use view of control groups -- basically, which services are using what resources. Does *not* require root to run.
|
||||
- [virt-top](https://libvirt.org/) top for virtualized containers (VMs, like QEMU).
|
||||
- [ctop](https://bcicen.github.io/ctop/) top for containers (LXC, like docker)
|
||||
gotop的最初作者在Rust中启动了一个名为[ytop](https://github.com/cjbassi/ytop)的新工具,并弃用了他的Go版本。这个项目是基于[gotop项目的xxxserxxx分支](https://github.com/xxxserxxx/gotop)制作的。主要目的是用来优化龙架构的使用体验和添加更丰富的功能。
|
||||
|
||||
|
||||
### A comment on clones
|
||||
|
||||
In a chat room I heard someone refer to gotop as "another one of those fancy language rewrites people do." I'm not the original author of gotop, so it's easy to not take offense, but I'm going on record as saying that I disagree with that sentiment: I think these rewrites are valuable, useful, and healthy to the community. They increase software diversity at very little [cost to users](https://en.wikipedia.org/wiki/Information_overload), and are a sort of evolutionary mechanism: as people do rewrites, some are worse, but some are better, and users benefit. Rewrites provide options, which fight against [monocultures](https://github.com). As importantly, most developers are really only fluent in a couple of programming languages. We all have *familiarity* with a dozen, and may even have extensive experience with a half-dozen, but if you don't constantly use a language, you tend to forget the extended library APIs, your development environment isn't tuned, you're rusty with using the tool sets, and you may have forgotten a lot of the language peculiarities and gotchas. The barrier to entry for contributing to a software project -- to simply finding and fixing a bug -- in a language you're not intimate with can be very high. It gets much worse if the project owner is a stickler for a particular style. So I believe that gotop's original author's decision to rewrite his project in Rust is a net positive. He probably made fewer design mistakes in ytop (we always do, on the second rewrite), and Rust developers -- who may have hesitated learning or brushing up on Go to submit an improvement -- have another project to which they can contribute.
|
||||
|
||||
Diversity is good. Don't knock the free stuff.
|
||||
|
||||
## Star History
|
||||
|
||||
[![Star History Chart](https://api.star-history.com/svg?repos=xxxserxxx/gotop&type=Date)](https://star-history.com/#xxxserxxx/gotop&Date)
|
||||
|
|
Loading…
Reference in New Issue
Block a user