Monitors
A Monitor is a Better Stack Uptime check.
Better Stack requests a URL, pings a host or opens a port on a schedule, from
the regions you choose, and opens an incident when the check fails. The
incident alerts the people its escalation policy names. Monitors come in HTTP
kinds (status, keyword, expected_status_code, …), ping, tcp and
udp, mail ports, dns and playwright scenarios.
- every
- 60 s
- from
- us, eu
- apichecks →api.example.com
- Public endpointspages via →On-call
Check an HTTP endpoint
Section titled “Check an HTTP endpoint”The smallest monitor is a URL and a kind. status treats any 2xx answer as up:
const api = yield* BetterStack.Incidents.Monitor("api", { url: "https://api.example.com/health", monitorType: "status", checkFrequency: 60,});checkFrequency is in seconds. The accepted values depend on the kind and your
plan; see the Monitor reference.
Look for a keyword behind a login
Section titled “Look for a keyword behind a login”A keyword monitor reads the page and fails when the word is missing. Basic
auth credentials go in authUsername and authPassword, which is Redacted:
yield* BetterStack.Incidents.Monitor("admin", { url: "https://admin.example.com", monitorType: "keyword", requiredKeyword: "Dashboard", authUsername: "monitor", authPassword: yield* Config.Redacted("ADMIN_PASSWORD"), regions: ["us", "eu"],});Better Stack never returns authPassword, so a change is detected against your
previous deploy, never against the live monitor.
Group monitors
Section titled “Group monitors”A MonitorGroup keeps related monitors
together. Monitors join it through monitorGroupId:
const group = yield* BetterStack.Incidents.MonitorGroup("public", { name: "Public endpoints", sortIndex: 1,});yield* BetterStack.Incidents.Monitor("site", { url: "https://example.com", monitorType: "status", monitorGroupId: group.id,});Pause a whole group
Section titled “Pause a whole group”paused: true on a group pauses every monitor in it, for maintenance. Better
Stack only accepts paused on an update, so a group declared paused is paused
right after it’s created:
yield* BetterStack.Incidents.MonitorGroup("maintenance", { name: "Under maintenance", paused: true,});Reference a monitor you don’t manage
Section titled “Reference a monitor you don’t manage”Monitor.lookup reads a monitor created in the web app or by another stack. It
is never created, changed or deleted:
const existing = BetterStack.Incidents.Monitor.lookup({ id: "123456" });What changes replace a monitor
Section titled “What changes replace a monitor”Every prop updates in place except teamId: moving a monitor to another team
creates a new one. metadata on a monitor and a separate
Metadata resource write the same
keys, so manage each key in one place.
Where next
Section titled “Where next”- Heartbeats: the opposite direction, a job that checks in.
- Status pages: show monitors to your users.
- Escalation policies: who a failing monitor pages.
- Watching your services: a monitor on a
Cloud.Service’s/health. - Reference:
Monitor,MonitorGroup. - Better Stack: Create a monitor (API).