-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonitor.sh
More file actions
24 lines (21 loc) · 1.41 KB
/
monitor.sh
File metadata and controls
24 lines (21 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
TARIH=$(date)
CPU_LOAD=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}')
RAM_TOTAL=$(free -m | awk '/Mem:/ { print $2 }')
RAM_USED=$(free -m | awk '/Mem:/ { print $3 }')
DISK_USAGE=$(df -h / | awk 'NR==2 {print $5}')
DISK_TOTAL=$(df -h / | awk 'NR==2 {print $2}')
USER_COUNT=$(who | wc -l)
echo "<html>" > /var/www/html/index.html
echo "<head><title>Sunucu Durum Paneli</title>" >> /var/www/html/index.html
echo "<meta charset='UTF-8'><meta http-equiv='refresh' content='60'></head>" >> /var/www/html/index.html
echo "<body style='font-family: Arial, sans-serif; padding: 20px;'>" >> /var/www/html/index.html
echo "<h1>Linux Sunucu Durum Paneli</h1>" >> /var/www/html/index.html
echo "<hr>" >> /var/www/html/index.html
echo "<h3>📅 Rapor Tarihi: <span style='color:blue'>$TARIH</span></h3>" >> /var/www/html/index.html
echo "<p><strong>💻 CPU Kullanımı:</strong> $CPU_LOAD</p>" >> /var/www/html/index.html
echo "<p><strong>🧠 RAM Durumu:</strong> $RAM_USED MB / $RAM_TOTAL MB</p>" >> /var/www/html/index.html
echo "<p><strong>💾 Disk Doluluğu:</strong> $DISK_USAGE (Toplam: $DISK_TOTAL)</p>" >> /var/www/html/index.html
echo "<p><strong>busts_in_silhouette Aktif Kullanıcılar:</strong> $USER_COUNT</p>" >> /var/www/html/index.html
echo "<br><p><i>Bu sayfa her dakika güncellenmektedir.</i></p>" >> /var/www/html/index.html
echo "</body></html>" >> /var/www/html/index.html