°Ô½Ã¹° 42°Ç
   
¸Þ¸ð¸®°ª (ÆÛ¼¾Æ®) ±¸Çϱâ [ mem, cpu, disk, % ]
±Û¾´ÀÌ : theko ³¯Â¥ : 2017-03-09 (¸ñ) 14:26 Á¶È¸ : 3863


#!/bin/sh
free -m | awk 'NR==2{printf "Memory Usage: %s/%sMB (%.2f%%)\n", $3,$2,$3*100/$2 }'
¼³¸í ;             2¹ø°ÁÙ                                      $3/$2         $3*100/$2   À» Ãâ·Â ÇØÁØ´Ù         
df -h | awk '$NF=="/"{printf "Disk Usage: %d/%dGB (%s)\n", $3,$2,$5}'
top -bn1 | grep load | awk '{printf "CPU Load: %.2f\n", $(NF-2)}'



$ ./foo.sh 
Memory Usage: 4986/7994MB (62.37%)
Disk Usage: 23/68GB (35%)
CPU Load: 0.78


¿¹Á¦
6¹öÀü¿¡¼­ ¸Þ¸ð¸® ±¸ÇÒ¶§ ÀÌ·¸°Ô »ç¿ë ÇßÀ½

free -m | awk 'NR==2{printf "Memory Usage: %s/%sMB (%.2f%%)\n", $2-($4+$5+$6+$7),$2,($2-($4+$5+$6+$7))*100/$2 }'
Á¦



À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

miwit.com sir.co.kr DNS Powered by DNSEver.com DNS Powered by DNSEver.com