What is rtop?
rtop is a tool for providing an overview of the system resources on a remote server at the Linux command line. It refreshes every few seconds to keep the information up to date. The real advantage of rtop is that once installed on the local side it only requires SSH server running on the remote system to connect and do its thing. There’s no requirement to install some form of daemon on the remote systems.
To get started with rtop and get it installed, you’ll need Google’s Go programming language installed on your system. We will also need the Git software version control system. This is easily achieved as most distributions provide packages for versions of Go that are suitable for running rtop.
To install on a Debian or Ubuntu system:
sudo apt-get update
sudo apt-get install golang-go
For CentOS and Red Hat systems:
sudo yum install golang
You’ll need to set a path for Go to store its working code files before we can proceed. The simplest way of doing so is by providing a path by adding a file to the /etc/profile.d directory:
sudo nano /etc/profile.d/golang.sh
In this file you can paste the following line:
Save and exit this file to make sure that your Go path will be set each time you log in. This is used to tell Go where to download and install its files, as well as to let the system know where to look for the applications that Go creates. With this setting, it will save the files to a directory called “gofiles” in the user’s home. You can amend this to direct files to wherever you wish them to go.
With Go installed, we can look at getting the rtop files from Github. Fortunately, Go provides an easy process for using Git to do this:
This will download the source code for rtop, and then compile and install it into the gofiles/bin directory in the user’s home directory. If you’ve used a different GOPATH then this will need to be changed.
Once installed you can launch rtop by typing:
Note: you’ll need to change username for your username on the remote server, serverip for the IP address of the server (alternately you can use the it’s domain name) and the “:port” part is optional and used if you have SSH listening on a non-standard port. You’ll be prompted for your password to log in, and once done rtop will show you the details of the remote server, refreshing the display every five seconds.
The top line shows the server’s details and its uptime. This is followed by the load averages of the server. The next section shows how many processes are active and running in total. A nice clear breakdown of memory usage is next. Then you get a breakdown of usage of the various mounted filesystems on the server. Finally, you will see the network information showing each interface, its IP addresses, and bandwidth usage.
Therefore, this uncluttered interface makes it really simple to get an at-a-glance overview of how the server is performing. If you want more detail you’ll still have to log into the server itself and use other tools. Exiting rtop is as easy as hitting “Ctrl-C “to close the application.
Another downside to rtop is that with the default installation location, rtop is only available for the current user of the system. So if you want rtop available for other users you will need to set a link to the rtop executable:
sudo ln ~/gofiles/bin/rtop /usr/local/bin/rtop
You will find rtop to be invaluable in monitoring your server system’s resources. If you are not yet utilizing its capabilities you now have the information to make the necessary changes. Let us know how you get on and if it throws up any challenges that we can help resolve. Do let us know.