Current Status
✅ Fixed Issues
- SQL Type Mismatch Error - FIXED
- Problem: operator does not exist: character varying = integer
- Cause: Trying to compare agent_id (integer) with UUID string
- Solution: Updated /routes/agent.js to detect if parameter is numeric or UUID and use appropriate column
const isNumeric = /^\d+$/.test(agentId);
const query = isNumeric
? 'SELECT agent_id, hostname, meshcentral_nodeid FROM agents WHERE agent_id = $1'
: 'SELECT agent_id, hostname, meshcentral_nodeid FROM agents WHERE agent_uuid = $1';
- Auto-Link Endpoint - ADDED
- New endpoint: POST /api/meshcentral/auto-link
- Automatically links agents by hostname
- Returns list of available nodes if no match found
- Improved Sync - ENHANCED
- Sync now tries to match existing agents by hostname before creating new ones
- Prevents duplicate agent entries
- Auto-links during sync process
📊 Database State
Agent 115 (the test VM):
- agent_id: 115
- agent_uuid: 2c3e2d7a-c521-4844-b44b-a30b4c2ec4d8
- hostname: testing
- meshcentral_nodeid: sqtYR0SN2DGaJsuSQZsNWxu0H643deE8$Jq9Ymm@UBywhJwXh2sj8ArX4KPoyZK4
- Status: ✅ Linked and working
Non-existent Agent:
- agent_uuid: 83c065a3-4363-4dba-9fb8-cd1929897adc ❌ Does NOT exist in database
- This UUID was in the error - need to use the correct UUID: 2c3e2d7a-c521-4844-b44b-a30b4c2ec4d8
🔗 Working URLs
Direct MeshCentral Access (works):
https://rmm-psa-meshcentral-aq48h.ondigitalocean.app/login?viewmode=11&gotonode=sqtYR0SN2DGaJsuSQZsNWxu0H643deE8$Jq9Ymm@UBywhJwXh2sj8ArX4KPoyZK4
Dashboard Access (should work after fixes deploy):
https://everydaytech.au/agents/2c3e2d7a-c521-4844-b44b-a30b4c2ec4d8
🚀 Testing After Deployment
Wait ~2 minutes for backend and dashboard to deploy, then test:
- Test the correct agent UUID:
# Check if agent exists
curl https://rmm-psa-backend-t9f7k.ondigitalocean.app/api/agent/2c3e2d7a-c521-4844-b44b-a30b4c2ec4d8/meshcentral-url
- Access dashboard with correct UUID:
https://everydaytech.au/agents/2c3e2d7a-c521-4844-b44b-a30b4c2ec4d8
- Test auto-link endpoint (for future agents):
curl -X POST 'https://rmm-psa-backend-t9f7k.ondigitalocean.app/api/meshcentral/auto-link' \
-H 'Content-Type: application/json' \
-d '{"agentUuid":"2c3e2d7a-c521-4844-b44b-a30b4c2ec4d8","hostname":"testing"}'
📋 Auto-Installation Plan
Created comprehensive guide: /rmm-psa-backend/MESHAGENT_AUTO_INSTALL.md
Key Features:
- Agent v2 will auto-install MeshAgent on first run
- Backend will auto-link by hostname every 5 minutes
- Hardware ID matching as primary method
- Hostname + IP as fallback
Implementation Roadmap:
- Add MeshAgentInstaller class to agent v2
- Call installer after agent registration
- Add periodic sync job (every 5 minutes)
- Improve sync to match by hostname ✅
- Test on fresh Windows VM
🔧 Quick Fix for Current Issue
The UUID in the error (83c065a3-4363-4dba-9fb8-cd1929897adc) doesn't exist. You need to:
- Use the correct agent UUID: 2c3e2d7a-c521-4844-b44b-a30b4c2ec4d8
- Or check which agents exist:
SELECT agent_id, agent_uuid, hostname, meshcentral_nodeid
FROM agents
ORDER BY agent_id DESC LIMIT 10;
📝 Next Steps
- Wait for deployment (~2 minutes)
- Test with correct UUID: 2c3e2d7a-c521-4844-b44b-a30b4c2ec4d8
- Verify dashboard loads Remote Desktop tab
- Implement auto-installer in agent v2 (see MESHAGENT_AUTO_INSTALL.md)
API Endpoints
GET /api/agent/:agentId/meshcentral-url
- Accepts: agent_id (integer) OR agent_uuid (string)
- Returns: MeshCentral remote desktop URL
- No authentication required
POST /api/meshcentral/auto-link
- Body: { "agentUuid": "uuid", "hostname": "hostname" }
- Returns: Link status and details
- Auto-links agent to MeshCentral node by hostname
- No authentication required (called by agent)
POST /api/meshcentral/sync
- Syncs all MeshCentral devices to database
- Auto-links by hostname
- Requires authentication (technician)
Files Modified
- /rmm-psa-backend/routes/agent.js - Fixed UUID/integer comparison
- /rmm-psa-backend/routes/meshcentral.js - Added auto-link, improved sync
- /rmm-psa-backend/MESHAGENT_AUTO_INSTALL.md - Implementation guide
- /rmm-psa-dashboard/src/pages/tabs/TabRds.jsx - Fixed React hooks (already deployed)
All changes committed and pushed. Backend will auto-deploy in ~2 minutes.