tutorial

Monitoring InvenTree with Vigilmon

InvenTree manages your parts catalog, stock levels, and build orders — but a crashed Celery worker means low-stock alerts stop firing and reports never generate. Here's how to monitor every InvenTree layer with Vigilmon.

InvenTree is an open-source inventory management system built for electronics hobbyists, small manufacturers, and repair shops. It tracks parts, assemblies, stock locations, purchase orders, sales orders, and build orders — all in a Python/Django application served by gunicorn behind nginx, with Celery workers processing async tasks and PostgreSQL storing everything. When InvenTree is healthy, low-stock alerts fire on time, barcode scans return instantly, and PDF reports generate without waiting. When any layer fails silently — a hung Celery worker, a full PostgreSQL disk, a Redis queue backup — you lose critical inventory visibility. Vigilmon watches every layer so you catch the failure before a stock-out or a missed build order does.

What You'll Set Up

  • HTTP uptime monitor for the InvenTree web interface (nginx, port 80/443)
  • Django application server health check (gunicorn)
  • PostgreSQL database connectivity monitor
  • Celery worker health via cron heartbeat
  • Redis broker connectivity check
  • Barcode API endpoint monitor
  • Part image storage accessibility check
  • SSL certificate expiry alerts

Prerequisites

  • InvenTree running on a Linux server (Docker Compose or native: nginx + gunicorn + Celery + Redis + PostgreSQL)
  • A free Vigilmon account

Step 1: Monitor the nginx Web Server

nginx serves InvenTree's static files and proxies requests to gunicorn. A crashed nginx process returns connection refused; a misconfigured proxy returns 502. Add an HTTP monitor:

  1. Log in to vigilmon.online and click Add Monitor.
  2. Set Type to HTTP / HTTPS.
  3. Enter your InvenTree URL: https://inventree.yourdomain.com.
  4. Set Check interval to 1 minute.
  5. Set Expected HTTP status to 200.
  6. Click Save.

Step 2: Check the Django Application Server Health

InvenTree exposes a built-in health check endpoint that validates the database connection and application state:

  1. Click Add MonitorHTTP / HTTPS.
  2. URL: https://inventree.yourdomain.com/api/
  3. Expected HTTP status: 200.
  4. Check interval: 2 minutes.
  5. Click Save.

For a more explicit health check, InvenTree also provides:

https://inventree.yourdomain.com/api/?format=json

This returns the API metadata JSON when gunicorn and Django are healthy. Add a body-content check:

  1. Open the API monitor.
  2. Enable Response body contains: "version".
  3. Click Save.

If gunicorn is crashed or the WSGI process failed to start, nginx returns 502 — caught by this check.


Step 3: Monitor PostgreSQL Database Connectivity

PostgreSQL stores the entire InvenTree data model: parts catalog, stock levels, locations, orders, and build orders. A database failure brings the entire application down.

Add a TCP monitor for PostgreSQL:

  1. Click Add MonitorTCP Port.
  2. Host: your PostgreSQL server IP or hostname.
  3. Port: 5432.
  4. Check interval: 2 minutes.
  5. Click Save.

Complement this with a response-time monitor on the InvenTree API — slow database queries show up as slow API responses:

  1. Open the API monitor from Step 2.
  2. Set Maximum response time to 3000 ms.
  3. Click Save.

Step 4: Celery Worker Health via Cron Heartbeat

InvenTree's Celery workers handle all asynchronous tasks: low-stock notifications, report generation, label printing, scheduled stock checks, and reminder emails. If Celery workers die, none of these fire — and there's no visible error in the web UI.

Use a Vigilmon cron heartbeat driven by a host-side health check script:

  1. In Vigilmon, click Add MonitorCron Heartbeat.
  2. Set Expected interval to 5 minutes (Celery workers should process tasks continuously).
  3. Copy the heartbeat URL.
  4. On your InvenTree host, add a script that checks Celery worker status via celery inspect ping:
#!/bin/bash
# /usr/local/bin/inventree-celery-health.sh
cd /opt/inventree
# Use the InvenTree virtual environment
CELERY_PING=$(./env/bin/celery -A InvenTree inspect ping --timeout 5 2>/dev/null)

if echo "$CELERY_PING" | grep -q "pong"; then
  curl -s https://vigilmon.online/heartbeat/YOUR_HEARTBEAT_ID
fi

For Docker Compose deployments:

#!/bin/bash
CELERY_PING=$(docker exec inventree-worker \
  celery -A InvenTree inspect ping --timeout 5 2>/dev/null)

if echo "$CELERY_PING" | grep -q "pong"; then
  curl -s https://vigilmon.online/heartbeat/YOUR_HEARTBEAT_ID
fi

Schedule it every 5 minutes:

*/5 * * * * /usr/local/bin/inventree-celery-health.sh

If the Celery worker is down for more than 5 minutes, Vigilmon alerts.


Step 5: Redis Broker Connectivity

Redis acts as the Celery task queue broker in InvenTree. If Redis goes down, Celery workers can't pick up new tasks — and the Django app may throw errors trying to enqueue them.

Add a TCP monitor for Redis:

  1. Click Add MonitorTCP Port.
  2. Host: your Redis server IP.
  3. Port: 6379.
  4. Check interval: 2 minutes.
  5. Click Save.

If you're running Redis with authentication or on a non-standard port, adjust accordingly. For Docker Compose, the Redis container hostname is typically redis or inventree-redis.


Step 6: Barcode Scanning API Endpoint

InvenTree's barcode API (/api/barcode/) is used for stock management workflows — scanning parts in and out. A slow or unresponsive barcode endpoint breaks workshop workflows. Add a response-time monitor:

  1. Click Add MonitorHTTP / HTTPS.
  2. URL: https://inventree.yourdomain.com/api/barcode/
  3. Expected HTTP status: 405GET requests to this endpoint return Method Not Allowed, confirming the endpoint is alive without requiring auth.
  4. Maximum response time: 1000 ms.
  5. Check interval: 3 minutes.
  6. Click Save.

Step 7: Part Image Storage Accessibility

InvenTree stores part images uploaded by users. If the media storage path is full or misconfigured, image uploads fail and existing images become unavailable. Add a monitor for the media serving path:

  1. Click Add MonitorHTTP / HTTPS.
  2. URL: https://inventree.yourdomain.com/media/ (or your configured MEDIA_URL).
  3. Expected HTTP status: 200 or 403 — either confirms nginx is serving the media path.
  4. Check interval: 10 minutes.
  5. Click Save.

Step 8: Label and Report Generation Service

InvenTree generates PDF labels and reports using WeasyPrint. This is a CPU- and memory-intensive operation that runs as a Celery task. A failed WeasyPrint installation or an out-of-memory kill can silently break report generation.

Monitor the report generation API endpoint:

  1. Click Add MonitorHTTP / HTTPS.
  2. URL: https://inventree.yourdomain.com/api/report/
  3. Expected HTTP status: 200.
  4. Check interval: 10 minutes.
  5. Click Save.

For deeper validation, trigger a test report via the Vigilmon cron heartbeat pattern: add a script that generates a small label and pings Vigilmon on success.


Step 9: Scheduled Task Execution (Cron Heartbeat)

InvenTree schedules automated tasks — stock level checks, expiry reminders, and recurring notifications — via Django's periodic task system (backed by Celery Beat). Add a heartbeat to confirm the scheduler is running:

  1. In Vigilmon, click Add MonitorCron Heartbeat.
  2. Set Expected interval to 60 minutes (Celery Beat typically ticks every minute, but meaningful tasks run hourly).
  3. Copy the heartbeat URL.
  4. Add a Django management command wrapper that pings Vigilmon after a scheduled task completes:
# In a custom management command or task wrapper
import requests

def run_scheduled_check():
    from part.models import Part
    # Trigger a low-stock check
    low_stock = Part.objects.filter(stock_item_count__lt=models.F('minimum_stock'))
    # Ping Vigilmon after successful execution
    requests.get('https://vigilmon.online/heartbeat/YOUR_SCHEDULER_HEARTBEAT', timeout=5)

Step 10: Plugin System Health

InvenTree's plugin system adds custom functionality — label printers, barcodes scanners, custom actions. A broken plugin can crash request handlers. Monitor the plugin API:

  1. Click Add MonitorHTTP / HTTPS.
  2. URL: https://inventree.yourdomain.com/api/plugins/
  3. Expected HTTP status: 200.
  4. Check interval: 10 minutes.
  5. Click Save.

Step 11: SSL Certificate Alerts

  1. Open the HTTPS monitor for your InvenTree domain.
  2. Enable Monitor SSL certificate.
  3. Set Alert when certificate expires in less than 21 days.
  4. Click Save.

Step 12: Configure Alert Channels

  1. Go to Alert Channels and add Slack, email, or a webhook to your team's chat tool.
  2. Set Consecutive failures before alert to 2 on HTTP monitors — Django/gunicorn can take a few seconds to restart.
  3. Add separate alert routing: critical alerts (web server down, database unreachable) go to PagerDuty or SMS; warning alerts (Celery worker down, slow responses) go to Slack.
  4. Add a Maintenance window during InvenTree upgrades and database migrations to suppress expected downtime alerts.

Summary

| Monitor | Target | What It Catches | |---|---|---| | nginx HTTP | :80/:443 | Web server crash, proxy failure | | Django API | /api/?format=json | gunicorn crash, app error | | PostgreSQL TCP | :5432 | Database unreachable | | Celery heartbeat | Heartbeat URL | Worker process dead, tasks not processing | | Redis TCP | :6379 | Message broker down | | Barcode API | /api/barcode/ | Barcode endpoint slow or down | | Media storage | /media/ | File storage inaccessible | | Report API | /api/report/ | PDF generation broken | | Scheduler heartbeat | Heartbeat URL | Celery Beat stopped, missed scheduled tasks | | Plugin API | /api/plugins/ | Plugin crash affecting requests | | SSL certificate | HTTPS domain | TLS cert expiry |

InvenTree keeps your parts catalog accurate and your build orders on track — but only when every layer is healthy. Celery workers silently dying means low-stock alerts stop, WeasyPrint issues mean reports never arrive, and a full PostgreSQL disk means no new stock can be recorded. With Vigilmon watching each component independently, you'll catch the failure at the layer where it happened and know exactly what to fix.

Monitor your app with Vigilmon

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

Start free →