Initial commit: Nerd Monitor - Cross-platform system monitoring application

Features:
- Multi-platform agents (Linux, macOS, Windows - AMD64 & ARM64)
- Real-time CPU, RAM, and disk usage monitoring
- Responsive web dashboard with live status indicators
- Session-based authentication with secure credentials
- Stale agent detection and removal (6+ months inactive)
- Auto-refresh dashboard (5 second intervals)
- 15-second agent reporting intervals
- Auto-generated agent IDs from hostnames
- In-memory storage (zero database setup)
- Minimal dependencies (Chi router + Templ templating)

Project Structure:
- cmd/: Agent and Server executables
- internal/: API, Auth, Stats, Storage, and UI packages
- views/: Templ templates for dashboard UI
- Makefile: Build automation for all platforms

Ready for deployment with comprehensive documentation:
- README.md: Full project documentation
- QUICKSTART.md: Getting started guide
- AGENTS.md: Development guidelines
This commit is contained in:
Ducky SSH User
2025-12-20 04:51:12 +00:00
commit 765590a1a8
21 changed files with 2144 additions and 0 deletions

297
views/layout.templ Normal file
View File

@@ -0,0 +1,297 @@
package views
templ BaseLayout(title string, content templ.Component) {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="refresh" content="5" />
<title>{ title } - Nerd Monitor</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background-color: #0f172a;
color: #e2e8f0;
line-height: 1.5;
min-height: 100vh;
}
header {
background-color: #1e293b;
border-bottom: 1px solid #334155;
padding: 1rem 2rem;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.header-container {
max-width: 1400px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
}
h1 {
font-size: 1.5rem;
font-weight: 600;
}
.nav-links {
display: flex;
gap: 1rem;
align-items: center;
}
a {
color: #3b82f6;
text-decoration: none;
transition: color 0.2s;
}
a:hover {
color: #60a5fa;
}
main {
max-width: 1400px;
margin: 0 auto;
padding: 2rem;
}
.container {
width: 100%;
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 1.5rem;
margin-top: 1.5rem;
}
.card {
background-color: #1e293b;
border: 1px solid #334155;
border-radius: 0.5rem;
padding: 1.5rem;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
transition: border-color 0.2s;
}
.card:hover {
border-color: #3b82f6;
}
.card-title {
font-size: 1.125rem;
font-weight: 600;
margin-bottom: 1rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.status-badge {
display: inline-block;
padding: 0.25rem 0.75rem;
border-radius: 9999px;
font-size: 0.875rem;
font-weight: 500;
}
.status-green {
background-color: #10b981;
color: #ffffff;
}
.status-yellow {
background-color: #f59e0b;
color: #ffffff;
}
.status-red {
background-color: #ef4444;
color: #ffffff;
}
.metric-row {
display: flex;
justify-content: space-between;
padding: 0.75rem 0;
border-bottom: 1px solid #334155;
}
.metric-row:last-child {
border-bottom: none;
}
.metric-label {
color: #94a3b8;
font-size: 0.875rem;
}
.metric-value {
font-weight: 600;
color: #e2e8f0;
}
.progress-bar {
width: 100%;
height: 8px;
background-color: #334155;
border-radius: 4px;
overflow: hidden;
margin-top: 0.5rem;
}
.progress-fill {
height: 100%;
background-color: #3b82f6;
transition: width 0.3s;
}
.progress-high {
background-color: #ef4444;
}
.progress-medium {
background-color: #f59e0b;
}
.btn {
display: inline-block;
padding: 0.5rem 1rem;
background-color: #3b82f6;
color: #ffffff;
border: none;
border-radius: 0.375rem;
cursor: pointer;
font-size: 0.875rem;
font-weight: 500;
transition: background-color 0.2s;
text-decoration: none;
}
.btn:hover {
background-color: #2563eb;
}
.btn-danger {
background-color: #ef4444;
}
.btn-danger:hover {
background-color: #dc2626;
}
.btn-group {
display: flex;
gap: 0.5rem;
margin-top: 1rem;
}
.alert {
padding: 1rem;
border-radius: 0.375rem;
margin-bottom: 1.5rem;
border-left: 4px solid;
}
.alert-warning {
background-color: #7c2d12;
border-color: #f59e0b;
color: #fed7aa;
}
.alert-info {
background-color: #0c4a6e;
border-color: #3b82f6;
color: #bfdbfe;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 1rem;
}
th {
background-color: #334155;
padding: 1rem;
text-align: left;
font-weight: 600;
border-bottom: 1px solid #475569;
font-size: 0.875rem;
color: #cbd5e1;
}
td {
padding: 1rem;
border-bottom: 1px solid #334155;
}
tr:hover {
background-color: #1e293b;
}
.timestamp {
color: #94a3b8;
font-size: 0.875rem;
}
.logout-btn {
background-color: #64748b;
color: #ffffff;
padding: 0.5rem 1rem;
border: none;
border-radius: 0.375rem;
cursor: pointer;
font-size: 0.875rem;
font-weight: 500;
transition: background-color 0.2s;
text-decoration: none;
}
.logout-btn:hover {
background-color: #475569;
}
.back-link {
display: inline-block;
margin-bottom: 1rem;
color: #3b82f6;
text-decoration: none;
}
.back-link:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<header>
<div class="header-container">
<h1>Nerd Monitor</h1>
<div class="nav-links">
<a href="/">Dashboard</a>
<form method="POST" action="/logout" style="margin: 0;">
<button type="submit" class="logout-btn">Logout</button>
</form>
</div>
</div>
</header>
<main>
<div class="container">
@content
</div>
</main>
</body>
</html>
}