CPU 모니터링
Bash
top -d 1
htop
uptime # load average 확인 (코어 수보다 크면 과부하)
nproc
lscpu | grep "CPU(s):"
ps aux --sort=-%cpu | head -10메모리 모니터링
Bash
free -h
watch -n 1 free -h
ps aux --sort=-%mem | head -10
cat /proc/meminfo | grep -E "MemTotal|MemFree|MemAvailable|Cached"
swapon --show디스크 모니터링
Bash
df -h
df -h /var
du -sh /var/* | sort -rh | head -10
du -sh /* | sort -rh | head -10
df -i # inode 사용량
iostat -xz 1
iotop -ao네트워크 모니터링
Bash
ss -tunlp
ss -s
iftop -i eth0
nload eth0
# 연결 수 확인 (DDoS 탐지)
ss -tn | awk 'NR>1 {print $5}' | cut -d: -f1 | sort | uniq -c | sort -rn | headvmstat / sar
Bash
vmstat 1 10
sudo apt install sysstat
sar -u 1 5 # CPU
sar -r 1 5 # 메모리
sar -d 1 5 # 디스크CPU 경보 스크립트
Bash
#!/bin/bash
THRESHOLD=90
CPU=$(top -bn1 | grep "Cpu(s)" | awk '{print $2}' | cut -d'%' -f1 | cut -d',' -f1)
CPU=${CPU%.*}
if [[ $CPU -gt $THRESHOLD ]]; then
echo "[ALERT] CPU ${CPU}%" | mail -s "CPU 경고" [email protected]
fi편집 안내 · Editorial Note
이 가이드는 AI 도구를 활용해 초안을 구성하고 사람이 명령어·문맥을 검토해 발행했습니다. 운영체제와 도구 버전에 따라 결과가 달라질 수 있으므로 적용 전 공식 문서를 함께 확인하세요. 오류를 발견하시면 이메일로 제보해 주세요.
관련 공식 문서GNU/Linux man 페이지 ↗
질문 & 답변 (Q&A)
이 가이드에 대해 궁금한 점을 질문해보세요. 확인 후 답변드립니다.