pyre-cli 3.12.0 → 4.13.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/README.md +2 -6
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/src/monitors/collectors.ts +8 -8
package/README.md
CHANGED
|
@@ -7,6 +7,8 @@ Mac system monitoring CLI: temps, CPU, memory, disk, battery, live dashboard, pa
|
|
|
7
7
|

|
|
8
8
|

|
|
9
9
|
|
|
10
|
+
> Note : things may not work as intended if your firewall settings do not allow inbound connections for this program
|
|
11
|
+
|
|
10
12
|
## Features
|
|
11
13
|
|
|
12
14
|
- **P2P live data streaming** — send live system stats to another system over TCP with password authentication, TLS encryption, rate limiting, IP allow/deny lists, audit logging, and HMAC message signing
|
|
@@ -38,12 +40,6 @@ npm install -g pyre-cli
|
|
|
38
40
|
curl -fsSL https://raw.githubusercontent.com/somalip/pyre/main/install.sh | bash
|
|
39
41
|
```
|
|
40
42
|
|
|
41
|
-
### Homebrew
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
brew install pyre
|
|
45
|
-
```
|
|
46
|
-
|
|
47
43
|
## Usage
|
|
48
44
|
|
|
49
45
|
### Static snapshot
|
package/dist/index.js
CHANGED
|
@@ -509,7 +509,7 @@ async function collectProcesses(limit) {
|
|
|
509
509
|
const raw = (await run(`ps -eo pid,ppid,user,pcpu,pmem,state,${threadsArg},time,comm ${sortArg}${headClause}`)).trim();
|
|
510
510
|
const lines = raw.split("\n").slice(1);
|
|
511
511
|
return lines.map((line) => {
|
|
512
|
-
const parts = line.match(/\s*(\d+)\s+(\d+)\s+(\S+)\s+([\d.]+)\s+([\d.]+)\s+(\S+)\s+(\d+)\s+([\d
|
|
512
|
+
const parts = line.match(/\s*(\d+)\s+(\d+)\s+(\S+)\s+([\d.]+)\s+([\d.]+)\s+(\S+)\s+(\d+)\s+([\d:.]+)\s+(.+)/);
|
|
513
513
|
if (!parts) return null;
|
|
514
514
|
const runtimeSec = parts[8].split(":").reduce((acc, val, idx) => acc + parseInt(val) * Math.pow(60, 2 - idx), 0);
|
|
515
515
|
return { pid: parseInt(parts[1]), ppid: parseInt(parts[2]), user: parts[3], cpu: parseFloat(parts[4]), mem: parseFloat(parts[5]), state: parts[6], threads: parseInt(parts[7]), runtime: runtimeSec, command: parts[9] };
|
|
@@ -590,7 +590,7 @@ async function collectTasks(limit = 12) {
|
|
|
590
590
|
const raw = (await run(`ps -eo pid,user,pcpu,pmem,state,time,comm ${sortArg} | head -n ${limit + 1}`)).trim();
|
|
591
591
|
const lines = raw.split("\n").slice(1);
|
|
592
592
|
return lines.map((line) => {
|
|
593
|
-
const parts = line.match(/\s*(\d+)\s+(\S+)\s+([\d.]+)\s+([\d.]+)\s+(\S+)\s+([\d
|
|
593
|
+
const parts = line.match(/\s*(\d+)\s+(\S+)\s+([\d.]+)\s+([\d.]+)\s+(\S+)\s+([\d:.]+)\s+(.+)/);
|
|
594
594
|
if (!parts) return null;
|
|
595
595
|
const runtimeSec = parts[6].split(":").reduce((acc, val, idx) => acc + parseInt(val) * Math.pow(60, 2 - idx), 0);
|
|
596
596
|
return { pid: parseInt(parts[1]), user: parts[2], cpu: parseFloat(parts[3]), mem: parseFloat(parts[4]), state: parts[5], runtime: runtimeSec, command: parts[7] };
|
package/package.json
CHANGED
|
@@ -614,10 +614,10 @@ export async function collectProcesses(limit?: number): Promise<ProcessData[]> {
|
|
|
614
614
|
const lines = raw.split('\n').slice(1);
|
|
615
615
|
return lines
|
|
616
616
|
.map(line => {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
617
|
+
const parts = line.match(/\s*(\d+)\s+(\d+)\s+(\S+)\s+([\d.]+)\s+([\d.]+)\s+(\S+)\s+(\d+)\s+([\d:.]+)\s+(.+)/);
|
|
618
|
+
if (!parts) return null;
|
|
619
|
+
const runtimeSec = parts[8].split(':').reduce((acc, val, idx) => acc + parseInt(val) * Math.pow(60, 2 - idx), 0);
|
|
620
|
+
return { pid: parseInt(parts[1]), ppid: parseInt(parts[2]), user: parts[3], cpu: parseFloat(parts[4]), mem: parseFloat(parts[5]), state: parts[6], threads: parseInt(parts[7]), runtime: runtimeSec, command: parts[9] };
|
|
621
621
|
})
|
|
622
622
|
.filter((p): p is ProcessData => p !== null && p.pid > 0);
|
|
623
623
|
} catch {
|
|
@@ -704,10 +704,10 @@ export async function collectTasks(limit = 12): Promise<TaskData[]> {
|
|
|
704
704
|
const lines = raw.split('\n').slice(1);
|
|
705
705
|
return lines
|
|
706
706
|
.map(line => {
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
707
|
+
const parts = line.match(/\s*(\d+)\s+(\S+)\s+([\d.]+)\s+([\d.]+)\s+(\S+)\s+([\d:.]+)\s+(.+)/);
|
|
708
|
+
if (!parts) return null;
|
|
709
|
+
const runtimeSec = parts[6].split(':').reduce((acc, val, idx) => acc + parseInt(val) * Math.pow(60, 2 - idx), 0);
|
|
710
|
+
return { pid: parseInt(parts[1]), user: parts[2], cpu: parseFloat(parts[3]), mem: parseFloat(parts[4]), state: parts[5], runtime: runtimeSec, command: parts[7] };
|
|
711
711
|
})
|
|
712
712
|
.filter((t): t is TaskData => t !== null && t.pid > 0);
|
|
713
713
|
} catch {
|