Thursday, March 23, 2017

rtop – A Nifty Tool to Monitor Remote Server Over SSH

http://www.2daygeek.com/2017/03/rtop-monitor-remote-linux-server-over-ssh


rtop is a simple, agent-less, remote server monitoring tool that works over SSH. It doesn’t required any other software to be installed on remote machine, except openSSH server package & remote server credentials.
rtop is written in golang, and requires Go version 1.2 or higher. It can able to monitor any modern Linux distributions. rtop can connect remote system with all possible way like using ssh-agent, private keys or password authentication. Choose the desired one and monitor it.
It works by establishing an SSH session, and running commands on the remote server to collect system metrics such as CPU, disk, memory, network. It keeps refreshing the information every few seconds, like top command utility.

How to Install rtop in Linux

Run go get command to build it. The rtop binary automatically saved under $GOPATH/bin and no run time dependencies or configuration needed.
$ go get github.com/rapidloop/rtop
The rtop binary automatically saved under $GOPATH/bin
$ $GOBIN/
hello rtop
or
$ ls -lh /home/magi/go_proj/bin
total 5.9M
-rwxr-xr-x 1 magi magi 1.5M Mar  7 14:45 hello
-rwxr-xr-x 1 magi magi 4.4M Mar 21 13:33 rtop

How to Use rtop

rtop binary was present in $GOPATH/bin, so just run $GOBIN/rtop to get the usage information.
$ $GOBIN/rtop
rtop 1.0 - (c) 2015 RapidLoop - MIT Licensed - http://rtop-monitor.org
rtop monitors server statistics over an ssh connection

Usage: rtop [-i private-key-file] [user@]host[:port] [interval]

    -i private-key-file
        PEM-encoded private key file to use (default: ~/.ssh/id_rsa if present)
    [user@]host[:port]
        the SSH server to connect to, with optional username and port
    interval
        refresh interval in seconds (default: 5)
Just add remote host information followed by rtop command to monitor. Default refresh interval in seconds (default: 5)
$ $GOBIN/rtop   magi@10.30.0.1
magi@10.30.0.1's password: 

2daygeek.vps up 21d 16h 59m 46s

Load:
    0.13 0.03 0.01

CPU:
    0.00% user, 0.00% sys, 0.00% nice, 0.00% idle, 0.00% iowait, 0.00% hardirq, 0.00% softirq, 0.00% guest

Processes:
    1 running of 29 total

Memory:
    free    = 927.66 MiB
    used    =  55.77 MiB
    buffers = 0 bytes
    cached  =  40.57 MiB
    swap    = 128.00 MiB free of 128.00 MiB

Filesystems:
           /:   9.40 GiB free of  10.20 GiB

Network Interfaces:
    lo - 127.0.0.1/8, ::1/128
      rx =  14.18 MiB, tx =  14.18 MiB

    venet0 - 10.30.0.1/24, 2607:5300:100:200::81a/56
      rx =  98.76 MiB, tx = 129.90 MiB
Add the refresh interval manually for better monitoring. I have added 10 seconds refresh interval instead of default one (default: 5).
$ $GOBIN/rtop magi@10.30.0.1 10
magi@10.30.0.1's password:

2daygeek.vps up 21d 17h 7m 1s

Load:
    0.00 0.00 0.00

CPU:
    0.00% user, 0.00% sys, 0.00% nice, 0.00% idle, 0.00% iowait, 0.00% hardirq, 0.00% softirq, 0.00% guest

Processes:
    1 running of 28 total

Memory:
    free    = 926.83 MiB
    used    =  56.51 MiB
    buffers = 0 bytes
    cached  =  40.66 MiB
    swap    = 128.00 MiB free of 128.00 MiB

Filesystems:
           /:   9.40 GiB free of  10.20 GiB

Network Interfaces:
    lo - 127.0.0.1/8, ::1/128
      rx =  14.18 MiB, tx =  14.18 MiB

    venet0 - 10.30.0.1/24, 2607:5300:100:200::81a/56
      rx =  98.94 MiB, tx = 130.33 MiB

No comments:

Post a Comment