I cannot get the linux current users, memory, hdd usage, cpu load into ruby.
require 'socket'
puts "\n"
time = Time.new
#puts time.day, time.month, time.year
puts "Date " + time.strftime("%d/%m/%Y")+"\t\t\tTime " + time.strftime("%H:%M:%S")+"\t\t\tSystem-Name: " + Socket.gethostname
puts "----------------------------------------------------------------------------------------------"
puts "Uptime: "
#Uptime
uptime = exec "uptime"
#Memory Usage
system (free -m | awk 'NR==2{printf "Memory Usage: %s/%sMB (%.2f%%)\n", $3,$2,$3*100/$2 }')
#Disk usage
df -h | awk '$NF=="/"{printf "Disk Usage: %d/%dGB (%s)\n", $3,$2,$5}'
#Current Users
users | awk '{for(i=1;i<=NF;i++) {a[$i]++}} END {for(i in a) {print "Current Users:\t"a[i]}}'
#CPU load
top -bn1 | grep load | awk '{printf "CPU Load: %.2f\n", $(NF-2)}'