@bitcall/pm2-pulse-agent 1.0.1-beta.2 → 1.0.1-beta.4
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 +3 -3
- package/agent.js +7 -3
- package/package.json +19 -1
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ npm install @bitcall/pm2-pulse-agent@beta
|
|
|
28
28
|
Run the interactive setup script to configure the agent:
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
npx
|
|
31
|
+
npx pm2-pulse-setup
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
Or if installed globally:
|
|
@@ -51,7 +51,7 @@ Settings are saved to `.env` file in your current directory.
|
|
|
51
51
|
|
|
52
52
|
**Using npx (recommended):**
|
|
53
53
|
```bash
|
|
54
|
-
npx
|
|
54
|
+
npx pm2-pulse-agent
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
**If installed globally:**
|
|
@@ -61,7 +61,7 @@ pm2-pulse-agent
|
|
|
61
61
|
|
|
62
62
|
**Run with PM2 (for persistent monitoring):**
|
|
63
63
|
```bash
|
|
64
|
-
pm2 start
|
|
64
|
+
pm2 start pm2-pulse-agent --name pm2-pulse-agent
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
### Configuration Options
|
package/agent.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const os = require('os')
|
|
4
|
+
const path = require('path')
|
|
4
5
|
const { exec } = require('child_process')
|
|
5
6
|
const grpc = require('@grpc/grpc-js')
|
|
6
7
|
const protoLoader = require('@grpc/proto-loader')
|
|
@@ -14,6 +15,9 @@ const DEFAULT_CPU_THRESHOLD = 70
|
|
|
14
15
|
const DEFAULT_RAM_THRESHOLD = 80
|
|
15
16
|
const DEFAULT_AUTH_TOKEN = process.env.AUTH_TOKEN || ''
|
|
16
17
|
|
|
18
|
+
// Load proto from package directory
|
|
19
|
+
const PROTO_PATH = path.join(__dirname, 'monitoring.proto')
|
|
20
|
+
|
|
17
21
|
class MonitoringAgent {
|
|
18
22
|
static instance = null
|
|
19
23
|
|
|
@@ -163,9 +167,9 @@ class MonitoringAgent {
|
|
|
163
167
|
}
|
|
164
168
|
}
|
|
165
169
|
|
|
166
|
-
// Load proto
|
|
170
|
+
// Load proto with correct path
|
|
167
171
|
const proto = grpc.loadPackageDefinition(
|
|
168
|
-
protoLoader.loadSync(
|
|
172
|
+
protoLoader.loadSync(PROTO_PATH, {
|
|
169
173
|
keepCase: true,
|
|
170
174
|
longs: String,
|
|
171
175
|
enums: String,
|
|
@@ -178,4 +182,4 @@ module.exports = MonitoringAgent
|
|
|
178
182
|
|
|
179
183
|
if (require.main === module) {
|
|
180
184
|
MonitoringAgent.getInstance().start()
|
|
181
|
-
}
|
|
185
|
+
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitcall/pm2-pulse-agent",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.4",
|
|
4
|
+
"description": "PM2 monitoring agent that tracks server metrics and sends alerts via gRPC",
|
|
5
|
+
"main": "agent.js",
|
|
4
6
|
"bin": {
|
|
5
7
|
"pm2-pulse-setup": "./scripts/setup-agent.js",
|
|
6
8
|
"pm2-pulse-agent": "./agent.js"
|
|
7
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"agent.js",
|
|
12
|
+
"monitoring.proto",
|
|
13
|
+
"scripts/",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
8
16
|
"scripts": {
|
|
9
17
|
"agent": "node agent.js",
|
|
10
18
|
"monitor": "node agent.js",
|
|
11
19
|
"setup-agent": "node scripts/setup-agent.js"
|
|
12
20
|
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"pm2",
|
|
23
|
+
"monitoring",
|
|
24
|
+
"metrics",
|
|
25
|
+
"grpc",
|
|
26
|
+
"server-monitoring",
|
|
27
|
+
"alerts"
|
|
28
|
+
],
|
|
29
|
+
"author": "bitcaller",
|
|
30
|
+
"license": "MIT",
|
|
13
31
|
"dependencies": {
|
|
14
32
|
"@grpc/grpc-js": "^1.10.1",
|
|
15
33
|
"@grpc/proto-loader": "^0.7.10",
|