@gazzehamine/armada-watch-agent 1.2.0 → 1.3.0

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 CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getSystemInfo = getSystemInfo;
7
7
  exports.collectMetrics = collectMetrics;
8
8
  exports.collectProcesses = collectProcesses;
9
+ exports.collectDockerContainers = collectDockerContainers;
9
10
  const systeminformation_1 = __importDefault(require("systeminformation"));
10
11
  const os_1 = __importDefault(require("os"));
11
12
  let lastNetworkStats = null;
@@ -146,3 +147,33 @@ async function collectProcesses() {
146
147
  memory: p.mem,
147
148
  }));
148
149
  }
150
+ async function collectDockerContainers() {
151
+ try {
152
+ const dockerContainers = await systeminformation_1.default.dockerContainers();
153
+ return dockerContainers.map((container) => ({
154
+ id: container.id || '',
155
+ name: container.name || '',
156
+ image: container.image || '',
157
+ state: container.state || 'unknown',
158
+ status: container.state || 'unknown',
159
+ created: container.created || 0,
160
+ started: container.started || 0,
161
+ cpuPercent: container.cpuPercent || 0,
162
+ memoryPercent: container.memPercent || 0,
163
+ memoryUsage: container.memUsage || 0,
164
+ memoryLimit: container.memLimit || 0,
165
+ netIO: {
166
+ rx: container.netIO?.rx || 0,
167
+ wx: container.netIO?.wx || 0,
168
+ },
169
+ blockIO: {
170
+ r: container.blockIO?.r || 0,
171
+ w: container.blockIO?.w || 0,
172
+ },
173
+ }));
174
+ }
175
+ catch (error) {
176
+ // Docker not available or not running
177
+ return [];
178
+ }
179
+ }
package/dist/index.js CHANGED
@@ -48,6 +48,7 @@ async function sendMetrics() {
48
48
  try {
49
49
  const metrics = await (0, collector_1.collectMetrics)();
50
50
  const processes = await (0, collector_1.collectProcesses)();
51
+ const dockerContainers = await (0, collector_1.collectDockerContainers)();
51
52
  const payload = {
52
53
  instanceInfo,
53
54
  metrics: {
@@ -55,6 +56,7 @@ async function sendMetrics() {
55
56
  ...metrics,
56
57
  },
57
58
  processes,
59
+ dockerContainers,
58
60
  };
59
61
  await axios_1.default.post(`${SERVER_URL}/api/metrics`, payload, {
60
62
  timeout: 5000,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gazzehamine/armada-watch-agent",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Monitoring agent for Armada Watch - EC2 instance monitoring",
5
5
  "main": "dist/index.js",
6
6
  "bin": {