Repository navigation
metrics and webhooks
What Rollcall sends to other programs, and what it reads from them: the body of each webhook, the MQTT topics, and the Prometheus metrics. How to turn each on is in usage and configuration.
A Webhook notification channel sends one POST per event to the address you give, with Content-Type: application/json. Add one under Settings › Notifications, pick the events it gets, and use Send test to see a test event arrive. Anything that takes a JSON POST works: an n8n or Node-RED webhook node, a Home Assistant webhook trigger, or your own script.
Rollcall takes any 2xx answer as delivered. Anything else, or no answer in 30 seconds, counts as failed: the event is kept and sent again, a minute later at first and then less often, up to every 15 minutes.
Every event has the same shape:
{
"event": "print_failed",
"title": "A print failed or was stopped",
"message": "benchy.gcode: on Voron, 12 g",
"items": [
{
"kind": "print",
"id": "0198c1de-5f0a-7c53-9a57-2f1f0c1d7e11",
"name": "benchy.gcode",
"detail": "on Voron, 12 g"
}
],
"url": "https://rollcall.example.com/prints",
"sent_at": "2026-12-05T18:04:11.482Z"
}| Field | What it holds |
|---|---|
event |
Which event this is, from the list below. Also sent as the X-Rollcall-Event header |
title |
One line for a person, like the title of the push notification |
message |
The items as text, one per line |
items |
What the event is about. Several things of one kind that came up together arrive as one event with several items |
items[].kind |
What id is the id of: spool, filament, print, printer, backup or update
|
items[].id |
The id to use with the API, or null for a backup or an update |
items[].name, items[].detail
|
Its name, and what there is to say about it (null when nothing) |
url |
The page to open, or null while PUBLIC_URL isn't set |
sent_at |
When Rollcall sent it (UTC) |
More fields may be added later, so ignore the ones you don't know.
event |
When | items[].kind |
Example name and detail
|
|---|---|---|---|
low_stock |
A spool goes under your low-stock weight | spool |
Polymaker PolyLite · Galaxy Blue, 150 g left
|
reorder |
A filament has fewer spools left than you keep, or runs out soon at the pace you use it | filament |
Bambu Lab PLA Jade White, 1 of 2 spools left or about 9 days left at 32 g a day
|
print_pending |
A print waits for you to pick its spool | print |
bracket.gcode, null
|
print_needs_grams |
A print waits for you to enter how much it used | print |
bracket.gcode, null
|
drying_due |
An open spool is due for drying | spool |
Prusament ASA · Prusa Orange, null
|
print_finished |
A print finished | print |
benchy.gcode, on Voron, 12 g
|
print_failed |
A print failed or was stopped | print |
benchy.gcode, on Voron, 12 g
|
printer_offline |
A connected printer has been out of reach for ten minutes | printer |
Voron, the connection's last error or null
|
printer_online |
A printer you were told was offline answers again | printer |
Voron, null
|
printer_error |
A printer reports an error, or waits for you. A Bambu Lab printer's problems are told once for each code | printer |
Voron, It reports an error, on benchy.gcode
|
humidity_high |
A spool's or a location's humidity reading is over your limit |
spool, or location for a reading that belongs to a place |
eSUN PLA+ · Fire Engine Red (R-0003), 52% in Dry Box 1; Dry Box 1, 52%, with 3 spools
|
spool_emptied |
A spool is used up | spool |
SUNLU TPU · Black, null
|
drying_finished |
A drying run reached its planned time, or a spool set to Drying by hand has been in for its drying time | spool |
Prusament ASA · Prusa Orange, 4 h are up
|
maintenance_due |
An item on a printer reached a replace-after limit | equipment |
Hardened steel nozzle, 262 of 250 h
|
backup_failed |
A backup couldn't be made, didn't pass its check, or couldn't be copied to the remote storage (admins) | backup |
Automatic backup, the error |
backup_ok |
A backup was made, and passed its check and was copied where those are on (admins) | backup |
Backup, 2026-12-05 03:00 UTC
|
update_available |
A newer Rollcall is out (admins) | update |
Build 1a2b3c4, 12 changes
|
test |
You selected Send test | none: items is empty |
A channel gets low_stock and reorder with Low stock, print_pending and print_needs_grams with Prints that need a spool or grams, drying_due with Drying due, and printer_online with Printer offline, and back. Each of the others has its own checkbox.
Each event is sent once for each thing, and again only after it has cleared and come back.
Give the channel a Secret, and pick what to do with it:
-
Send it as a bearer token: each request has
Authorization: Bearer <secret>. Simple, and enough over HTTPS. -
Sign the body (HMAC-SHA256): the secret is never sent. Each request has
X-Rollcall-Signature: sha256=<hex>, the HMAC-SHA256 of the exact bytes of the body with your secret as the key. Compute the same on your side and compare; a request someone else made, or changed on the way, doesn't match.
In Python:
import hashlib, hmac
def from_rollcall(secret: str, body: bytes, header: str) -> bool:
want = "sha256=" + hmac.new(secret.encode(), body, hashlib.sha256).hexdigest()
return hmac.compare_digest(want, header)In Node.js:
import { createHmac, timingSafeEqual } from 'node:crypto';
function fromRollcall(secret, body, header) {
const want = 'sha256=' + createHmac('sha256', secret).update(body).digest('hex');
return want.length === header.length && timingSafeEqual(Buffer.from(want), Buffer.from(header));
}Check the signature over the body as it arrived, before parsing it: parsing and writing JSON again changes the bytes.
Over the API, a webhook channel with "target": "hmac" signs, and with "target": null sends the bearer token.
An admin sets the broker under Settings › Email and Home Assistant. See Home Assistant sensors.
| Topic | Retained | What |
|---|---|---|
rollcall/status |
yes |
online while Rollcall is connected, offline when it isn't. The broker publishes offline by itself when Rollcall goes away without saying so (its last will) |
<prefix>/sensor/.../config |
yes | Home Assistant discovery for each sensor, published again on every connect. Each names rollcall/status as its availability topic, so the sensors turn unavailable while Rollcall is away |
rollcall/<account id>/state |
yes | An account's numbers, as JSON |
rollcall/<account id>/spool/<spool id> |
yes | An open spool, as JSON |
Each account lists the topics of its own sensors under Settings › Notifications › Sensors over MQTT (GET, POST /api/mqtt-inputs). Rollcall subscribes to exactly those topics; # and + aren't taken.
| Kind | The message | What happens |
|---|---|---|
| Humidity | A number in percent (47.5), or JSON with it under humidity, humidity_pct, relative_humidity, rh or value, and optionally the temperature in °C under temperature, temperature_c or temp
|
A humidity reading for the spool, or one for the location, which goes for every spool kept there. A reading is kept when it differs from the last one kept by a point or more, or after 30 minutes, so a sensor that reports every few seconds doesn't fill the history |
| Scale | A number in grams (812.4), or JSON with it under weight_g, weight, grams or value. Without a spool picked for the topic, the JSON also names it: spool (its label code or id) or tag_uid (its NFC tag) |
The spool is weighed, as with a scale that reads NFC tags: the weight is with the spool on, and its empty weight is taken off |
Zigbee2MQTT, ESPHome and Tasmota sensors fit as they are. For example a Zigbee2MQTT hygrometer publishes {"battery":97,"humidity":41.2,"temperature":22.6} to zigbee2mqtt/drybox.
The list shows when each topic was last heard and what came of it, such as 41.2%, 812.4 g on the scale or No number in that message.
Rollcall has a Prometheus endpoint at GET /metrics (under the sub-path, if you use one). It's off until you set METRICS_TOKEN, and then answers only to that token, because the numbers say what's in your inventory and what your printers are doing:
- No
METRICS_TOKEN:404. - A request without
Authorization: Bearer <METRICS_TOKEN>:401.
Make a token with openssl rand -hex 32, and scrape with:
scrape_configs:
- job_name: rollcall
metrics_path: /metrics
authorization:
credentials: the-token-you-set
static_configs:
- targets: ['rollcall:8080']The token is only for this endpoint. It isn't an API token and opens nothing else.
| Metric | Type | What |
|---|---|---|
rollcall_build_info{version,commit,branch,database} |
gauge | Always 1; the labels say which build runs on which database |
rollcall_start_time_seconds |
gauge | When this process started (Unix time) |
rollcall_spools{status,material} |
gauge | Spools, across all accounts |
rollcall_filament_grams{status,material} |
gauge | Filament left on them, in grams |
rollcall_low_stock_spools |
gauge | Spools under their owner's low-stock weight |
rollcall_accounts |
gauge | Accounts |
rollcall_prints{result}, rollcall_print_grams{result}
|
gauge | Prints logged and the filament they used, by result (success, failed) |
rollcall_prints_waiting |
gauge | Prints that wait for a spool or grams |
rollcall_printer_state{printer,kind,state} |
gauge | 1 for the state each connected printer is in |
rollcall_printer_progress_percent{printer,kind} |
gauge | How far a running print is |
rollcall_mqtt_connected |
gauge | 1 while the MQTT broker is connected |
rollcall_db_pool_connections{state}, rollcall_db_pool_max_connections
|
gauge | Database connections open (idle, in_use), and the most there can be |
rollcall_notifications_total{channel,result} |
counter | Notifications sent, by kind of channel and ok or failed
|
rollcall_task_runs_total{task,result} |
counter | Runs of the background tasks: notifications, backup, update_check, mqtt
|
rollcall_task_last_run_timestamp_seconds{task}, rollcall_task_last_success_timestamp_seconds{task}
|
gauge | When each last ran, and last worked |
rollcall_http_requests_total{method,route,status} |
counter | API requests. route is the route as written, like /api/spools/{id}, never the address with its ids |
rollcall_http_request_duration_seconds{method,route} |
histogram | How long they took |
The inventory numbers are counted when Prometheus asks, a few small queries per scrape. The counters start from zero when Rollcall starts.
Two alerts worth having:
- alert: RollcallBackupFailing
expr: time() - rollcall_task_last_success_timestamp_seconds{task="backup"} > 2 * 86400
- alert: RollcallNotificationsFailing
expr: increase(rollcall_notifications_total{result="failed"}[1h]) > 5GET /api/health needs no sign-in and says nothing about your data. It answers 200 with {"status":"ok"} when Rollcall can reach its database, and 503 when it can't.
This wiki is a copy of the docs folder, updated whenever it changes. To change a page, edit its file there: changes made here are overwritten.