Skip to content
betterstack-alchemyUnofficial

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.

api.example.comyour service
my-teamBetter Stack team
Public endpointsmonitor group
apimonitor · status
every
60 s
from
us, eu
sitemonitor · status
On-callescalation policy
  • apichecks →api.example.com
  • Public endpointspages via →On-call
Monitors belong to a team and sit in an optional group. Better Stack runs the checks against your service; a failure opens an incident that the escalation policy routes to people.

The smallest monitor is a URL and a kind. status treats any 2xx answer as up:

alchemy.run.ts
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.

A keyword monitor reads the page and fails when the word is missing. Basic auth credentials go in authUsername and authPassword, which is Redacted:

alchemy.run.ts
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.

A MonitorGroup keeps related monitors together. Monitors join it through monitorGroupId:

alchemy.run.ts
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,
});

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:

alchemy.run.ts
yield* BetterStack.Incidents.MonitorGroup("maintenance", {
name: "Under maintenance",
paused: true,
});

Monitor.lookup reads a monitor created in the web app or by another stack. It is never created, changed or deleted:

alchemy.run.ts
const existing = BetterStack.Incidents.Monitor.lookup({ id: "123456" });

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.