Add macOS and Windows agents + multi-platform install UI

- agent/skywatch-agent-macos.sh: Full macOS bash agent (launchd)
  - CPU via top -l 2, memory via vm_stat/sysctl, disk via df -P
  - Network via netstat -ib, uptime via kern.boottime, OS via sw_vers
- agent/install-agent-macos.sh: Installs macOS agent as launchd daemon
- agent/skywatch-agent-windows.ps1: PowerShell agent (Task Scheduler)
  - CPU via Win32_PerfRawData two-sample delta, memory via Win32_OperatingSystem
  - Disk via Get-PSDrive, network via Get-NetAdapterStatistics
- agent/install-agent-windows.ps1: Installs Windows agent via Task Scheduler
- server/index.js: New routes for macOS and Windows agent scripts/installers
- client/src/Agents.js: Multi-platform install panel with Linux/macOS/Windows tabs
- client/src/Agents.css: Platform tab button styles

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
nmemmertandClaude Sonnet 4.6 committed 2026-08-11 16:54:50 -04:00
1 parent 784e539af3
commit 13b3e3612b
16 files changed
+1009 -34

No files matched your search

+42
View File
@@ -2196,6 +2196,48 @@ app.get('/api/agents/installer', (req, res) => {
}
});
// macOS agent scripts
app.get('/api/agents/script-macos', (req, res) => {
const fs = require('fs');
const p = path.join(__dirname, '../agent/skywatch-agent-macos.sh');
if (fs.existsSync(p)) {
res.setHeader('Content-Type', 'text/x-sh');
res.setHeader('Content-Disposition', 'attachment; filename="skywatch-agent-macos.sh"');
res.sendFile(p);
} else { res.status(404).json({ error: 'macOS agent script not found' }); }
});
app.get('/api/agents/installer-macos', (req, res) => {
const fs = require('fs');
const p = path.join(__dirname, '../agent/install-agent-macos.sh');
if (fs.existsSync(p)) {
res.setHeader('Content-Type', 'text/x-sh');
res.setHeader('Content-Disposition', 'attachment; filename="install-agent-macos.sh"');
res.sendFile(p);
} else { res.status(404).json({ error: 'macOS installer not found' }); }
});
// Windows agent scripts
app.get('/api/agents/script-windows', (req, res) => {
const fs = require('fs');
const p = path.join(__dirname, '../agent/skywatch-agent-windows.ps1');
if (fs.existsSync(p)) {
res.setHeader('Content-Type', 'text/plain');
res.setHeader('Content-Disposition', 'attachment; filename="skywatch-agent-windows.ps1"');
res.sendFile(p);
} else { res.status(404).json({ error: 'Windows agent script not found' }); }
});
app.get('/api/agents/installer-windows', (req, res) => {
const fs = require('fs');
const p = path.join(__dirname, '../agent/install-agent-windows.ps1');
if (fs.existsSync(p)) {
res.setHeader('Content-Type', 'text/plain');
res.setHeader('Content-Disposition', 'attachment; filename="install-agent-windows.ps1"');
res.sendFile(p);
} else { res.status(404).json({ error: 'Windows installer not found' }); }
});
// Register a new Linux agent — returns a bearer token the agent uses for all future calls
app.post('/api/agents/register', rateLimit(5), (req, res) => {
// Optional: if AGENT_REGISTRATION_KEY is set in env, require it as X-Registration-Key header