Monitors
Heartbeat monitors that represent each service you want to track.
A monitor represents one service and records the heartbeats your service sends. Every monitor has a stable id and a readable slug that you use when sending heartbeats. A monitor is created, edited, and deleted from the dashboard; the SDK is used to read monitors, send heartbeats, and start or stop the local heartbeat loop.
Monitor status
A monitor reports one of four statuses:
| Status | Meaning |
|---|---|
up | Heartbeats are arriving on time. |
down | The interval plus grace passed with no heartbeat. |
unknown | No heartbeat has been received yet. |
paused | Monitoring is paused and the monitor is not evaluated. |
Reading a monitor
Fetch a single monitor by its id:
const monitor = await vanta.uptime.getMonitor('mon_abc123')Every monitor includes a timeUp field, the number of milliseconds it has been reporting up continuously (0 when it is not up). Format it however you like for display:
const monitor = await vanta.uptime.getMonitor('mon_abc123')
// timeUp is in milliseconds
const hoursUp = monitor.timeUp / 3_600_000
console.log(monitor.name, monitor.status, hoursUp.toFixed(1), 'hours')Listing monitors
List every monitor in the project, for example to render a health board:
const monitors = await vanta.uptime.listMonitors()
for (const monitor of monitors) {
console.log(monitor.name, monitor.status)
}Stopping a monitor
Use vanta.uptime.start to send heartbeats for a monitor on a fixed interval. It returns a handle whose stop method stops the local heartbeat loop, for example when the process is shutting down or a service disables.
const monitor = vanta.uptime.start('checkout-worker', {
intervalMs: 60_000,
})
// Stop sending heartbeats when the service is taken down
monitor.stop()Stopping the local loop does not delete the monitor. The monitor remains in your dashboard and will report its status once heartbeats resume.
Managing monitors
Monitors are created, edited, and deleted in the dashboard. Open the Uptime page for your project to add a monitor, change its name, type, or expected interval, or remove it when it is no longer in service. The SDK exposes read and heartbeat methods only; all monitor lifecycle changes happen through the dashboard.