diff --git a/AGENT_DEPLOYMENT_GUIDE.md b/AGENT_DEPLOYMENT_GUIDE.md new file mode 100644 index 0000000..5aa9f66 --- /dev/null +++ b/AGENT_DEPLOYMENT_GUIDE.md @@ -0,0 +1,143 @@ +# ๐Ÿ›ก๏ธ SeekRight RMM Agent โ€” Client Deployment Guide +### *AnyDesk Remote Access Workflow* + +--- + +## ๐Ÿ“‹ Prerequisites (before you connect) + +| What you need | Where to get it | +|---|---| +| AnyDesk installed on **your** machine | anydesk.com | +| AnyDesk installed on the **client** machine | Ask client to install from anydesk.com | +| Client's AnyDesk ID / address | Ask client to share it with you | +| `deploy_agent.sh` file | In your workspace: `RMM-BE/rmm-backend/deploy_agent.sh` | +| Client ID to register with | Agreed upon name (e.g. `NH-8`, `BS-13`) | + +--- + +## ๐Ÿ”— Step 1 โ€” Connect to the Client via AnyDesk + +1. Open **AnyDesk** on your machine. +2. Enter the **client's AnyDesk ID** in the address bar. +3. Click **Connect** โ†’ client approves the session. +4. Once inside: right-click the desktop or press `Ctrl+Alt+T` to open a **Terminal**. + +**Tip:** Ask the client to set up **unattended access** in AnyDesk settings so you don't need them to approve each connection. + +--- + +## ๐Ÿ“ค Step 2 โ€” Transfer the Deploy Script + +### Option A โ€” AnyDesk File Transfer (easiest, recommended) +1. In AnyDesk, click the **File Manager** icon in the top toolbar. +2. Drag `deploy_agent.sh` from your machine to the **client's Desktop** or `~/Downloads`. + +### Option B โ€” Download directly on the client machine +```bash +curl -O http://rmm-backend.seekright.com/deploy_agent.sh +# OR if curl is not available: +wget http://rmm-backend.seekright.com/deploy_agent.sh +``` + +--- + +## โš™๏ธ Step 3 โ€” Run the Deployment Script + +In the client's terminal, navigate to where you placed the script and run it: + +```bash +# Make the script executable (only needed the first time) +chmod +x deploy_agent.sh + +# Run with the agreed Client ID (replace NH-8 with the actual ID) +sudo ./deploy_agent.sh NH-8 +``` + +> **The script MUST be run with `sudo`** โ€” it installs a systemd service and writes to `/opt/seekright-agent/`. + +### What you'll see during deployment: +``` +๐Ÿš€ Preparing SeekRight RMM Agent installation... +๐Ÿ“ Target Client ID: NH-8 +๐ŸŒ Central Server URL: http://rmm-backend.seekright.com +๐Ÿ”„ Updating system package indexes... +๐Ÿ“ Creating installation workspace... +๐Ÿ“ Generating client agent file... +โš™๏ธ Configuring background systemd daemon service... +๐Ÿ”„ Reloading system daemons and starting agent service... + +โœจ ============================================= โœจ +โœ… SeekRight RMM Agent successfully deployed! +๐Ÿ“ Location: /opt/seekright-agent/client_agent_prototype.py +๐Ÿ“‹ System Service: seekright-agent.service +โœจ ============================================= โœจ +``` + +--- + +## โœ… Step 4 โ€” Verify the Agent is Running + +After deployment, the script shows live logs automatically. Confirm you see: + +``` +seekright-agent[XXXXX]: Starting Agent for NH-8... +seekright-agent[XXXXX]: [*] Telemetry pushed successfully. +seekright-agent[XXXXX]: [*] Checking for commands... +seekright-agent[XXXXX]: -> No pending commands. +``` + +- โœ… **`Telemetry pushed successfully`** โ†’ agent is live and sending data. +- โŒ **`SyntaxError` or `exit-code`** โ†’ redeploy with the latest version of the script. + +Press `Ctrl+C` to exit the log view. The agent continues running in the background as a system service. + +--- + +## ๐Ÿ” Step 5 โ€” Confirm in the RMM Dashboard + +1. Open the **SeekRight Pulse RMM** dashboard in your browser. +2. Within ~30 seconds the new client node appears with a ๐ŸŸข **Online** status. +3. Verify that disk drives, CPU, and memory telemetry are loading correctly. + +--- + +## ๐Ÿ› ๏ธ Useful Troubleshooting Commands (run on the client machine) + +| Task | Command | +|---|---| +| Check agent status | `sudo systemctl status seekright-agent` | +| View live logs | `sudo journalctl -u seekright-agent -f` | +| Restart the agent | `sudo systemctl restart seekright-agent` | +| Stop the agent | `sudo systemctl stop seekright-agent` | +| View installed agent file | `cat /opt/seekright-agent/client_agent_prototype.py` | +| Re-run full deployment | `sudo ./deploy_agent.sh ` | + +--- + +## ๐Ÿ†” Client ID Naming Convention + +Use a consistent, short identifier. No spaces. + +| โœ… Good | โŒ Avoid | +|---|---| +| `NH-8` | `New HP Workstation 8` | +| `BS-13` | `bs 13 machine` | +| `SHOWROOM-PC-01` | `showroom pc` | + +> If no Client ID is provided, the script defaults to the machine's **hostname** (e.g. `nh8gglamsrv01`). + +--- + +## ๐Ÿ”„ Re-deploying / Updating the Agent + +Whenever you push a bug fix or new version of `deploy_agent.sh`, simply re-run on the client: + +```bash +sudo ./deploy_agent.sh NH-8 +``` + +The script is **idempotent** โ€” safely overwrites the previous installation and restarts the service. + +--- + +*SeekRight Pulse RMM ยท Internal Documentation ยท v1.0* diff --git a/deploy_agent.sh b/deploy_agent.sh index 5b6df5f..8731baf 100644 --- a/deploy_agent.sh +++ b/deploy_agent.sh @@ -184,13 +184,28 @@ def collect_and_send_telemetry(): linux_labels = get_linux_labels() if os.name != "nt" else {} disks = [] + seen_devices = set() # Deduplicate: skip bind-mounts that reuse the same device for part in psutil.disk_partitions(all=False): + # Skip loop devices and unknown/empty fstypes if 'loop' in part.device or 'loop' in part.fstype or part.fstype == '': continue + # Skip snap & squashfs mounts if part.mountpoint.startswith('/snap') or part.fstype == 'squashfs': continue + # Skip boot, WSL internal, and other virtual/system paths if part.mountpoint.startswith('/boot') or part.mountpoint.startswith('/mnt/wsl'): continue + if part.mountpoint.startswith('/var/snap') or part.mountpoint.startswith('/run'): + continue + # Skip virtual/overlay filesystems + if part.fstype in ('tmpfs', 'devtmpfs', 'overlay', 'aufs', 'fusectl', + 'proc', 'sysfs', 'cgroup', 'cgroup2', 'pstore', + 'securityfs', 'debugfs', 'tracefs', 'bpf'): + continue + # Deduplicate: each physical device reported only once (eliminates bind-mounts) + if part.device in seen_devices: + continue + seen_devices.add(part.device) try: usage = psutil.disk_usage(part.mountpoint) @@ -202,7 +217,8 @@ def collect_and_send_telemetry(): if part.mountpoint == "C:\\": label = "OS" else: - label = f"Local Disk ({part.mountpoint.strip('\\')})" + _mp = part.mountpoint.strip('\\') + label = f"Local Disk ({_mp})" else: label = linux_labels.get(part.device, "") if not label: