Add Agents UI page + installer script endpoint
- client/src/Agents.js: page showing registered Linux agents with live status, CPU/memory/disk gauge bars, load/uptime/network stats, and an install-instructions panel with copyable curl commands - client/src/Agents.css: dark-theme card grid styles matching the app - client/src/App.js: adds /agents route and Agents nav link - server/index.js: adds GET /api/agents/installer to serve install-agent.sh - client/build: production build updated Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
06e8e64a0b
commit
020a8a8ea7
13 files changed
+688
-15
No files matched your search
+14
-1
@@ -2170,7 +2170,7 @@ app.post('/api/resources/import', express.text({ type: 'text/csv' }), (req, res)
|
||||
|
||||
// ===== Agent API =====
|
||||
|
||||
// Serve the agent install script so remote hosts can curl it
|
||||
// Serve the agent daemon script
|
||||
app.get('/api/agents/script', (req, res) => {
|
||||
const fs = require('fs');
|
||||
const scriptPath = path.join(__dirname, '../agent/skywatch-agent.sh');
|
||||
@@ -2183,6 +2183,19 @@ app.get('/api/agents/script', (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Serve the installer script
|
||||
app.get('/api/agents/installer', (req, res) => {
|
||||
const fs = require('fs');
|
||||
const installerPath = path.join(__dirname, '../agent/install-agent.sh');
|
||||
if (fs.existsSync(installerPath)) {
|
||||
res.setHeader('Content-Type', 'text/x-sh');
|
||||
res.setHeader('Content-Disposition', 'attachment; filename="install-agent.sh"');
|
||||
res.sendFile(installerPath);
|
||||
} else {
|
||||
res.status(404).json({ error: 'Installer script not found on this server' });
|
||||
}
|
||||
});
|
||||
|
||||
// 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
|
||||
|
||||
Reference in new issue
Block a user