#!/bin/bash

for i in {01..10}; do
    echo -e "FALCON $i"
    CPU=$(ssh -q fc$i top -bn1 | grep load | awk '{printf "%.2f%%\t\t\n", $(NF-2)}')
    echo -e "\tCPU LOAD \t\t$CPU"
    MEMINFO=$(ssh -q fc$i 'cat /proc/meminfo')
    MEMTOTAL=$(echo -e $MEMINFO | grep -Po '(?<=MemTotal: )[0-9]{1,10}(?= kB)')
    MEMFREE=$(echo -e $MEMINFO | grep -Po '(?<=MemFree: )[0-9]{1,10}(?= kB)')
    MEMAVAIL=$(echo -e $MEMINFO | grep -Po '(?<=MemAvailable: )[0-9]{1,10}(?= kB)')
    echo -e "\tTOAL|FREE|AVAIL\t(GB)\t$(($MEMTOTAL / 1000000))\t$(($MEMFREE / 1000000))\t$(($MEMAVAIL / 1000000))"
    DISK=$(ssh -q fc$i 'df -H | grep sda3')
    echo -e "\t$DISK"
done

exit 0