cd /tmp
wget https://github.com/rapid7/rtop/releases/download/v1.1/rtop-linux-amd64
sudo mv rtop-linux-amd64 /usr/local/bin/rtop
sudo chmod +x /usr/local/bin/rtop
Install Go:
sudo apt install -y golang-go # Debian
sudo dnf install -y golang # RHEL
Build rtop:
cd /tmp
git clone https://github.com/rapid7/rtop.git
cd rtop
go build -o rtop
sudo mv rtop /usr/local/bin/
go install github.com/rapid7/rtop@latest
sudo mv ~/go/bin/rtop /usr/local/bin/
rtop requires SSH key-based authentication to remote servers.
Generate SSH key (if not already done):
ssh-keygen -t ed25519 -f ~/.ssh/rtop_key -N ""
Copy key to remote servers:
ssh-copy-id -i ~/.ssh/rtop_key.pub user@remote-server
Test SSH connection:
ssh -i ~/.ssh/rtop_key user@remote-server
Basic usage:
rtop -ssh-key ~/.ssh/rtop_key user@remote-server
With custom SSH port:
rtop -ssh-key ~/.ssh/rtop_key -ssh-port 2222 user@remote-server
With custom SSH user:
rtop -ssh-key ~/.ssh/rtop_key -ssh-user admin remote-server
Create a script to monitor multiple servers:
#!/bin/bash
# monitor-servers.sh
SERVERS=(
"server1.example.com"
"server2.example.com"
"192.168.1.100"
)
for server in "${SERVERS[@]}"; do
echo "=== $server ==="
rtop -ssh-key ~/.ssh/rtop_key user@$server
echo ""
done
Create a cron job to collect metrics:
sudo crontab -e
Add:
*/5 * * * * /usr/local/bin/rtop -ssh-key /home/user/.ssh/rtop_key user@server1 >> /var/log/rtop-server1.log 2>&1
*/5 * * * * /usr/local/bin/rtop -ssh-key /home/user/.ssh/rtop_key user@server2 >> /var/log/rtop-server2.log 2>&1
rtop supports different output formats:
rtop -ssh-key ~/.ssh/rtop_key -json user@remote-server
rtop -ssh-key ~/.ssh/rtop_key -csv user@remote-server
# CPU only
rtop -ssh-key ~/.ssh/rtop_key -cpu user@remote-server
# Memory only
rtop -ssh-key ~/.ssh/rtop_key -mem user@remote-server
# Disk only
rtop -ssh-key ~/.ssh/rtop_key -disk user@remote-server
# Network only
rtop -ssh-key ~/.ssh/rtop_key -net user@remote-server
#!/bin/bash
# rtop-to-influxdb.sh
SERVER=$1
METRICS=$(rtop -ssh-key ~/.ssh/rtop_key -json user@$SERVER)
CPU=$(echo $METRICS | jq '.cpu.percent')
MEM=$(echo $METRICS | jq '.memory.percent')
curl -i -XPOST 'http://localhost:8086/write?db=rtop' \
--data-binary "cpu_usage,host=$SERVER value=$CPU"
curl -i -XPOST 'http://localhost:8086/write?db=rtop' \
--data-binary "mem_usage,host=$SERVER value=$MEM"
#!/bin/bash
# rtop-prometheus.sh
SERVER=$1
METRICS=$(rtop -ssh-key ~/.ssh/rtop_key -json user@$SERVER)
cat > /var/lib/node_exporter/textfile_collector/rtop_$SERVER.prom <<EOF
# HELP rtop_cpu_usage CPU usage percentage
# TYPE rtop_cpu_usage gauge
rtop_cpu_usage{host="$SERVER"} $(echo $METRICS | jq '.cpu.percent')
# HELP rtop_mem_usage Memory usage percentage
# TYPE rtop_mem_usage gauge
rtop_mem_usage{host="$SERVER"} $(echo $METRICS | jq '.memory.percent')
EOF
Use rtop data with:
# Test SSH connection
ssh -v -i ~/.ssh/rtop_key user@remote-server
# Check SSH agent
ssh-add -l
# Ensure correct permissions
chmod 600 ~/.ssh/rtop_key
chmod 755 /usr/local/bin/rtop
See rtop Hardening.
Stuck on a step or need custom configuration? We provide paid consulting for rtop deployments, from single-instance setups to distributed clusters.
📧 office@linux-server-admin.com
🌐 Contact Page
Prefer automation? See rtop Ansible Setup for an example playbook.
Prefer containers? See rtop Docker Setup.
See rtop Configuration for configuration guidance.
See rtop Security for hardening guidance.