tutorial

Monitoring iDURAR ERP/CRM with Vigilmon

iDURAR is a modern open source MERN-stack ERP/CRM for SMEs. Here's how to monitor its Node.js API server, MongoDB database, React frontend, invoice generation, email delivery, and Node.js process health with Vigilmon.

iDURAR is a modern open source ERP and CRM platform built on the MERN stack — MongoDB, Express.js, React, and Node.js. It targets SMEs that need a clean, API-first alternative to legacy Java ERPs, covering invoicing, payment tracking, client management, inventory, and financial reporting. When you self-host iDURAR, you're responsible for keeping the Node.js backend running, MongoDB healthy, the React frontend available, and the invoice/email pipeline functional. A failure in any layer — a crashed Node.js process, a MongoDB disk full, a broken SMTP configuration — silently breaks your ERP for your entire team. Vigilmon gives you end-to-end monitoring across every component of the iDURAR stack.

What You'll Set Up

  • HTTP uptime monitor for the iDURAR Express.js REST API
  • MongoDB TCP connectivity and disk usage monitor
  • React frontend availability monitor
  • Invoice generation and PDF export health check
  • Payment recording API success monitor
  • API response time (p95) alert
  • Email delivery (Nodemailer/SMTP) health check
  • Node.js process memory and event loop lag monitor
  • iDURAR version currency check

Prerequisites

  • iDURAR instance running (Node.js backend + MongoDB)
  • Backend API accessible on its configured port (default: 8888 or 5000)
  • React frontend accessible via HTTP/HTTPS
  • A free Vigilmon account

Step 1: Monitor the iDURAR Express.js API

The Node.js/Express.js backend is the heart of iDURAR — it processes invoices, manages clients, records payments, and drives all business logic. An uptime monitor on the API health endpoint catches Node.js crashes instantly.

  1. Log in to vigilmon.online and click Add Monitor.
  2. Set Type to HTTP / HTTPS.
  3. Enter the API URL: https://erp.yourdomain.com/api/health (or http://your-server-ip:8888/api/health).
  4. Set Check interval to 1 minute.
  5. Set Expected HTTP status to 200.
  6. Under Keyword check, enter success or ok to verify the API is responding with valid data, not just that nginx is up.
  7. Click Save.

If iDURAR doesn't have a dedicated /health endpoint in your version, add one to the Express app:

// routes/health.js
const router.get('/health', async (req, res) => {
  try {
    // Check MongoDB connection
    const mongoose = require('mongoose');
    if (mongoose.connection.readyState !== 1) {
      return res.status(503).json({ success: false, message: 'MongoDB disconnected' });
    }
    res.json({ success: true, uptime: process.uptime() });
  } catch (err) {
    res.status(503).json({ success: false, error: err.message });
  }
});

module.exports = router;

Register it in your main Express app before authentication middleware so Vigilmon doesn't need credentials.


Step 2: Monitor MongoDB Connectivity

MongoDB stores everything in iDURAR — invoices, payments, clients, products, inventory, user accounts, and configuration. A MongoDB failure is a complete ERP outage.

Add a TCP monitor to verify MongoDB is accepting connections:

  1. Click Add MonitorTCP Port.
  2. Host: your-server-ip.
  3. Port: 27017 (MongoDB default).
  4. Check interval: 1 minute.
  5. Click Save.

For a richer check that verifies MongoDB is healthy (not just accepting TCP connections), add this query to your health endpoint above:

// Extended health check with MongoDB query
const Invoice = require('../models/coreModels/Invoice');
const count = await Invoice.countDocuments({}).maxTimeMS(2000);
res.json({ success: true, invoiceCount: count, uptime: process.uptime() });

This ensures MongoDB is not just reachable but is executing queries within a 2-second timeout.


Step 3: Monitor the React Frontend

The iDURAR React SPA is what your team uses for day-to-day ERP work. A frontend server crash or build failure leaves users unable to access invoices, client records, or financial reports.

  1. Click Add MonitorHTTP / HTTPS.
  2. URL: https://erp.yourdomain.com (or http://your-server-ip:3000).
  3. Check interval: 1 minute
  4. Expected HTTP status: 200
  5. Under Keyword check, enter iDURAR to verify the app shell loads and isn't showing a blank page or nginx default.
  6. Enable Monitor SSL certificate and set the expiry alert to 21 days.
  7. Click Save.

Step 4: Monitor Invoice Generation Health

Invoice generation is the core ERP function in iDURAR. If the invoice creation API or PDF generation pipeline is broken, your business can't issue invoices — which is a critical revenue-impacting failure.

Add a synthetic invoice health check via heartbeat:

  1. In Vigilmon, click Add MonitorCron / Heartbeat.
  2. Name: iDURAR Invoice API Health
  3. Set Expected interval to 5 minutes.
  4. Copy the heartbeat URL.

Script to call the invoice creation API with a test payload:

#!/bin/bash
# /opt/idurar/scripts/invoice-health-check.sh

# Authenticate and get a token
TOKEN=$(curl -sf -X POST "https://erp.yourdomain.com/api/login" \
  -H "Content-Type: application/json" \
  -d '{"email":"monitor@yourdomain.com","password":"'"$MONITOR_PASSWORD"'"}' \
  | jq -r '.token')

if [ -z "$TOKEN" ] || [ "$TOKEN" = "null" ]; then
  echo "Auth failed"
  exit 1
fi

# Check invoice list endpoint (non-destructive read)
STATUS=$(curl -sf -o /dev/null -w "%{http_code}" \
  -H "Authorization: Bearer $TOKEN" \
  "https://erp.yourdomain.com/api/invoice/list?page=1&items=1")

if [ "$STATUS" = "200" ]; then
  curl -fsS "https://vigilmon.online/api/push/YOUR_INVOICE_TOKEN"
fi
*/5 * * * * /opt/idurar/scripts/invoice-health-check.sh

Step 5: Monitor API Response Time

Slow API responses in an ERP mean invoices that take 10 seconds to load, payment forms that hang, and frustrated users. Vigilmon's HTTP monitor captures response time on every check.

On your existing API monitor:

  1. Click Edit on the iDURAR API monitor.
  2. Enable Response time alert.
  3. Set the threshold to 1000ms (1 second).
  4. Click Save.

Vigilmon will alert you when the p95 API response time exceeds 1 second — an early warning of MongoDB query slowdowns or Node.js event loop saturation.


Step 6: Monitor Node.js Process Health

Node.js memory leaks and event loop lag are common in long-running Express.js applications. Monitor both with a heartbeat script that only pings Vigilmon when the process is healthy:

  1. Create a Cron / Heartbeat monitor named iDURAR Node.js Process Health with a 2-minute interval.
  2. Copy the heartbeat URL.

Script:

#!/bin/bash
# /opt/idurar/scripts/nodejs-health-check.sh

IDURAR_PID=$(pgrep -f "node.*idurar\|node.*server\.js" | head -1)

if [ -z "$IDURAR_PID" ]; then
  echo "iDURAR Node.js process not running"
  exit 1
fi

# Check RSS memory (alert if >512MB — adjust for your server)
RSS_KB=$(cat /proc/$IDURAR_PID/status | grep VmRSS | awk '{print $2}')
RSS_MB=$((RSS_KB / 1024))

if [ "$RSS_MB" -gt 512 ]; then
  echo "Memory too high: ${RSS_MB}MB"
  exit 1
fi

curl -fsS "https://vigilmon.online/api/push/YOUR_NODEJS_TOKEN"
* * * * * /opt/idurar/scripts/nodejs-health-check.sh

For event loop lag monitoring, add this to the iDURAR app itself and expose it via the /health endpoint:

// Measure event loop lag
let lastCheck = Date.now();
setInterval(() => {
  const lag = Date.now() - lastCheck - 100; // expected 100ms interval
  lastCheck = Date.now();
  if (lag > 100) {
    console.warn(`Event loop lag: ${lag}ms`);
  }
}, 100);

Step 7: Monitor MongoDB Disk Usage

MongoDB's data directory fills up as invoices, payments, and documents accumulate. A full disk causes MongoDB to crash and write errors that corrupt open documents.

#!/bin/bash
# /opt/idurar/scripts/mongo-disk-check.sh

# Get MongoDB data directory disk usage
MONGO_DATA_DIR="/var/lib/mongodb"  # adjust for your installation
DISK_USAGE=$(df "$MONGO_DATA_DIR" | awk 'NR==2 {print $5}' | tr -d '%')

if [ "$DISK_USAGE" -lt 80 ]; then
  curl -fsS "https://vigilmon.online/api/push/YOUR_DISK_TOKEN"
else
  echo "MongoDB disk at ${DISK_USAGE}% — alert threshold exceeded"
fi
*/15 * * * * /opt/idurar/scripts/mongo-disk-check.sh

Step 8: Monitor Email Delivery

iDURAR sends invoices to clients via email (Nodemailer + SMTP). If SMTP credentials expire or the mail server is down, your clients stop receiving invoices silently.

Add a synthetic SMTP health check:

#!/bin/bash
# /opt/idurar/scripts/smtp-health-check.sh

# Test SMTP connectivity
RESULT=$(curl -fsS --max-time 10 \
  "smtp://your-smtp-host:587" \
  --ssl-reqd 2>&1)

# If curl SMTP check succeeds (exit 0)
if [ $? -eq 0 ]; then
  curl -fsS "https://vigilmon.online/api/push/YOUR_SMTP_TOKEN"
fi

Alternatively, use a dedicated SMTP test endpoint in your iDURAR app:

// GET /api/health/smtp — returns 200 if SMTP is reachable
router.get('/health/smtp', async (req, res) => {
  const transporter = nodemailer.createTransport(config.email);
  try {
    await transporter.verify();
    res.json({ success: true });
  } catch (err) {
    res.status(503).json({ success: false, error: err.message });
  }
});

Step 9: Configure Alerting

With monitors set up, configure alert escalation in Vigilmon:

  1. Go to Alert ChannelsAdd Channel.
  2. Add your primary channel (email, Slack, PagerDuty, or webhook).
  3. Set up a secondary channel for finance team alerts (email or Slack #finance-ops).

Recommended alert thresholds:

| Monitor | Threshold | Channel | |---|---|---| | API HTTP | Any failure | Primary on-call | | React frontend | Any failure | Primary on-call | | MongoDB TCP | Any failure | Primary on-call | | Node.js process | Heartbeat miss | DevOps | | API response time | >1000ms | DevOps | | MongoDB disk >80% | Heartbeat miss | DevOps | | Invoice API | Heartbeat miss | Finance Ops | | SMTP health | Heartbeat miss | Finance Ops |

Use 2-failure confirmation for the MongoDB disk and Node.js memory monitors to suppress transient spikes. Use immediate for the API and frontend HTTP monitors — these are live outages.


Conclusion

iDURAR's MERN stack is elegant, but each component — Node.js, MongoDB, the React SPA, the PDF pipeline, and the SMTP integration — is an independent failure point. The monitoring setup above catches Node.js crashes, MongoDB connectivity failures, memory leaks, disk exhaustion, invoice pipeline failures, and email delivery breakdowns before your team or clients notice.

With Vigilmon running across all nine monitors, your iDURAR ERP/CRM stack stays visible and auditable — so you spend time on business operations instead of incident response.

Monitor your app with Vigilmon

Free plan — 5 monitors, no credit card required. Up and running in 60 seconds.

Start free →