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

67
views/agent_detail.templ Normal file
View File

@@ -0,0 +1,67 @@
package views
import (
"fmt"
"nerd-monitor/internal/store"
)
templ AgentDetail(agent *store.AgentStats) {
@BaseLayout(agent.Hostname, agentDetailContent(agent))
}
templ agentDetailContent(agent *store.AgentStats) {
<a href="/" class="back-link">← Back to Dashboard</a>
<div style="display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem;">
<h2 style="margin: 0;">{ agent.Hostname }</h2>
@AgentStatusBadge(agent.LastSeen)
</div>
<div class="grid" style="grid-template-columns: 1fr;">
<div class="card">
<div class="card-title">CPU Usage</div>
<div class="metric-value" style="font-size: 2rem; margin: 1rem 0;">
{ FormatPercent(agent.CPUUsage) }
</div>
<div class="progress-bar">
<div class={ "progress-fill", calcProgressClass(agent.CPUUsage/100) } style={ fmt.Sprintf("width: %.1f%%", agent.CPUUsage) }></div>
</div>
<div style="margin-top: 1rem; font-size: 0.875rem; color: #94a3b8;">
Last updated: { FormatTime(agent.LastSeen) }
</div>
</div>
</div>
<div class="grid" style="margin-top: 1.5rem;">
<div class="card">
<div class="card-title">Memory Usage</div>
@UsageBar("RAM", agent.RAMUsage, agent.RAMTotal)
</div>
<div class="card">
<div class="card-title">Disk Usage</div>
@UsageBar("Disk", agent.DiskUsage, agent.DiskTotal)
</div>
</div>
<div class="card" style="margin-top: 1.5rem;">
<div class="card-title">Agent Information</div>
<div class="metric-row">
<span class="metric-label">Agent ID</span>
<span class="metric-value" style="font-family: monospace; font-size: 0.875rem;">{ agent.ID }</span>
</div>
<div class="metric-row">
<span class="metric-label">Hostname</span>
<span class="metric-value">{ agent.Hostname }</span>
</div>
<div class="metric-row">
<span class="metric-label">Last Seen</span>
<span class="metric-value">{ agent.LastSeen.Format("2006-01-02 15:04:05") }</span>
</div>
</div>
<div class="btn-group" style="margin-top: 1.5rem;">
<form method="POST" action={ templ.SafeURL(fmt.Sprintf("/api/agents/%s/delete", agent.ID)) } style="margin: 0;" onsubmit="return confirm('Are you sure you want to remove this agent?');">
<button type="submit" class="btn btn-danger">Delete Agent</button>
</form>
</div>
}