tutorial

How to Monitor Cito with Vigilmon

Add production-grade uptime monitoring and heartbeat checks to your Cito-powered web application with Vigilmon — catch outages and silent failures before your users notice.

Cito is an ultra-fast virtual DOM library built around minimizing diff overhead — it updates only the DOM nodes that change, with as little comparison work as possible. It's a top choice for data-intensive dashboards and real-time UIs where render performance is non-negotiable. But a fast virtual DOM can't protect you from a down server, a failed deployment, or a silent background job crash. Vigilmon gives you continuous HTTP monitoring, heartbeat checks, and instant alerts so you know the moment something breaks — before your users do.

What You'll Build

  • A /health endpoint for your Cito Node.js backend
  • Vigilmon HTTP monitors for your app and API
  • A heartbeat monitor for background jobs
  • Alert channels (email and Slack)
  • An uptime badge rendered in your Cito UI

Prerequisites

  • A Node.js project using Cito (with Express or a plain HTTP server)
  • A free Vigilmon account

Step 1: Add a Health Endpoint

Cito handles client-side virtual DOM updates, but your server needs an HTTP health endpoint that Vigilmon can poll at regular intervals:

// server.js
import express from "express";

const app = express();

app.get("/health", async (req, res) => {
  const checks = {};
  let degraded = false;

  // Database connectivity check
  try {
    // await db.query("SELECT 1");
    checks.database = "ok";
  } catch (err) {
    checks.database = `error: ${err.message}`;
    degraded = true;
  }

  // Cache check (e.g. Redis)
  try {
    // await redisClient.ping();
    checks.cache = "ok";
  } catch (err) {
    checks.cache = `error: ${err.message}`;
    degraded = true;
  }

  res.status(degraded ? 503 : 200).json({
    status: degraded ? "degraded" : "ok",
    timestamp: new Date().toISOString(),
    checks,
  });
});

// Serve your Cito app's static assets
app.use(express.static("public"));

app.listen(process.env.PORT ?? 3000, () => {
  console.log("Server running on port", process.env.PORT ?? 3000);
});

Test it locally:

curl http://localhost:3000/health | jq .
# {"status":"ok","timestamp":"2026-07-03T...","checks":{"database":"ok","cache":"ok"}}

Step 2: Configure Vigilmon HTTP Monitors

Log in to VigilmonMonitors → New Monitor:

Monitor 1: Cito App (Frontend)

| Field | Value | |---|---| | URL | https://yourapp.com/ | | Method | GET | | Expected status | 200 | | Expected body | A stable string from your HTML shell | | Check interval | 1 minute |

Monitor 2: Health API

| Field | Value | |---|---| | URL | https://yourapp.com/health | | Method | GET | | Expected status | 200 | | Expected body | "status":"ok" | | Check interval | 1 minute |

Two independent monitors keep failure classes separate: a CDN outage (frontend down, API healthy) is distinct from a database failure (API degraded, frontend still cached).


Step 3: Heartbeat for Background Tasks

Cito-powered dashboards often display data produced by background jobs — data ingestion pipelines, scheduled aggregations, or cache warm-up processes. A Vigilmon heartbeat monitor detects when these jobs stop running silently:

// scheduler.js
import cron from "node-cron";

const VIGILMON_HEARTBEAT_URL = process.env.VIGILMON_HEARTBEAT_URL ?? "";

async function pingHeartbeat() {
  if (!VIGILMON_HEARTBEAT_URL) return;
  try {
    await fetch(VIGILMON_HEARTBEAT_URL, { signal: AbortSignal.timeout(5000) });
  } catch {
    // Never let heartbeat errors crash the scheduler
  }
}

// Run every 5 minutes for a real-time data pipeline
cron.schedule("*/5 * * * *", async () => {
  try {
    await ingestLatestData();
    await pingHeartbeat(); // Only ping after successful execution
  } catch (err) {
    console.error("[scheduler] Data ingestion failed:", err);
    // No ping → Vigilmon alerts when the heartbeat window expires
  }
});

async function ingestLatestData() {
  // Pull fresh data for your Cito dashboard views
}

Set up the heartbeat in Vigilmon:

  1. Monitors → New Heartbeat Monitor
  2. Set Expected interval to 10 minutes (2× the cron interval)
  3. Add the ping URL to your environment:
VIGILMON_HEARTBEAT_URL=https://vigilmon.online/api/heartbeat/xxxxxxxx

Step 4: Embed an Uptime Badge in Your Cito UI

Cito uses a virtual node API to describe the DOM. You can include a Vigilmon status badge as a static vnode in your component tree:

// app.js (client-side with Cito)
import cito from "cito";

const BADGE_URL = "https://vigilmon.online/api/badge/your-monitor-id.svg";
const STATUS_URL = "https://vigilmon.online/status/your-monitor-slug";

function renderApp(data) {
  return cito.vdom.h("div.app", null,
    cito.vdom.h("main", null, renderContent(data)),
    cito.vdom.h("footer.footer", null,
      cito.vdom.h("a", {
        href: STATUS_URL,
        target: "_blank",
        rel: "noopener noreferrer",
        "aria-label": "Service uptime status",
      },
        cito.vdom.h("img", {
          src: BADGE_URL,
          alt: "Uptime",
          width: 120,
          height: 20,
        })
      )
    )
  );
}

function renderContent(data) {
  return cito.vdom.h("p", null, data.message);
}

let appNode;

function update(data) {
  const newNode = renderApp(data);
  if (!appNode) {
    appNode = cito.vdom.append(document.getElementById("app"), newNode);
  } else {
    cito.vdom.update(appNode, newNode);
  }
}

update({ message: "Your dashboard content here." });

Cito's minimal diff algorithm means the static badge node is never patched unless you explicitly change its attributes — ideal for a status indicator that updates independently via the Vigilmon CDN.


Step 5: Set Up Alert Channels

In Vigilmon's Alert Channels settings:

Email Alerts

  1. Alert Channels → Email → add your on-call address
  2. Attach the channel to both HTTP monitors and the heartbeat monitor

Slack Alerts

  1. Create a Slack Incoming Webhook for your #alerts channel
  2. Alert Channels → Webhook → paste the Slack webhook URL
  3. Use this payload template:
{
  "text": "🚨 *{{ monitor.name }}* is DOWN\n{{ monitor.url }}\nStatus: {{ event.status }}\n<https://vigilmon.online|Open Vigilmon>"
}

Step 6: Verify Everything Works

# 1. Confirm health endpoint returns 200
curl -s https://yourapp.com/health | jq .status

# 2. Simulate a failure — break your DB connection string and redeploy
# Expected: health endpoint returns 503; Vigilmon alerts within ~2 minutes

# 3. Remove the heartbeat URL and let the scheduler run one cycle
# Expected: heartbeat alert fires after the grace window expires

# 4. In Vigilmon → "Test Alert" to confirm Slack/email delivery

Summary

| Monitor | What It Catches | |---|---| | HTTP app check | CDN failures, broken static file serving | | HTTP health API | Database, cache, and external dependency failures | | Heartbeat | Scheduler crashes, silent data ingestion failures |


Next Steps

  • Create separate Vigilmon projects for staging and production
  • Use Vigilmon's response time graphs to detect data pipeline latency regressions alongside Cito's render timing
  • Configure escalating alerts: email for recoveries, Slack for active outages, PagerDuty for SLA-critical monitors

Ready to get started? Sign up for Vigilmon free — have your first monitor running in under 5 minutes.

Monitor your app with Vigilmon

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

Start free →