Monitoring / public /index.html
citedd's picture
Add mountain night sky photo background
5e2284c verified
Raw History Blame Contribute Delete
11.7 kB
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Server Dashboard — Hedd</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
min-height: 100vh;
color: #fff;
overflow-x: hidden;
}
/* Background photo with dark overlay */
.bg-photo {
position: fixed; inset: 0; z-index: -2;
background: url('https://images.unsplash.com/photo-1519681393784-d120267933ba?w=1920&q=80') center/cover no-repeat;
}
.bg-overlay {
position: fixed; inset: 0; z-index: -1;
background:
radial-gradient(ellipse at 30% 20%, rgba(88, 60, 209, 0.15) 0%, transparent 50%),
linear-gradient(180deg, rgba(10,10,26,0.55) 0%, rgba(10,10,26,0.8) 100%);
}
.container {
position: relative; z-index: 1;
max-width: 960px; margin: 0 auto;
padding: 2rem 1.25rem 3rem;
}
.glass {
position: relative;
background: linear-gradient(
135deg,
rgba(255, 255, 255, 0.12) 0%,
rgba(255, 255, 255, 0.06) 40%,
rgba(255, 255, 255, 0.04) 60%,
rgba(255, 255, 255, 0.08) 100%
);
backdrop-filter: blur(40px) saturate(180%);
-webkit-backdrop-filter: blur(40px) saturate(180%);
border: 1px solid rgba(255, 255, 255, 0.18);
border-radius: 20px;
box-shadow:
0 8px 32px rgba(0, 0, 0, 0.3),
inset 0 1px 0 rgba(255, 255, 255, 0.15),
inset 0 -1px 0 rgba(255, 255, 255, 0.05);
overflow: hidden;
}
.glass::before {
content: '';
position: absolute; inset: 0;
border-radius: 20px;
background: linear-gradient(
135deg,
rgba(255,255,255,0.08) 0%,
transparent 50%,
rgba(255,255,255,0.03) 100%
);
pointer-events: none;
}
.header {
text-align: center;
margin-bottom: 2rem;
padding: 1.5rem 1rem;
border-radius: 24px;
}
.header h1 {
font-size: 2rem;
font-weight: 700;
background: linear-gradient(135deg, #a78bfa, #60a5fa, #34d399);
-webkit-background-clip: text; -webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 0.3rem;
}
.header-sub {
display: flex; align-items: center; justify-content: center; gap: 0.5rem;
flex-wrap: wrap;
}
.status-dot {
width: 8px; height: 8px; background: #34d399; border-radius: 50%;
animation: pulse 2s infinite;
}
@keyframes pulse {
0%,100% { box-shadow: 0 0 0 0 rgba(52,211,153,0.5); }
50% { box-shadow: 0 0 0 8px rgba(52,211,153,0); }
}
.status-text, .refresh-info { font-size: 0.8rem; color: rgba(255,255,255,0.5); }
.refresh-info { margin-left: 0.5rem; font-variant-numeric: tabular-nums; }
.stats {
display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1rem; margin-bottom: 2rem;
}
.stat-card {
position: relative; padding: 1.3rem 1.2rem;
transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.stat-card:hover {
transform: translateY(-2px);
border-color: rgba(255, 255, 255, 0.3);
box-shadow:
0 12px 40px rgba(0, 0, 0, 0.4),
inset 0 1px 0 rgba(255, 255, 255, 0.2),
inset 0 -1px 0 rgba(255, 255, 255, 0.05);
}
.stat-label {
font-size: 0.65rem; color: rgba(255,255,255,0.4);
text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.3rem;
}
.stat-value {
font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums;
background: linear-gradient(135deg, #fff 30%, rgba(255,255,255,0.7));
-webkit-background-clip: text; -webkit-text-fill-color: transparent;
background-clip: text;
}
.stat-sub {
font-size: 0.7rem; color: rgba(255,255,255,0.35);
margin-top: 0.35rem; line-height: 1.4; font-variant-numeric: tabular-nums;
}
.progress-bar {
height: 4px; background: rgba(255,255,255,0.08);
border-radius: 2px; margin-top: 0.6rem; overflow: hidden;
}
.progress-fill {
height: 100%; border-radius: 2px; transition: width 0.8s ease;
position: relative;
}
.progress-fill::after {
content: ''; position: absolute;
top: 0; right: 0; width: 20px; height: 100%;
background: rgba(255,255,255,0.4);
filter: blur(4px); border-radius: 2px;
}
.fill-green { background: linear-gradient(90deg, #34d399, #059669); }
.fill-yellow { background: linear-gradient(90deg, #fbbf24, #d97706); }
.fill-red { background: linear-gradient(90deg, #f87171, #dc2626); }
.section-title {
font-size: 0.85rem; color: rgba(255,255,255,0.5);
margin-bottom: 0.6rem; padding-left: 0.2rem;
}
.info-list { position: relative; overflow: hidden; }
.info-row {
display: flex; justify-content: space-between; align-items: center;
padding: 0.7rem 1.2rem;
border-bottom: 1px solid rgba(255,255,255,0.06);
font-size: 0.85rem;
}
.info-row:last-child { border-bottom: none; }
.info-key { color: rgba(255,255,255,0.45); }
.info-val {
color: rgba(255,255,255,0.85); font-weight: 500;
text-align: right; font-family: 'SF Mono', 'Fira Code', monospace;
font-size: 0.78rem;
}
.footer {
text-align: center; margin-top: 3rem;
color: rgba(255,255,255,0.2); font-size: 0.7rem;
}
.footer a { color: rgba(167,139,250,0.6); text-decoration: none; }
.footer a:hover { color: rgba(167,139,250,0.9); }
@media (max-width: 600px) {
.container { padding: 1.5rem 0.75rem 2rem; }
.stats { grid-template-columns: 1fr 1fr; }
.info-row { flex-direction: column; align-items: flex-start; gap: 0.15rem; padding: 0.6rem 1rem; }
.header h1 { font-size: 1.5rem; }
.stat-value { font-size: 1.6rem; }
}
</style>
</head>
<body>
<!-- Background photo -->
<div class="bg-photo"></div>
<div class="bg-overlay"></div>
<div class="container">
<div class="header glass">
<h1>⚡ Server Dashboard</h1>
<div class="header-sub">
<span class="status-dot"></span>
<span class="status-text" id="hostnameLabel">Loading...</span>
<span class="refresh-info" id="lastUpdate">...</span>
</div>
</div>
<div class="stats">
<div class="stat-card glass">
<div class="stat-label">CPU Usage</div>
<div class="stat-value" id="cpuValue">--%</div>
<div class="stat-sub" id="cpuSub">Loading...</div>
<div class="progress-bar"><div class="progress-fill fill-green" id="cpuBar" style="width:0%"></div></div>
</div>
<div class="stat-card glass">
<div class="stat-label">Uptime</div>
<div class="stat-value" id="uptimeValue">--</div>
<div class="stat-sub" id="uptimeSub">Loading...</div>
</div>
<div class="stat-card glass">
<div class="stat-label">RAM Usage</div>
<div class="stat-value" id="memValue">-- GB</div>
<div class="stat-sub" id="memSub">Loading...</div>
<div class="progress-bar"><div class="progress-fill fill-green" id="memBar" style="width:0%"></div></div>
</div>
<div class="stat-card glass">
<div class="stat-label">Disk Usage</div>
<div class="stat-value" id="diskValue">-- GB</div>
<div class="stat-sub" id="diskSub">Loading...</div>
<div class="progress-bar"><div class="progress-fill fill-green" id="diskBar" style="width:0%"></div></div>
</div>
</div>
<div class="section-title">📋 Server Info</div>
<div class="info-list glass">
<div class="info-row"><span class="info-key">Hostname</span><span class="info-val" id="infoHostname">...</span></div>
<div class="info-row"><span class="info-key">OS</span><span class="info-val" id="infoOS">...</span></div>
<div class="info-row"><span class="info-key">Kernel</span><span class="info-val" id="infoKernel">...</span></div>
<div class="info-row"><span class="info-key">Processes</span><span class="info-val" id="infoProcs">...</span></div>
<div class="info-row"><span class="info-key">Node.js</span><span class="info-val" id="infoNode">...</span></div>
<div class="info-row"><span class="info-key">Last Update</span><span class="info-val" id="infoTime">...</span></div>
</div>
<div class="footer">
Powered by <a href="https://github.com/openclaw/openclaw" target="_blank">OpenClaw</a> · Dashboard by Hedd
</div>
</div>
<script>
function getBarColor(p) { return p < 60 ? 'fill-green' : p < 80 ? 'fill-yellow' : 'fill-red'; }
function update(d) {
const hn = (d.hostname || '').split('-').slice(0, 3).join('-') || 'N/A';
document.getElementById('hostnameLabel').textContent = hn;
const c = d.cpu || {};
document.getElementById('cpuValue').textContent = c.usage !== undefined ? c.usage + '%' : 'N/A';
const la = Array.isArray(c.loadAvg) ? c.loadAvg.join(' ') : '';
document.getElementById('cpuSub').textContent =
c.cpuCount + ' cores' +
(c.loadPercent ? ' · Load ' + c.loadPercent + '%' : '') +
(la ? ' · avg(' + la + ')' : '');
const cpuB = document.getElementById('cpuBar');
const cpuPct = typeof c.usage === 'number' ? c.usage : 0;
cpuB.style.width = cpuPct + '%';
cpuB.className = 'progress-fill ' + getBarColor(cpuPct);
document.getElementById('uptimeValue').textContent = d.uptime || '--';
document.getElementById('uptimeSub').textContent = (d.kernel || '').split('(')[0].trim();
const m = d.mem || {};
document.getElementById('memValue').textContent = m.used + ' GB';
document.getElementById('memSub').textContent = m.available + ' GB avail / ' + m.total + ' GB';
const memB = document.getElementById('memBar');
const mPct = typeof m.percent === 'number' ? m.percent : 0;
memB.style.width = mPct + '%';
memB.className = 'progress-fill ' + getBarColor(mPct);
const dk = d.disk || {};
document.getElementById('diskValue').textContent = dk.used + ' GB';
document.getElementById('diskSub').textContent = dk.free + ' GB free / ' + dk.total + ' GB';
const diskB = document.getElementById('diskBar');
const dPct = typeof dk.percent === 'number' ? dk.percent : 0;
diskB.style.width = dPct + '%';
diskB.className = 'progress-fill ' + getBarColor(dPct);
document.getElementById('infoHostname').textContent = d.hostname || '—';
document.getElementById('infoOS').textContent = d.os || '—';
document.getElementById('infoKernel').textContent = (d.kernel || '').split(' (')[0] || '—';
document.getElementById('infoProcs').textContent = d.processes || '—';
document.getElementById('infoNode').textContent = d.node || '—';
const t = new Date(d.timestamp || Date.now()).toLocaleString('id-ID', { timeZone: 'Asia/Jakarta' });
document.getElementById('infoTime').textContent = t + ' WIB';
document.getElementById('lastUpdate').textContent = 'Updated ' + t;
}
async function fetchStats() {
try {
const res = await fetch('/api/stats');
if (!res.ok) throw new Error('HTTP ' + res.status);
const data = await res.json();
update(data);
} catch (e) {
document.getElementById('lastUpdate').textContent = 'Connection lost';
}
}
fetchStats();
setInterval(fetchStats, 5000);
</script>
</body>
</html>