@bitcall/pm2-pulse-agent 1.0.1-beta.1 → 1.0.1-beta.2

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 CHANGED
@@ -14,7 +14,7 @@ A Node.js monitoring agent that tracks server metrics (CPU, RAM, processes) and
14
14
  ## Installation
15
15
 
16
16
  ```bash
17
- npm install
17
+ npm install @bitcall/pm2-pulse-agent@beta
18
18
  ```
19
19
 
20
20
  ### Dependencies
@@ -28,7 +28,14 @@ npm install
28
28
  Run the interactive setup script to configure the agent:
29
29
 
30
30
  ```bash
31
- npm run setup-agent
31
+ npx @bitcall/pm2-pulse-agent pm2-pulse-setup
32
+ ```
33
+
34
+ Or if installed globally:
35
+
36
+ ```bash
37
+ npm install -g @bitcall/pm2-pulse-agent@beta
38
+ pm2-pulse-setup
32
39
  ```
33
40
 
34
41
  This will prompt you to configure:
@@ -36,16 +43,25 @@ This will prompt you to configure:
36
43
  - **MONITOR_SERVER**: gRPC server address (default: `localhost:50051`)
37
44
  - **VPS_ID**: Unique identifier for this server (default: `server-{hostname}`)
38
45
 
39
- Settings are saved to `.env` file.
46
+ Settings are saved to `.env` file in your current directory.
40
47
 
41
48
  ## Usage
42
49
 
43
50
  ### Start the Agent
44
51
 
52
+ **Using npx (recommended):**
53
+ ```bash
54
+ npx @bitcall/pm2-pulse-agent pm2-pulse-agent
55
+ ```
56
+
57
+ **If installed globally:**
58
+ ```bash
59
+ pm2-pulse-agent
60
+ ```
61
+
62
+ **Run with PM2 (for persistent monitoring):**
45
63
  ```bash
46
- npm run agent
47
- # or
48
- npm run monitor
64
+ pm2 start "npx @bitcall/pm2-pulse-agent pm2-pulse-agent" --name pm2-pulse-agent
49
65
  ```
50
66
 
51
67
  ### Configuration Options
@@ -118,6 +134,43 @@ RAM Threshold: 80%
118
134
  ✓ Alert sent to server
119
135
  ```
120
136
 
137
+ ## Quick Start Guide
138
+
139
+ 1. **Install the package:**
140
+ ```bash
141
+ npm install -g @bitcall/pm2-pulse-agent@beta
142
+ ```
143
+
144
+ 2. **Run setup:**
145
+ ```bash
146
+ pm2-pulse-setup
147
+ ```
148
+
149
+ 3. **Start monitoring:**
150
+ ```bash
151
+ pm2 start pm2-pulse-agent --name monitoring-agent
152
+ ```
153
+
154
+ 4. **Check status:**
155
+ ```bash
156
+ pm2 logs monitoring-agent
157
+ ```
158
+
159
+ ## Troubleshooting
160
+
161
+ **Agent not connecting to server:**
162
+ - Verify `MONITOR_SERVER` address is correct in `.env`
163
+ - Check network connectivity: `telnet <server-host> <port>`
164
+ - Ensure firewall allows outbound connections
165
+
166
+ **PM2 processes not detected:**
167
+ - Verify PM2 is installed: `pm2 --version`
168
+ - Check PM2 has running processes: `pm2 list`
169
+
170
+ **Authentication errors:**
171
+ - Verify `AUTH_TOKEN` in `.env` matches server configuration
172
+ - Check token hasn't expired
173
+
121
174
  ## License
122
175
 
123
- MIT
176
+ MIT
package/agent.js CHANGED
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env node
2
+
1
3
  const os = require('os')
2
4
  const { exec } = require('child_process')
3
5
  const grpc = require('@grpc/grpc-js')
package/package.json CHANGED
@@ -1,6 +1,10 @@
1
1
  {
2
2
  "name": "@bitcall/pm2-pulse-agent",
3
- "version": "1.0.1-beta.1",
3
+ "version": "1.0.1-beta.2",
4
+ "bin": {
5
+ "pm2-pulse-setup": "./scripts/setup-agent.js",
6
+ "pm2-pulse-agent": "./agent.js"
7
+ },
4
8
  "scripts": {
5
9
  "agent": "node agent.js",
6
10
  "monitor": "node agent.js",
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env node
2
+
1
3
  const fs = require('fs')
2
4
  const path = require('path')
3
5
  const readline = require('readline')