thinknagent 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/thinknagent.js +2 -0
- package/lib/agent.js +5 -0
- package/lib/metrics.js +3 -0
- package/package.json +1 -1
package/bin/thinknagent.js
CHANGED
|
@@ -21,6 +21,7 @@ program
|
|
|
21
21
|
.description('Register this server with ThinkNCollab')
|
|
22
22
|
.requiredOption('--server <url>', 'ThinkNCollab server URL (e.g. https://thinkncollab.com)')
|
|
23
23
|
.requiredOption('--name <name>', 'Display name for this server on the DevOps Wall')
|
|
24
|
+
.option('--room <roomId>', 'Room ID to connect to')
|
|
24
25
|
.option('--gpu', 'Enable GPU metrics (requires nvidia-smi)')
|
|
25
26
|
.option('--logs <paths>', 'Comma-separated log file paths to stream')
|
|
26
27
|
.action(async (opts) => {
|
|
@@ -38,6 +39,7 @@ program
|
|
|
38
39
|
name: opts.name,
|
|
39
40
|
gpu: !!opts.gpu,
|
|
40
41
|
logs: opts.logs ? opts.logs.split(',').map(s => s.trim()) : [],
|
|
42
|
+
roomId: opts.room,
|
|
41
43
|
alerts: [
|
|
42
44
|
// sensible defaults — Owner can edit in browser
|
|
43
45
|
{ id: 'cpu-high', metric: 'cpu.usage', op: 'gt', value: 85, for: 60, severity: 'warning' },
|
package/lib/agent.js
CHANGED
|
@@ -64,6 +64,10 @@ class Agent {
|
|
|
64
64
|
this.logs = new LogWatcher({ connection: this.conn, logPaths: logs });
|
|
65
65
|
this.logs.start();
|
|
66
66
|
});
|
|
67
|
+
// ← YE ADD KARO
|
|
68
|
+
this.conn.socket.on('agent:send_metrics_now', () => {
|
|
69
|
+
this.metrics.pollNow();
|
|
70
|
+
});
|
|
67
71
|
|
|
68
72
|
// Graceful shutdown
|
|
69
73
|
process.on('SIGTERM', () => this._shutdown('SIGTERM'));
|
|
@@ -92,6 +96,7 @@ class Agent {
|
|
|
92
96
|
nodeVersion: process.version,
|
|
93
97
|
});
|
|
94
98
|
}
|
|
99
|
+
|
|
95
100
|
|
|
96
101
|
_onDisconnect(reason) {
|
|
97
102
|
this.shell.killAll();
|
package/lib/metrics.js
CHANGED