-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonitor.sh
More file actions
28 lines (23 loc) · 1.29 KB
/
monitor.sh
File metadata and controls
28 lines (23 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
# Dosya yolu
OUTPUT_FILE="/var/www/html/index.html"
# Verileri Çek
TARIH=$(date)
CPU_LOAD=$(uptime | awk -F'load average:' '{ print $2 }')
RAM_TOTAL=$(free -m | grep Mem | awk '{print $2}')
RAM_USED=$(free -m | grep Mem | awk '{print $3}')
DISK_USAGE=$(df -h / | awk 'NR==2 {print $5 " dolu (" $3 "/" $2 ")"}')
USER_COUNT=$(who | wc -l)
# HTML Oluştur
echo "<html><head><title>Sunucu Durum Paneli</title>" > $OUTPUT_FILE
echo "<meta charset='UTF-8'>" >> $OUTPUT_FILE
echo "<style>body{font-family: sans-serif; padding: 20px;} .box{border:1px solid #ddd; padding:10px; margin-bottom:10px;}</style>" >> $OUTPUT_FILE
echo "</head><body>" >> $OUTPUT_FILE
echo "<h1>Sunucu Durum Paneli</h1>" >> $OUTPUT_FILE
echo "<div class='box'><h3>🕒 Rapor Saati</h3><p>$TARIH</p></div>" >> $OUTPUT_FILE
echo "<div class='box'><h3>💻 CPU Yükü</h3><p>$CPU_LOAD</p></div>" >> $OUTPUT_FILE
echo "<div class='box'><h3>🧠 RAM Durumu</h3><p>Kullanılan: $RAM_USED MB / Toplam: $RAM_TOTAL MB</p></div>" >> $OUTPUT_FILE
echo "<div class='box'><h3>💾 Disk Alanı</h3><p>$DISK_USAGE</p></div>" >> $OUTPUT_FILE
echo "<div class='box'><h3>👥 Aktif Kullanıcı Sayısı</h3><p>$USER_COUNT</p></div>" >> $OUTPUT_FILE
echo "<p><small>Otomatik güncellenir.</small></p>" >> $OUTPUT_FILE
echo "</body></html>" >> $OUTPUT_FILE