-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonitor.sh
More file actions
35 lines (26 loc) · 814 Bytes
/
monitor.sh
File metadata and controls
35 lines (26 loc) · 814 Bytes
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
29
30
31
32
33
34
35
TARIH=$(date +"%d-%m-%Y %H:%M:%S")
CPU=$(top -bn1 | grep "Cpu(s)" | awk '{print $2 + $4}')
RAM_TOPLAM=$(free -m | awk 'NR==2{print $2}')
RAM_KULLANILAN=$(free -m | awk 'NR==2{print $3}')
DISK=$(df -h / | awk 'NR==2{print $3 " / " $2 " (" $5 ")"}')
KULLANICI=$(who | wc -l)
cat <<EOF > /var/www/html/index.html
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<title>Sunucu Durum Paneli</title>
</head>
<body>
<h1>Sunucu Durum Paneli</h1>
<p><b>Rapor Saati:</b> $TARIH</p>
<h2>Sistem Bilgileri</h2>
<ul>
<li><b>CPU Kullanımı:</b> %$CPU</li>
<li><b>RAM Kullanımı:</b> $RAM_KULLANILAN MB / $RAM_TOPLAM MB</li>
<li><b>Disk Kullanımı:</b> $DISK</li>
<li><b>Aktif Kullanıcı Sayısı:</b> $KULLANICI</li>
</ul>
</body>
</html>
EOF