tutorial

Monitoring Grit.io with Vigilmon

Grit is an open source AI-powered code migration tool that automates large-scale codebase transformations using GritQL and LLM reasoning. Here's how to monitor its migration API, dashboard, job queue, LLM connectivity, and GitHub integration with Vigilmon.

Grit is an open-source AI-powered code migration and modernization tool that automates large-scale codebase transformations: migrating frameworks, updating deprecated APIs, refactoring patterns, and enforcing code standards across entire codebases. It combines GritQL — an AST-based pattern matching query language — with LLM reasoning (GPT-4 or Claude) to apply accurate, batch code changes that would take a developer team days or weeks. Grit self-hosts as a Node.js/Rust hybrid with an optional web dashboard (port 3000) and a migration REST API (port 8080). When migration pipelines depend on Grit, every component in the chain matters. Vigilmon gives you visibility into the migration API, the dashboard, the LLM provider, the job queue, GitHub connectivity, and the file system.

What You'll Set Up

  • Grit migration API availability monitor (port 8080)
  • Grit web dashboard availability monitor (port 3000)
  • LLM provider connectivity check (OpenAI or Anthropic)
  • Migration job queue and stuck-job detection via heartbeat
  • GitHub / GitLab API connectivity monitor
  • File system write health check (disk space and output directory permissions)
  • Migration success rate tracking via heartbeat
  • SSL certificate expiry alerts

Prerequisites

  • Grit CLI installed: npm install -g @getgrit/launcher or from github.com/getgrit/gritql
  • Grit API server running: grit server --port 8080 (optional, for programmatic pipeline access)
  • Grit dashboard running: grit dashboard --port 3000 (optional)
  • OpenAI or Anthropic API key configured for AI-assisted migrations
  • A free Vigilmon account

Step 1: Monitor the Grit Migration API

The Grit REST API (port 8080) is the entry point for automated migration pipelines: CI/CD jobs submit transformation requests, retrieve results, and retrieve diff outputs programmatically. When this API is down, automated migration pipelines fail silently and manual re-runs are required.

  1. Log in to vigilmon.online and click Add Monitor.
  2. Set Type to HTTP / HTTPS.
  3. Enter the API URL:
    • Local: http://localhost:8080/
    • Reverse-proxy / remote: https://grit-api.yourdomain.com/
  4. Set Check interval to 1 minute.
  5. Set Expected HTTP status to 200.
  6. Click Save.

The Grit API server returns 200 on its root or /health path when running and ready to accept migration jobs. A connection refused or 5xx indicates the process has crashed or failed to start after a deployment or system restart.

Tip: Use http://localhost:8080/health if your Grit version exposes a dedicated health endpoint — it provides a richer signal including database connectivity and pattern engine status.


Step 2: Monitor the Grit Web Dashboard

The Grit dashboard (port 3000) gives developers visibility into migration patterns, job status, and diff review. When it's down, teams cannot review pending migrations or track which transformations have been applied.

  1. Click Add MonitorHTTP / HTTPS.
  2. Enter the dashboard URL:
    • Local: http://localhost:3000/
    • Remote: https://grit.yourdomain.com/
  3. Set Expected HTTP status to 200.
  4. Set Check interval to 2 minutes.
  5. Click Save.

Dashboard availability is less critical than the API for automated pipelines, so a 2-minute interval balances coverage with probe frequency.


Step 3: Monitor LLM Provider Connectivity

Grit uses LLM reasoning (GPT-4 or Claude) to improve the accuracy of complex migrations — for example, deciding how to handle ambiguous API mappings that simple pattern matching cannot resolve. Without LLM access, Grit falls back to pattern-only mode, which may miss edge cases in complex codebases.

OpenAI (GPT-4)

  1. Click Add MonitorHTTP / HTTPS.
  2. Enter: https://api.openai.com/.
  3. Set Expected HTTP status to 200.
  4. Set Check interval to 5 minutes.
  5. Click Save.

Anthropic (Claude)

  1. Click Add MonitorHTTP / HTTPS.
  2. Enter: https://api.anthropic.com/.
  3. Set Expected HTTP status to 200.
  4. Set Check interval to 5 minutes.
  5. Click Save.

These monitors confirm network reachability. For API key validity and quota, use the heartbeat probe in Step 6.


Step 4: Monitor the Migration Job Queue

Grit processes migration jobs sequentially or with limited parallelism. A stuck job — caused by a large file that exceeds the LLM context window, a network timeout, or a malformed GritQL pattern — blocks the queue and prevents subsequent jobs from running.

  1. Click Add MonitorCron Heartbeat.
  2. Set Expected ping interval to 30 minutes (adjust to your longest expected migration job duration plus buffer).
  3. Copy the heartbeat URL.

Create a probe that queries the Grit API for job state:

#!/bin/bash
GRIT_URL="${GRIT_URL:-http://localhost:8080}"
MAX_JOB_SECONDS=3600  # 1 hour max per job
NOW=$(date +%s)

# Query the running job queue
JOB=$(curl -s "$GRIT_URL/api/jobs/current" 2>/dev/null)
STATUS=$(echo "$JOB" | python3 -c "import sys,json; j=json.load(sys.stdin); print(j.get('status','idle'))" 2>/dev/null)

if [ "$STATUS" = "idle" ] || [ -z "$STATUS" ]; then
  curl -s "https://vigilmon.online/heartbeat/YOUR_QUEUE_HEARTBEAT_ID"
  exit 0
fi

START=$(echo "$JOB" | python3 -c "import sys,json; j=json.load(sys.stdin); print(j.get('startedAt',0))" 2>/dev/null)
ELAPSED=$(( NOW - START ))

if [ "$ELAPSED" -lt "$MAX_JOB_SECONDS" ]; then
  curl -s "https://vigilmon.online/heartbeat/YOUR_QUEUE_HEARTBEAT_ID"
else
  echo "Migration job stalled: running for ${ELAPSED}s (max: ${MAX_JOB_SECONDS}s)"
fi

Schedule every 15 minutes. A missed heartbeat triggers an alert so you can inspect and cancel the stuck job before the backlog grows.


Step 5: Monitor GitHub / GitLab API Connectivity

Grit reads source code from git repositories and submits pull requests with transformed code back to GitHub or GitLab. If the git hosting API is unreachable — due to an outage, rate limiting, or a revoked token — Grit cannot retrieve source files or push results.

GitHub

  1. Click Add MonitorHTTP / HTTPS.
  2. Enter: https://api.github.com/.
  3. Set Expected HTTP status to 200.
  4. Set Check interval to 5 minutes.
  5. Click Save.

GitLab (self-hosted)

  1. Click Add MonitorHTTP / HTTPS.
  2. Enter: https://gitlab.yourdomain.com/api/v4/version.
  3. Set Expected HTTP status to 200.
  4. Set Check interval to 2 minutes.
  5. Click Save.

For token validity, add a heartbeat probe:

#!/bin/bash
# Verify GitHub token has access to the target repo
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
  -H "Authorization: Bearer $GITHUB_TOKEN" \
  "https://api.github.com/repos/$GITHUB_ORG/$GITHUB_REPO")

if [ "$HTTP_CODE" = "200" ]; then
  curl -s "https://vigilmon.online/heartbeat/YOUR_GITHUB_TOKEN_HEARTBEAT_ID"
else
  echo "GitHub token probe failed: HTTP $HTTP_CODE"
fi

Schedule hourly.


Step 6: Heartbeat for LLM API Key Validity

Network reachability does not verify quota or key validity. Add an API key probe heartbeat for each LLM provider Grit uses.

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

Create check_llm_key.sh:

#!/bin/bash
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"ping"}],"max_tokens":1}' \
  https://api.openai.com/v1/chat/completions)

if [ "$HTTP_CODE" = "200" ]; then
  curl -s "https://vigilmon.online/heartbeat/YOUR_LLM_KEY_HEARTBEAT_ID"
else
  echo "OpenAI key probe failed: HTTP $HTTP_CODE"
fi

Schedule hourly.


Step 7: Monitor File System Write Health

Grit writes transformed source code to an output directory before creating a pull request. A full disk or permissions error in the output directory causes migration jobs to fail after spending LLM tokens on the transformation.

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

Create check_fs.sh:

#!/bin/bash
OUTPUT_DIR="${GRIT_OUTPUT_DIR:-/tmp/grit-output}"
mkdir -p "$OUTPUT_DIR"

# Check write access
TESTFILE="$OUTPUT_DIR/.vigilmon_check"
echo "ok" > "$TESTFILE" && rm "$TESTFILE" || exit 1

# Alert if less than 2 GB free (migrations can produce large diffs)
AVAIL_MB=$(df -m "$OUTPUT_DIR" | awk 'NR==2{print $4}')
[ "$AVAIL_MB" -gt 2048 ] || exit 1

curl -s "https://vigilmon.online/heartbeat/YOUR_FS_HEARTBEAT_ID"

Schedule every 15 minutes.


Step 8: Track Migration Success Rate

A healthy Grit deployment produces a high rate of successfully transformed files per job. A spike in failed or skipped files — caused by GritQL pattern errors, files that exceed the LLM context window, or parse failures on unusual syntax — indicates a problem with the migration configuration or the input codebase.

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

Create check_migration_success.sh:

#!/bin/bash
GRIT_URL="${GRIT_URL:-http://localhost:8080}"
MIN_SUCCESS_RATE=0.90  # Alert if success rate drops below 90%

# Get the last completed job's result stats
LAST_JOB=$(curl -s "$GRIT_URL/api/jobs?status=completed&limit=1" \
  | python3 -c "
import sys, json
jobs = json.load(sys.stdin)
if not jobs:
    print('no_jobs')
    exit(0)
j = jobs[0]
total = j.get('totalFiles', 0)
success = j.get('transformedFiles', 0)
rate = success / total if total > 0 else 1.0
print(f'{rate:.2f}')
" 2>/dev/null)

if python3 -c "exit(0 if float('$LAST_JOB') >= $MIN_SUCCESS_RATE else 1)" 2>/dev/null; then
  curl -s "https://vigilmon.online/heartbeat/YOUR_SUCCESS_RATE_HEARTBEAT_ID"
else
  echo "Migration success rate ${LAST_JOB} below threshold ${MIN_SUCCESS_RATE}"
fi

Schedule hourly after a typical migration window. A low success rate means GritQL patterns need review or the LLM is producing invalid output.


Step 9: SSL Certificate Monitoring

If the Grit API or dashboard is exposed through a reverse proxy with TLS, monitor certificate expiry.

  1. Open the HTTP monitor for the Grit dashboard (created in Step 2).
  2. Enable Monitor SSL certificate.
  3. Set Alert when certificate expires in less than 21 days.
  4. Click Save.

Repeat for the migration API if it uses a separate TLS endpoint.


Step 10: Configure Alert Channels

  1. Go to Alert Channels in Vigilmon and add Slack, email, Discord, or a webhook.
  2. On the Grit API monitor: set Consecutive failures before alert to 2.
  3. On the dashboard monitor: set Consecutive failures to 3 — dashboard blips are less critical than API failures.
  4. On the LLM provider monitors: set Consecutive failures to 1 — a provider outage affects every in-progress job.
  5. On heartbeat monitors: the default single-missed-interval alert is appropriate.
  6. Consider a separate ops alert channel for disk-space and file-system heartbeats.

Summary

| Monitor | Type | Target | Interval | |---------|------|--------|----------| | Grit migration API | HTTP | http://localhost:8080/ | 1 min | | Grit web dashboard | HTTP | http://localhost:3000/ | 2 min | | OpenAI / Anthropic reachability | HTTP | https://api.openai.com/ | 5 min | | LLM API key validity | Heartbeat | probe script → Vigilmon | 60 min | | Migration job queue / stuck job | Heartbeat | probe script → Vigilmon | 15 min | | GitHub API connectivity | HTTP | https://api.github.com/ | 5 min | | GitHub token validity | Heartbeat | probe script → Vigilmon | 60 min | | File system write access | Heartbeat | probe script → Vigilmon | 15 min | | Migration success rate | Heartbeat | probe script → Vigilmon | 60 min | | SSL certificate | SSL (on HTTP monitor) | reverse proxy domain | — |

Grit's value in engineering teams comes from automating large-scale code transformations that would otherwise require weeks of manual effort. When the migration API stalls, the LLM key expires, or a job queue fills with stuck work, those savings evaporate and blocked pipelines affect downstream releases. With Vigilmon watching every layer — from provider connectivity to file system health to per-job success rates — you catch problems in minutes rather than discovering them when a migration deadline is missed.

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 →