Rtop – remote host monitoring via SSH

Time:2022-5-5

Rtop is a simple, agent-free remote server monitoring tool, which can be run through SSH. It does not require any agent software to be installed on the remote machine.
Its working principle is to establish an SSH session and run commands on the remote server to collect system information, such as CPU, disk, memory and network. It refreshes the information every few seconds, just like the top command.
Rtop – remote host monitoring via SSH
System environment
Centos8

Install golang
Check whether golang is installed in the system:

[[email protected] ~]# rpm -qa|grep golang
It is found that it is not installed. Now use the yum list golang command to check whether there is a modified installation package in the remote warehouse:

[[email protected] ~]# yum list golang
Repository AppStream is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Available Packages
golang.x86_64 1.14.12-1.module_el8.3.0+605+410c5674 AppStream
Rtop – remote host monitoring via SSH rtop – remote host monitoring via SSH
It is found that there is a golang installation package in the appstream source. Let’s start the installation:

[[email protected] ~]# yum -y install golang
To use the go language, create a workspace in the user’s home directory. Go language will save all files here:

[[email protected] ~]# mkdir -p ~/go_proj/bin
Set gopath and Gobin environment variables. Gopath is the project workspace. Add the following two lines to ~ / In bashrc configuration file:

[[email protected] ~]# vim ~/.bashrc

export GOPATH=$HOME/go_proj
export GOBIN=$GOPATH/bin
Rtop – remote host monitoring via SSH rtop – remote host monitoring via SSH

Install rtop
Run the go get command to build rtop. Rtop binary files are automatically saved in $gopath / bin. Before running go get, make sure that the GIT tool is installed on the system:

[[email protected] ~]# yum -y install git
[[email protected] ~]# go get github.com/rapidloop/rtop
package git:/github.com/rapidloop/rtop: git:/github.com/rapidloop/rtop: invalid import path: malformed import path “git:/github.com/rapidloop/rtop”: invalid char ‘:’
[[email protected] ~]# go get github.com/rapidloop/rtop
package golang.org/x/crypto/ssh: unrecognized import path “golang.org/x/crypto/ssh”: https fetch: Get “https://golang.org/x/crypto/ssh?go-get=1”: dial tcp 216.239.37.1:443: connect: connection refused
package golang.org/x/crypto/ssh/agent: unrecognized import path “golang.org/x/crypto/ssh/agent”: https fetch: Get “https://golang.org/x/crypto/ssh/agent?go-get=1”: dial tcp 216.239.37.1:443: connect: connection refused
package golang.org/x/crypto/ssh/terminal: unrecognized import path “golang.org/x/crypto/ssh/terminal”: https fetch: Get “https://golang.org/x/crypto/ssh/terminal?go-get=1”: dial tcp 216.239.37.1:443: connect: connection refused
After running go get, it is found that the dependent package cannot be downloaded.
Rtop – remote host monitoring via SSH rtop – remote host monitoring via SSH
Follow the steps below to create a directory and manually git download related dependencies:

[[email protected] ~]# mkdir -p $GOPATH/src/golang.org/x/
[[email protected] x]# git clone https://github.com/golang/cry…
[[email protected] x]# git clone https://github.com/golang/ter…
[[email protected] x]# git clone https://github.com/golang/sys…
Rtop – remote host monitoring via SSH rtop – remote host monitoring via SSH
Now run go get again:

[[email protected] x]# go get github.com/rapidloop/rtop
As you can see below, rtop can run normally.
Rtop – remote host monitoring via SSH rtop – remote host monitoring via SSH

How to use rtop
Rtop binaries exist in $gopath / bin, so just run $Gobin / rtop. Just add the remote host information and use the rtop command to monitor. The default refresh interval is 5 seconds.

[[email protected] ~]# $GOBIN/rtop [email protected]
Rtop – remote host monitoring via SSH rtop – remote host monitoring via SSH
Manually set the refresh interval for better monitoring. A 2-second refresh interval is set here.

[[email protected] ~]# $GOBIN/rtop [email protected] 2
Rtop – remote host monitoring via SSH rtop – remote host monitoring via SSH
Rtop – remote host monitoring via SSH rtop – remote host monitoring via SSH

summary
]Rtop is a simple, agent-free remote server monitoring tool, which can be run through SSH. It does not require any agent software to be installed on the remote machine.