EverydayTech Platform - Developer Reference
Complete Source Code Documentation - All Applications
Loading...
Searching...
No Matches
plugins Directory Reference

Directories

 
rmm-webhook

Detailed Description

MeshCentral Plugins for RMM-PSA

RMM-Webhook Plugin

Status: Created, not yet installed
Purpose: Send real-time webhooks to RMM-PSA backend for instant device updates

What It Does

Instead of polling MeshCentral every 5 minutes for device status, this plugin sends webhooks immediately when:

  • A device connects (agent comes online)
  • A device disconnects (agent goes offline)
  • Device information changes (hostname, IP, etc.)

Performance Impact:

  • Before: 5-minute lag (300s)
  • After: < 2-second lag
  • Improvement: 150x faster device status updates

Installation Steps

1. Enable Plugins in MeshCentral

Edit config.json and add:

{
"settings": {
"plugins": {
"enabled": true
}
}
}

2. Set Environment Variables

Add to your MeshCentral environment (DigitalOcean App Spec or .env):

MESHCENTRAL_WEBHOOK_URL=https://rmm-psa-backend-t9f7k.ondigitalocean.app/api/webhooks/meshcentral
MESHCENTRAL_WEBHOOK_SECRET=<generate_with_openssl_rand_hex_32>

3. Deploy Plugin Files

Copy the plugins/rmm-webhook/ directory to your MeshCentral data directory:

For DigitalOcean App Platform:

# SSH into container (if possible) or mount plugins directory as volume
# Copy files to: /meshcentral/meshcentral-data/plugins/rmm-webhook/

For standalone server:

cp -r plugins/rmm-webhook /path/to/meshcentral-data/plugins/

4. Restart MeshCentral

# DigitalOcean: Redeploy the app
# Standalone: systemctl restart meshcentral

5. Verify Plugin Loaded

Check logs for:

📡 RMM-PSA Webhook Notifier Plugin Loaded
Webhook URL: https://...
Secret configured: YES ✅

6. Test Webhook

  1. Connect an agent to MeshCentral
  2. Check backend logs for:
    📨 [Webhook] Received: device.connect for node//abc123...
    ✅ [Webhook] Linked agent 123 (HOSTNAME) to device node//abc123

7. Reduce Polling Interval (Optional)

Once webhooks are working, update workers/meshcentral-device-sync.js:

const SYNC_INTERVAL = 600000; // 10 minutes (reduced from 5 min)

This keeps polling as a fallback but reduces overhead by 50%.

Troubleshooting

Plugin not loaded:

  • Check config.json has "plugins": {"enabled": true}
  • Verify plugin files are in correct directory
  • Check MeshCentral logs for errors

Webhooks not received:

  • Verify webhook URL is correct
  • Check webhook secret matches in both systems
  • Test with: ‘curl -X POST https://backend/api/webhooks/meshcentral -H "X-MeshCentral-Secret: YOUR_SECRET" -d ’{"event":"test"}'`

401 Unauthorized errors:

  • Webhook secret mismatch
  • Check MESHCENTRAL_WEBHOOK_SECRET environment variable

Files

plugins/rmm-webhook/
├── plugin.json # Plugin metadata
├── rmm-webhook.js # Main webhook sending logic
└── README.md # This file

Backend Webhook Handler

Already exists at routes/webhooks.js

  • Endpoint: POST /api/webhooks/meshcentral
  • Features:
    • Auto-links devices to agents by hostname/MAC
    • Creates new agents if no match found
    • Updates connection status instantly
    • No authentication required for development (uses secret in prod)

See Also

  • MESHCENTRAL_WEBHOOK_SETUP.md - Full setup guide
  • MESHCENTRAL_INTEGRATION_AUDIT.md - Integration analysis
  • Backend webhooks.js - Webhook handler implementation