scriptul de reproting in HTML
This commit is contained in:
129
html_report.sh
Executable file
129
html_report.sh
Executable file
@@ -0,0 +1,129 @@
|
||||
#!/bin/bash
|
||||
|
||||
REPORT="system_report.html"
|
||||
|
||||
# ---------- HTML HEADER ----------
|
||||
html_header()
|
||||
{
|
||||
cat <<EOF
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>System Report</title>
|
||||
<style>
|
||||
body
|
||||
{
|
||||
font-family: monospace;
|
||||
background: #0f172a;
|
||||
color: #e5e7eb;
|
||||
padding: 20px;
|
||||
}
|
||||
h1
|
||||
{
|
||||
color: #38bdf8;
|
||||
}
|
||||
.section
|
||||
{
|
||||
margin-bottom: 30px;
|
||||
border: 1px solid #334155;
|
||||
border-radius: 8px;
|
||||
background: #020617;
|
||||
}
|
||||
.section h2
|
||||
{
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
background: #1e293b;
|
||||
color: #fbbf24;
|
||||
border-bottom: 1px solid #334155;
|
||||
}
|
||||
pre
|
||||
{
|
||||
margin: 0;
|
||||
padding: 15px;
|
||||
color: #a7f3d0;
|
||||
overflow-x: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>System Report</h1>
|
||||
EOF
|
||||
}
|
||||
|
||||
# ---------- HTML FOOTER ----------
|
||||
html_footer()
|
||||
{
|
||||
cat <<EOF
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
}
|
||||
|
||||
# ---------- FUNCTiONS ----------
|
||||
# ---------- RUNNING PORCESSES -----------
|
||||
|
||||
list_processes()
|
||||
{
|
||||
cat <<EOF
|
||||
<div class="section">
|
||||
<h2>Top Processes by CPU</h2>
|
||||
<pre>
|
||||
$(ps aux --sort=-%cpu | head -10)
|
||||
</pre>
|
||||
</div>
|
||||
EOF
|
||||
}
|
||||
|
||||
# ---------- DISK USAGE --------------
|
||||
disk_usage()
|
||||
{
|
||||
cat <<EOF
|
||||
<div class="section">
|
||||
<h2>Disk Usage</h2>
|
||||
<pre>
|
||||
$(df -h)
|
||||
</pre>
|
||||
</div>
|
||||
EOF
|
||||
}
|
||||
|
||||
# --------- MEMORY USAGE -------------
|
||||
memory_usage()
|
||||
{
|
||||
cat <<EOF
|
||||
<div class="section">
|
||||
<h2>Memory Usage</h2>
|
||||
<pre>
|
||||
$(free -h)
|
||||
</pre>
|
||||
</div>
|
||||
EOF
|
||||
}
|
||||
|
||||
# ........... SYSTEM INFO -----------
|
||||
sys_info()
|
||||
{
|
||||
cat <<EOF
|
||||
<div class="section">
|
||||
<h2>System info</h2>
|
||||
<pre>
|
||||
$(lscpu)
|
||||
</pre>
|
||||
</div>
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
# ---------- BUILD THE ACTUAL REPORT ----------
|
||||
{
|
||||
html_header
|
||||
sys_info
|
||||
list_processes
|
||||
disk_usage
|
||||
memory_usage
|
||||
html_footer
|
||||
} > "$REPORT"
|
||||
|
||||
echo "HTML report generated: $REPORT"
|
||||
Reference in New Issue
Block a user