tutorial

Monitoring CodeGPT with Vigilmon

CodeGPT provides a self-hosted AI coding assistant gateway (Node.js, port 5000) that routes IDE plugin requests to local or remote LLM backends. Here's how to monitor its API server, backend connectivity, auth service, usage database, routing health, and TLS certificate with Vigilmon.

CodeGPT is an AI coding assistant platform that offers a VS Code extension, JetBrains plugin, and a self-hosted API gateway. The gateway — a Node.js server on port 5000 — sits between every developer's IDE plugin and the LLM backends (Ollama, LM Studio, OpenAI, Anthropic, or any OpenAI-compatible endpoint). It adds authentication, usage tracking, model routing, and logging in one central place. When the CodeGPT gateway goes down, every IDE plugin for every developer stops working simultaneously. Vigilmon gives you continuous visibility into the gateway, each LLM backend, the authentication service, usage database, model routing, latency by backend, and the HTTPS certificate on the gateway endpoint.

What You'll Set Up

  • CodeGPT API gateway availability monitor (port 5000)
  • LLM backend connectivity heartbeats (Ollama, LM Studio, OpenAI/Anthropic)
  • Authentication service health heartbeat
  • Usage tracking database health heartbeat (PostgreSQL or SQLite)
  • Model routing health heartbeat
  • Completion latency by backend heartbeat (P50/P95 by model)
  • Team usage analytics health heartbeat
  • Concurrent connection capacity heartbeat
  • HTTPS/TLS certificate expiry monitor on the gateway endpoint

Prerequisites

  • CodeGPT self-hosted server running (Node.js, port 5000)
  • At least one LLM backend configured (Ollama, LM Studio, or a cloud provider)
  • PostgreSQL or SQLite configured for usage tracking (optional but recommended)
  • A free Vigilmon account

Step 1: Monitor the CodeGPT API Gateway (Port 5000)

The CodeGPT gateway is the single entry point for all IDE AI features across the entire team. A Node.js crash, a port conflict, or an OOM event on the gateway host takes down every developer's completions at once. This is a classic single-point-of-failure that must be monitored with the shortest possible check interval.

  1. Log in to vigilmon.online and click Add Monitor.
  2. Set Type to HTTP / HTTPS.
  3. Enter: http://localhost:5000/health (or your server's LAN/public IP if the gateway is on a dedicated host, e.g. http://192.168.1.x:5000/health).
  4. Set Check interval to 1 minute.
  5. Set Expected HTTP status to 200.
  6. Click Save.

If CodeGPT does not expose a /health endpoint, use the root endpoint / or the /v1/models path that IDE plugins query on connection.

Tip: If CodeGPT is exposed via HTTPS through a reverse proxy (nginx, Caddy, Traefik), monitor the HTTPS URL and enable SSL certificate monitoring in Step 9.


Step 2: Heartbeat Monitors for LLM Backend Connectivity

CodeGPT proxies every IDE completion request to a configured backend. If Ollama goes down but the CodeGPT gateway stays up, all requests that route to Ollama fail with gateway-level errors visible to every developer. Monitor each configured backend independently.

Ollama backend (port 11434)

  1. Click Add MonitorHTTP / HTTPS.
  2. Enter: http://localhost:11434/ (or the Ollama host LAN IP).
  3. Set Check interval to 1 minute.
  4. Set Expected HTTP status to 200.
  5. Click Save.

LM Studio backend (port 1234)

  1. Click Add MonitorHTTP / HTTPS.
  2. Enter: http://localhost:1234/v1/models.
  3. Set Check interval to 2 minutes.
  4. Set Expected HTTP status to 200.
  5. Click Save.

For cloud backends (OpenAI, Anthropic), use a heartbeat probe that makes a lightweight API call and verifies a valid response, since you cannot freely monitor third-party endpoints with HTTP polling.

Create check_codegpt_cloud_backends.sh:

#!/bin/bash
HEARTBEAT_URL="https://vigilmon.online/heartbeat/YOUR_BACKEND_HEARTBEAT_ID"

# Probe OpenAI connectivity (if configured as a CodeGPT backend)
OAI_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  "https://api.openai.com/v1/models")

if [ "$OAI_STATUS" = "200" ]; then
  curl -s "$HEARTBEAT_URL"
else
  echo "OpenAI backend unreachable — HTTP $OAI_STATUS"
fi

Schedule every 10 minutes:

*/10 * * * * /path/to/check_codegpt_cloud_backends.sh

Step 3: Heartbeat Monitor for Authentication Service Health

CodeGPT manages per-developer API keys and validates tokens on every request. If the auth service crashes or becomes unresponsive — due to a database connection failure, a corrupted token store, or a misconfigured JWT secret — every developer receives 401 Unauthorized errors and cannot use any AI features. Authentication failures are often the most confusing for developers to diagnose.

  1. Click Add MonitorCron Heartbeat.
  2. Set Expected ping interval to 5 minutes.
  3. Copy the heartbeat URL.

Create check_codegpt_auth.sh:

#!/bin/bash
HEARTBEAT_URL="https://vigilmon.online/heartbeat/YOUR_AUTH_HEARTBEAT_ID"
GATEWAY_URL="http://localhost:5000"
# Use a known-valid developer API token for this health check
TEST_TOKEN="${CODEGPT_HEALTH_TOKEN}"

if [ -z "$TEST_TOKEN" ]; then
  echo "CODEGPT_HEALTH_TOKEN not set — skipping auth check"
  exit 1
fi

HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
  -H "Authorization: Bearer $TEST_TOKEN" \
  "$GATEWAY_URL/v1/models")

if [ "$HTTP_STATUS" = "200" ]; then
  curl -s "$HEARTBEAT_URL"
elif [ "$HTTP_STATUS" = "401" ]; then
  echo "Auth service rejected valid token — auth service may be unhealthy"
else
  echo "Unexpected HTTP $HTTP_STATUS from gateway auth endpoint"
fi

Schedule every 5 minutes:

*/5 * * * * /path/to/check_codegpt_auth.sh

Security note: Store CODEGPT_HEALTH_TOKEN as an environment variable or in a secrets manager, not hardcoded in the script.


Step 4: Heartbeat Monitor for Usage Tracking Database Health

CodeGPT records per-developer token usage and request logs in PostgreSQL or SQLite. If the database becomes unwriteable — disk full, PostgreSQL down, WAL corruption, or lock contention — CodeGPT may reject requests that cannot be logged, or degrade into untracked mode where usage limits cannot be enforced. Monitor database connectivity and write health separately from the gateway itself.

  1. Click Add MonitorCron Heartbeat.
  2. Set Expected ping interval to 5 minutes.
  3. Copy the heartbeat URL.

Create check_codegpt_db.sh:

#!/bin/bash
HEARTBEAT_URL="https://vigilmon.online/heartbeat/YOUR_DB_HEARTBEAT_ID"

# PostgreSQL health check
if command -v psql &> /dev/null; then
  # Verify connectivity and write a test row
  DB_RESULT=$(psql "${CODEGPT_DATABASE_URL:-postgresql://localhost:5432/codegpt}" \
    -c "SELECT 1;" 2>&1)
  if echo "$DB_RESULT" | grep -q "1 row"; then
    curl -s "$HEARTBEAT_URL"
  else
    echo "PostgreSQL connectivity failed: $DB_RESULT"
  fi
else
  # SQLite fallback
  DB_PATH="${CODEGPT_SQLITE_PATH:-/opt/codegpt/data/usage.db}"
  if sqlite3 "$DB_PATH" "SELECT 1;" &> /dev/null; then
    curl -s "$HEARTBEAT_URL"
  else
    echo "SQLite database not accessible at $DB_PATH"
  fi
fi

Schedule every 5 minutes:

*/5 * * * * /path/to/check_codegpt_db.sh

Step 5: Heartbeat Monitor for Model Routing Health

CodeGPT can route requests to different LLM models based on rules — for example, routing short completions to a fast local model and long chat requests to a cloud model. A misconfigured routing rule causes every affected request to return a 500 error back to the IDE plugin, which the developer sees as a generic failure with no explanation of the routing misconfiguration.

  1. Click Add MonitorCron Heartbeat.
  2. Set Expected ping interval to 10 minutes.
  3. Copy the heartbeat URL.

Create check_codegpt_routing.sh:

#!/bin/bash
HEARTBEAT_URL="https://vigilmon.online/heartbeat/YOUR_ROUTING_HEARTBEAT_ID"
GATEWAY_URL="http://localhost:5000"
TEST_TOKEN="${CODEGPT_HEALTH_TOKEN}"

# Test a completion request through the gateway to verify routing works end-to-end
RESPONSE=$(curl -s -X POST "$GATEWAY_URL/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TEST_TOKEN" \
  -d '{"model":"default","messages":[{"role":"user","content":"hi"}],"max_tokens":4}')

# A working route returns a choices array; a broken route returns an error object
if echo "$RESPONSE" | grep -q '"choices"'; then
  curl -s "$HEARTBEAT_URL"
elif echo "$RESPONSE" | grep -q '"error"'; then
  ERROR=$(echo "$RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin).get('error',{}).get('message',''))" 2>/dev/null)
  echo "Routing error: $ERROR"
else
  echo "Unexpected response from gateway routing: $RESPONSE"
fi

Schedule every 10 minutes:

*/10 * * * * /path/to/check_codegpt_routing.sh

Step 6: Heartbeat Monitor for Completion Latency by Backend

Different backends have dramatically different latency profiles: a local Ollama 7B model might complete in 500 ms while an OpenAI GPT-4o call takes 2–3 seconds and an Anthropic Claude call takes 1–2 seconds. Tracking latency through the CodeGPT gateway (not directly to the backend) measures the full round-trip including gateway overhead, auth validation, and usage logging.

  1. Click Add MonitorCron Heartbeat.
  2. Set Expected ping interval to 5 minutes.
  3. Copy the heartbeat URL.

Create check_codegpt_latency.sh:

#!/bin/bash
HEARTBEAT_URL="https://vigilmon.online/heartbeat/YOUR_LATENCY_HEARTBEAT_ID"
GATEWAY_URL="http://localhost:5000"
TEST_TOKEN="${CODEGPT_HEALTH_TOKEN}"
LATENCY_THRESHOLD_MS=5000  # 5-second budget through the full gateway stack

START_MS=$(date +%s%3N)

RESPONSE=$(curl -s -X POST "$GATEWAY_URL/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TEST_TOKEN" \
  -d '{"model":"default","messages":[{"role":"user","content":"Reply with the word ok only."}],"max_tokens":4}')

END_MS=$(date +%s%3N)
ELAPSED_MS=$(( END_MS - START_MS ))

if echo "$RESPONSE" | grep -q '"choices"' && [ "$ELAPSED_MS" -lt "$LATENCY_THRESHOLD_MS" ]; then
  curl -s "$HEARTBEAT_URL"
else
  echo "Gateway latency ${ELAPSED_MS}ms (threshold: ${LATENCY_THRESHOLD_MS}ms) or routing failed"
fi

Schedule every 5 minutes:

*/5 * * * * /path/to/check_codegpt_latency.sh

Step 7: Heartbeat Monitor for Team Usage Analytics Health

CodeGPT's admin dashboard shows per-developer token usage, request counts, and model preferences. These analytics are powered by queries against the usage tracking database. If the analytics queries become slow — due to missing indexes, table bloat, or a long-running transaction — the admin dashboard becomes unresponsive. Monitor query performance as a leading indicator of database health.

  1. Click Add MonitorCron Heartbeat.
  2. Set Expected ping interval to 15 minutes.
  3. Copy the heartbeat URL.

Create check_codegpt_analytics.sh:

#!/bin/bash
HEARTBEAT_URL="https://vigilmon.online/heartbeat/YOUR_ANALYTICS_HEARTBEAT_ID"
QUERY_THRESHOLD_MS=3000  # Alert if analytics query takes more than 3 seconds

START_MS=$(date +%s%3N)

# Run a representative aggregation query against the usage table
DB_RESULT=$(psql "${CODEGPT_DATABASE_URL:-postgresql://localhost:5432/codegpt}" \
  -c "SELECT user_id, SUM(tokens_used) FROM usage_logs WHERE created_at > NOW() - INTERVAL '24 hours' GROUP BY user_id LIMIT 10;" 2>&1)

END_MS=$(date +%s%3N)
ELAPSED_MS=$(( END_MS - START_MS ))

if echo "$DB_RESULT" | grep -qv "ERROR" && [ "$ELAPSED_MS" -lt "$QUERY_THRESHOLD_MS" ]; then
  curl -s "$HEARTBEAT_URL"
else
  echo "Analytics query took ${ELAPSED_MS}ms or returned error: $DB_RESULT"
fi

Schedule every 15 minutes:

*/15 * * * * /path/to/check_codegpt_analytics.sh

Step 8: Heartbeat Monitor for Concurrent Connection Capacity

The entire development team hits the CodeGPT gateway simultaneously during peak hours — morning standup prep, post-lunch coding sprints, end-of-day review. The Node.js gateway has a connection pool limit; exceeding it causes requests to queue or return 503 errors. Monitor concurrent connection handling capacity with a parallel probe.

  1. Click Add MonitorCron Heartbeat.
  2. Set Expected ping interval to 5 minutes.
  3. Copy the heartbeat URL.

Create check_codegpt_concurrency.sh:

#!/bin/bash
HEARTBEAT_URL="https://vigilmon.online/heartbeat/YOUR_CONCURRENCY_HEARTBEAT_ID"
GATEWAY_URL="http://localhost:5000"
TEST_TOKEN="${CODEGPT_HEALTH_TOKEN}"
MAX_WALL_CLOCK_MS=10000  # 10-second ceiling for 5 concurrent requests
FAILED=0

START_MS=$(date +%s%3N)

# Fire 5 concurrent lightweight requests through the gateway
for i in 1 2 3 4 5; do
  (
    STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
      -H "Authorization: Bearer $TEST_TOKEN" \
      "$GATEWAY_URL/v1/models")
    [ "$STATUS" != "200" ] && echo "Request $i failed: HTTP $STATUS" >&2
  ) &
done
wait

END_MS=$(date +%s%3N)
TOTAL_MS=$(( END_MS - START_MS ))

if [ "$TOTAL_MS" -lt "$MAX_WALL_CLOCK_MS" ]; then
  curl -s "$HEARTBEAT_URL"
else
  echo "5 concurrent gateway requests took ${TOTAL_MS}ms — connection pool may be saturated"
fi

Schedule every 5 minutes:

*/5 * * * * /path/to/check_codegpt_concurrency.sh

Step 9: HTTPS/TLS Certificate Monitoring on the Gateway Endpoint

CodeGPT is typically deployed with HTTPS so that IDE plugins can connect securely. A Let's Encrypt certificate that fails to auto-renew — due to a DNS change, a firewall blocking port 80 for ACME validation, or a misconfigured Certbot hook — will expire and start causing TLS handshake failures in every IDE plugin across the team.

  1. Open the HTTP monitor for the CodeGPT gateway (created in Step 1) and update the URL to the HTTPS endpoint if you have one (e.g., https://codegpt.yourdomain.com/health).
  2. Enable Monitor SSL certificate.
  3. Set Alert when certificate expires in less than 21 days.
  4. Click Save.

A 21-day window gives time to investigate renewal failures before the certificate expires and disrupts the whole team.


Step 10: Configure Alert Channels

  1. Go to Alert Channels in Vigilmon and add Slack, email, Discord, or a webhook.
  2. On the API gateway monitor (port 5000): set Consecutive failures before alert to 1 — a gateway crash affects every developer immediately.
  3. On the auth service heartbeat: set Consecutive failures to 1 — auth failures are immediately visible as 401 errors to all users.
  4. On the database health heartbeat: set Consecutive failures to 2 to allow for brief PostgreSQL checkpoint stalls.
  5. On the latency and concurrency heartbeats: default single-missed-interval threshold is appropriate.

Example: Slack Alert

  1. Create a Slack incoming webhook in your workspace.
  2. In Vigilmon → Alert ChannelsAddSlack.
  3. Paste the webhook URL and assign it to all monitors in this tutorial.

Summary

| Monitor | Type | Target | Interval | |---------|------|--------|----------| | CodeGPT API gateway | HTTP | http://localhost:5000/health | 1 min | | Ollama LLM backend | HTTP | http://localhost:11434/ | 1 min | | LM Studio LLM backend | HTTP | http://localhost:1234/v1/models | 2 min | | Cloud backend connectivity | Heartbeat | probe script → Vigilmon | 10 min | | Authentication service health | Heartbeat | probe script → Vigilmon | 5 min | | Usage tracking database | Heartbeat | probe script → Vigilmon | 5 min | | Model routing health | Heartbeat | probe script → Vigilmon | 10 min | | Completion latency (gateway) | Heartbeat | probe script → Vigilmon | 5 min | | Team usage analytics | Heartbeat | probe script → Vigilmon | 15 min | | Concurrent connection capacity | Heartbeat | probe script → Vigilmon | 5 min | | HTTPS/TLS certificate | SSL (on HTTP monitor) | HTTPS gateway domain | — |

The CodeGPT gateway is the shared infrastructure that multiplies the power of AI coding assistance across your entire team — and the single point of failure that takes everyone offline at once. With Vigilmon watching the gateway, each LLM backend, authentication, the usage database, and certificate expiry, you know immediately when team-wide AI coding access is at risk.

Get started for free at vigilmon.online.

Monitor your app with Vigilmon

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

Start free →