Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sheeplettuce/Monitor/llms.txt

Use this file to discover all available pages before exploring further.

The health endpoint provides a real-time snapshot of Monitor API’s operational status. It requires no authentication and is suitable for polling from external monitoring tools, load balancers, or dashboard widgets. A single request triggers live checks against PostgreSQL, the local filesystem, the evidence storage directory, and Node.js process memory — all results are returned in one JSON object.

GET /api/health

No authentication required.
curl http://localhost:3000/api/health

Response — 200 OK

This endpoint always returns HTTP 200. Inspect the individual boolean fields (backend, database) to determine actual service health — a 200 status code alone does not guarantee the database is reachable.
{
  "ip": "192.168.1.50",
  "backend": true,
  "database": true,
  "disco": {
    "libre_GB": "45",
    "usado_GB": "14",
    "total_GB": "60"
  },
  "evidencias": {
    "archivos": 312,
    "tamaño_MB": "1240.5"
  },
  "expedientes": 87,
  "ram": {
    "usada_MB": 128,
    "total_MB": 8192
  }
}
ip
string
Client IP address as seen by the server, derived from req.ip || req.socket.remoteAddress || "desconocida". Useful for verifying network routing behind a proxy or reverse proxy.
backend
boolean
Always true when this endpoint returns a response. Its presence in the payload confirms the Express process is alive and handling requests.
database
boolean
true if a SELECT 1 query against PostgreSQL succeeded; false if the query threw an error. A false value means the API cannot read or write claim data.
disco
object
Disk usage statistics for the volume where the API process is running. On Linux, sourced from df -BGB; values are integer strings (e.g. "45"). On Windows, sourced from wmic logicaldisk; values are formatted to one decimal place (e.g. "45.2").
evidencias
object
Statistics about the evidence file directory (EVIDENCIAS_DIR). This directory stores uploaded insurance claim files. Falls back to { archivos: 0, tamaño_MB: "0" } if the directory does not exist or cannot be read.
expedientes
integer
Total number of expediente (claim) records in the PostgreSQL database, obtained via prisma.expediente.count(). Returns 0 if the query fails.
ram
object
Memory usage for the Node.js process and the host machine.
Configure an uptime monitor such as UptimeRobot to poll GET /api/health every minute. Set up a keyword alert that fires when the response body contains "database":false — this catches PostgreSQL outages immediately, even when the backend process itself stays up and returns 200.

GET /discovery

No authentication required. Returns all non-loopback IPv4 addresses bound to the server’s network interfaces. Clients on the same LAN can call this endpoint to locate the Monitor API server without manual IP configuration.
curl http://localhost:3000/discovery

Response — 200 OK

{
  "nombre": "Monitor API",
  "ips": ["192.168.1.10", "10.0.0.5"]
}
nombre
string
Always "Monitor API". Acts as a service identifier so clients can confirm they have reached the correct host.
ips
string[]
Array of IPv4 address strings. Loopback addresses (127.x.x.x) are excluded. A machine with both a wired and a wireless adapter will surface both addresses here.
Monitor API also runs automatic health checks on startup and then on a repeating setInterval every 5 minutes. These checks (backend port probe, PostgreSQL SELECT 1, disk stats, evidencias directory scan, and a frontend availability probe on port 8081) are logged to both stdout and logs/app.log in the project root. Check that log file for historical status data or to diagnose intermittent failures outside of a polling window.

Build docs developers (and LLMs) love