@gazzehamine/armada-watch-agent 1.3.0 → 1.3.1
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/dist/collector.js +31 -21
- package/package.json +1 -1
package/dist/collector.js
CHANGED
|
@@ -149,28 +149,38 @@ async function collectProcesses() {
|
|
|
149
149
|
}
|
|
150
150
|
async function collectDockerContainers() {
|
|
151
151
|
try {
|
|
152
|
+
// Get basic container info and stats
|
|
152
153
|
const dockerContainers = await systeminformation_1.default.dockerContainers();
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
154
|
+
const dockerStats = await systeminformation_1.default.dockerContainerStats('*');
|
|
155
|
+
// Create a map of stats by container ID
|
|
156
|
+
const statsMap = new Map();
|
|
157
|
+
dockerStats.forEach((stat) => {
|
|
158
|
+
statsMap.set(stat.id, stat);
|
|
159
|
+
});
|
|
160
|
+
return dockerContainers.map((container) => {
|
|
161
|
+
const stats = statsMap.get(container.id) || {};
|
|
162
|
+
return {
|
|
163
|
+
id: container.id || '',
|
|
164
|
+
name: container.name || '',
|
|
165
|
+
image: container.image || '',
|
|
166
|
+
state: container.state || 'unknown',
|
|
167
|
+
status: container.state || 'unknown',
|
|
168
|
+
created: container.created || 0,
|
|
169
|
+
started: container.started || 0,
|
|
170
|
+
cpuPercent: stats.cpuPercent || 0,
|
|
171
|
+
memoryPercent: stats.memPercent || 0,
|
|
172
|
+
memoryUsage: stats.memUsage || 0,
|
|
173
|
+
memoryLimit: stats.memLimit || 0,
|
|
174
|
+
netIO: {
|
|
175
|
+
rx: stats.netIO?.rx || 0,
|
|
176
|
+
wx: stats.netIO?.wx || 0,
|
|
177
|
+
},
|
|
178
|
+
blockIO: {
|
|
179
|
+
r: stats.blockIO?.r || 0,
|
|
180
|
+
w: stats.blockIO?.w || 0,
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
});
|
|
174
184
|
}
|
|
175
185
|
catch (error) {
|
|
176
186
|
// Docker not available or not running
|