library / Integrations / No-code automation / I0154
Statuspage RPC status updater
A small Node poller reads getHealth and getSlot from Carbium every 60 seconds, maps the result to one of three page statuses, and posts a change to an intake URL you choose, so your status page follows the node.
What the poller reports
The poller is one Node process with one dependency, @solana/kit. Every 60 seconds it asks Carbium for two things: getHealth, which answers ok when the node judges itself healthy, and getSlot, the newest slot the node has seen. From those two answers it picks one of three statuses and writes it to the console. It sends the status to a URL you own only when the status changes.
The second call covers the case getHealth can miss. A node can answer its health check while it has stopped moving forward, and a status page that only watches for errors stays green through that. Comparing the slot with the one read on the previous poll catches it.
Three page statuses
| Status | When the poll sees it | Sent to your intake |
|---|---|---|
| operational | getHealth answers ok and the slot has moved since the previous poll. | Once, when the status changes into this state. |
| degraded_performance | Both calls answer, but the slot is the same as the one read on the previous poll. | Once, when the status changes into this state. |
| major_outage | getHealth or getSlot fails with an error other than a 429, including a node that answers with an unhealthy error. | Once, when the status changes into this state. |
A 429 skips the poll and leaves the status where it was. The first poll has no earlier slot to compare with, so a healthy start sends nothing, and a stall shows up at the second poll.
The two Carbium calls
Both calls go to Carbium's RPC endpoint, https://services.carbium.sh by default, and the key goes in the `x-api-key` header. The client is built once at start, and it takes its URL from CARBIUM_RPC_URL when that is set.
The slot read asks for processed in the call itself. @solana/kit 8.6.0 fills in confirmed when a call leaves commitment out, and this check should follow the newest slot each node has seen. Each call has a 5 second deadline, so a call that runs past it counts as failed and the page shows an outage.
The two calls run in Promise.allSettled, so one failure does not hide the other. If the health call fails, the slot still shows whether the node moved, and the log line names the call that failed.
Wire the intake and run it
The poller posts a JSON body with status, at and slot to STATUS_HOOK_URL. Point that at an endpoint you run, such as a small serverless route, which maps the body to the component update on your status page. Keep the URL private, since whoever holds it can change the status your users see. The poller moves its stored status only after the intake answers with a success code, so a failed post is sent again on the next poll.
// I0154 · Statuspage RPC status updater// https://carbium.sh/library/integrate/statuspage-rpc-status-updater// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.// SPDX-License-Identifier: MITimport { createDefaultRpcTransport, createSolanaRpcFromTransport, isSolanaError, SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR,} from "@solana/kit";const key = process.env.CARBIUM_KEY;if (!key) { console.error("Set CARBIUM_KEY."); process.exit(1);}const hookUrl = process.env.STATUS_HOOK_URL; // optional: your intake, if setconst once = process.argv.includes("--once");const POLL_MS = 60_000;const rpc = createSolanaRpcFromTransport( createDefaultRpcTransport({ url: process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh", headers: { "x-api-key": key }, }),);type Status = "operational" | "degraded_performance" | "major_outage";let current: Status = "operational";let lastSlot = 0n; // the first poll has no earlier slot to compare withconst is429 = (e: unknown) => isSolanaError(e, SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR) && e.context.statusCode === 429;const opts = () => ({ abortSignal: AbortSignal.timeout(5_000) });async function poll(): Promise<number> { const [h, s] = await Promise.allSettled([ rpc.getHealth().send(opts()), rpc.getSlot({ commitment: "processed" }).send(opts()), ]); if ([h, s].some((x) => x.status === "rejected" && is429(x.reason))) { console.error("poll skipped: 429 from Carbium, status unchanged"); return POLL_MS; } const failed = [ h.status === "rejected" ? "getHealth" : "", s.status === "rejected" ? "getSlot" : "", ].filter(Boolean); let next: Status = "operational"; let slot = "n/a"; if (failed.length > 0) { next = "major_outage"; } else if (s.status === "fulfilled") { slot = s.value.toString(); if (s.value === lastSlot) next = "degraded_performance"; } if (s.status === "fulfilled") lastSlot = s.value; const at = new Date().toISOString(); const note = failed.length > 0 ? ` failed: ${failed.join(", ")}` : ""; console.log(`${at} ${next} slot ${slot}${note}`); if (next !== current && hookUrl) { const res = await fetch(hookUrl, { method: "POST", headers: { "content-type": "application/json" }, signal: AbortSignal.timeout(5_000), body: JSON.stringify({ status: next, at, slot }), }); if (!res.ok) throw new Error(`status hook answered ${res.status}`); } current = next; // moved only after the intake accepted it return POLL_MS;}for (;;) { const wait = await poll().catch((err: unknown) => { console.error("poll or hook failed:", err instanceof Error ? err.message : err); return POLL_MS; }); if (once) break; await new Promise((r) => setTimeout(r, wait));}
run: node main.ts --once
Export CARBIUM_KEY, and STATUS_HOOK_URL once you have an intake, then start node main.ts under a supervisor such as a systemd unit. Without STATUS_HOOK_URL the poller only logs, which is the right way to check the reads before a page depends on them. node main.ts --once runs one poll and exits.
What it costs against your limits
getSlot and getHealth are cached reads at 1 cell each, and Free allows 5 req/s of that class. The poller sends two calls a minute, which is 2 cells a minute and well inside the Free rate.
Limits are per account, so the poller shares one budget with the app traffic on the same account. A call past its rate waits once and is served if its cells refill within 1 s. Past that it gets 429 with a retry-after hint, and the poller skips that poll, keeps the status and tries again at the next interval.
Where it ends
- It reports what the node says and what its slot does. It does not follow any one transaction, and it does not time calls beyond the 5 second deadline.
- A stall that starts and ends between two polls is not seen. A slot that moves across a poll gap looks healthy even when the node was stuck for part of the minute.
- A slow node that still advances reports operational, because the check compares the slot with the previous poll and nothing else.
- It does not switch traffic. The status page shows the state, and routing between endpoints belongs to your app or proxy.
- A poller that dies sends no update, and the page keeps its last status. Supervise the process and watch its log from another place.
- The page shows whatever the intake maps, so a wrong mapping shows a wrong status. Send each of the three states once through the intake before a page depends on it.
When it goes wrong
| what goes wrong | what to do |
|---|---|
| Every poll logs poll or hook failed: status hook answered 404, and the status page does not change. | The intake URL is wrong or was removed. Set STATUS_HOOK_URL to the current URL and restart. The status was not stored as sent, so the next poll sends it again. |
| Most polls log poll skipped: 429 from Carbium, and the status stays where it was. | Your account's budget is spent, usually by app traffic on the same account. Lower that traffic or move to a plan with a higher rate, then check that the log shows polls again. |
| The page shows major_outage while the node answers in a browser. | The key or the URL is wrong. An unknown key gets a 401, so attach the whole key in the x-api-key header and check CARBIUM_RPC_URL if you set it. |
| The page shows degraded_performance for one poll and then goes back to operational. | The slot stood still across one interval, which can happen while a node is busy. If the state flips often, make the intake wait for two degraded polls in a row before it changes the page. |
| The page shows operational while your app gets errors from its own calls. | The poller reads only the node's health and slot. Set the page status from your app's failed calls as well, and let the poller cover the node side. |
Questions
Does this tell me whether my users can send transactions?
No. It tells you whether the node answers its health check and whether its slot moves. A moving slot says nothing about one transaction, so your own app's errors are the place to read that.
Why not just use getHealth?
getHealth can answer ok while the node stops advancing, so the slot check covers that gap. Together they cost two cached reads a minute.
Does it need a paid plan?
No. Two cached reads a minute fit inside the Free plan's 5 req/s for that class, so the poller runs on Free.
Can it update the status page directly?
It posts to a URL you name, so the page's own credentials live in your intake code and the poller holds no page key. Your intake makes the component update.