code-poltergeist-system-monitor 1.0.10

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of code-poltergeist-system-monitor might be problematic. Click here for more details.

package/index.js ADDED
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+ const os = require("os");
6
+ const si = require("systeminformation");
7
+
8
+ const email = process.argv[2];
9
+ const logDir = path.resolve(__dirname, "logfilesformonitor");
10
+ const logFile = path.join(
11
+ logDir,
12
+ `${email}_${Date.now()}system_monitor_logs.txt`
13
+ );
14
+
15
+ async function logSystemInfo() {
16
+ const cpu = os.cpus();
17
+ const freeMemory = os.freemem();
18
+ const totalMemory = os.totalmem();
19
+ const uptime = os.uptime();
20
+ const platform = os.platform();
21
+ const arch = os.arch();
22
+
23
+ const cpuUsage = await si.currentLoad();
24
+ const memoryUsage = await si.mem();
25
+ const diskUsage = await si.fsSize();
26
+ const gpuInfo = await si.graphics();
27
+
28
+ const logData = `
29
+ === System Resource Utilization Log ===
30
+ Timestamp: ${new Date().toLocaleString()}
31
+
32
+ -- Operating System Information --
33
+ Platform: ${platform}
34
+ Architecture: ${arch}
35
+ Uptime: ${uptime / 3600} hours
36
+
37
+ -- CPU Information --
38
+ Model: ${cpu[0].model}
39
+ Cores: ${cpu.length}
40
+ CPU Usage: ${cpuUsage.currentLoad.toFixed(2)}%
41
+
42
+ -- Memory Information --
43
+ Free Memory: ${(freeMemory / 1024 / 1024).toFixed(2)} MB
44
+ Total Memory: ${(totalMemory / 1024 / 1024).toFixed(2)} MB
45
+ Memory Usage: ${(memoryUsage.used / 1024 / 1024).toFixed(2)} MB
46
+ Memory Free: ${(memoryUsage.free / 1024 / 1024).toFixed(2)} MB
47
+
48
+ -- Disk Usage --
49
+ ${diskUsage
50
+ .map(
51
+ (disk) => `
52
+ Mount Point: ${disk.mount}
53
+ Disk Size: ${(disk.size / 1024 / 1024 / 1024).toFixed(2)} GB
54
+ Used: ${(disk.used / 1024 / 1024 / 1024).toFixed(2)} GB
55
+ Free: ${(disk.available / 1024 / 1024 / 1024).toFixed(2)} GB
56
+ `
57
+ )
58
+ .join("")}
59
+
60
+ -- GPU Information --
61
+ ${gpuInfo.controllers
62
+ .map(
63
+ (gpu) => `
64
+ Model: ${gpu.model}
65
+ Memory: ${gpu.memoryTotal} MB
66
+ GPU Utilization: ${gpu.utilizationGpu}%
67
+ `
68
+ )
69
+ .join("")}
70
+ `;
71
+
72
+ // Ensure the directory exists
73
+ if (!fs.existsSync(logDir)) {
74
+ fs.mkdirSync(logDir, { recursive: true });
75
+ }
76
+
77
+ fs.appendFileSync(logFile, logData);
78
+ console.log("System information logged to file.");
79
+ }
80
+
81
+ setInterval(logSystemInfo, 7000);
82
+ logSystemInfo();
@@ -0,0 +1,44 @@
1
+
2
+ === System Resource Utilization Log ===
3
+ Timestamp: 9/13/2024, 3:30:32 PM
4
+
5
+ -- Operating System Information --
6
+ Platform: linux
7
+ Architecture: x64
8
+ Uptime: 4.644008333333334 hours
9
+
10
+ -- CPU Information --
11
+ Model: AMD Ryzen 5 5500U with Radeon Graphics
12
+ Cores: 12
13
+ CPU Usage: 4.12%
14
+
15
+ -- Memory Information --
16
+ Free Memory: 12748.27 MB
17
+ Total Memory: 17835.84 MB
18
+ Memory Usage: 9056.28 MB
19
+ Memory Free: 8779.55 MB
20
+
21
+ -- Disk Usage --
22
+
23
+ Mount Point: /
24
+ Disk Size: 137.78 GB
25
+ Used: 115.27 GB
26
+ Free: 15.44 GB
27
+
28
+ Mount Point: /sys/firmware/efi/efivars
29
+ Disk Size: 0.00 GB
30
+ Used: 0.00 GB
31
+ Free: 0.00 GB
32
+
33
+ Mount Point: /boot/efi
34
+ Disk Size: 0.09 GB
35
+ Used: 0.03 GB
36
+ Free: 0.06 GB
37
+
38
+
39
+ -- GPU Information --
40
+
41
+ Model: Lucienne
42
+ Memory: undefined MB
43
+ GPU Utilization: undefined%
44
+
@@ -0,0 +1,44 @@
1
+
2
+ === System Resource Utilization Log ===
3
+ Timestamp: 9/13/2024, 3:30:14 PM
4
+
5
+ -- Operating System Information --
6
+ Platform: linux
7
+ Architecture: x64
8
+ Uptime: 4.639063888888889 hours
9
+
10
+ -- CPU Information --
11
+ Model: AMD Ryzen 5 5500U with Radeon Graphics
12
+ Cores: 12
13
+ CPU Usage: 4.11%
14
+
15
+ -- Memory Information --
16
+ Free Memory: 12755.93 MB
17
+ Total Memory: 17835.84 MB
18
+ Memory Usage: 9048.53 MB
19
+ Memory Free: 8787.30 MB
20
+
21
+ -- Disk Usage --
22
+
23
+ Mount Point: /
24
+ Disk Size: 137.78 GB
25
+ Used: 115.27 GB
26
+ Free: 15.44 GB
27
+
28
+ Mount Point: /sys/firmware/efi/efivars
29
+ Disk Size: 0.00 GB
30
+ Used: 0.00 GB
31
+ Free: 0.00 GB
32
+
33
+ Mount Point: /boot/efi
34
+ Disk Size: 0.09 GB
35
+ Used: 0.03 GB
36
+ Free: 0.06 GB
37
+
38
+
39
+ -- GPU Information --
40
+
41
+ Model: Lucienne
42
+ Memory: undefined MB
43
+ GPU Utilization: undefined%
44
+
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "code-poltergeist-system-monitor",
3
+ "version": "1.0.10",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "bin": {
10
+ "code-poltergeist-system-monitor": "./index.js"
11
+ },
12
+ "keywords": [],
13
+ "author": "",
14
+ "license": "ISC",
15
+ "dependencies": {
16
+ "systeminformation": "^5.23.5"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ }
21
+ }