Check the disk space with a self contain script based on Ruby Execute this shell scritp on remote host using ssh
rm check_disk.rb
tee -a check_disk.rb <<EOF
# parse mount point VM (TODO customize for your machine)
usage = \`df\`.split("\n").grep(/VM/)
.map { |l| l.split(/\s+/)[4][0..-2].to_i }.first
# allow up 90% disk usage
ok = (usage < 90)
if ok
puts "ok: #{100-usage}% free disk"
exit(0)
end
puts "error: only #{100-usage}% free disk expect > 10%"
exit(1)
EOF
ruby check_disk.rb