Alerts
KiviDB Cloud can tell you when a database needs attention: by email to your organization's members, in a Slack or Microsoft Teams channel, as a PagerDuty…
KiviDB Cloud can tell you when a database needs attention: by email to your organization's members, in a Slack or Microsoft Teams channel, as a PagerDuty incident, or with a signed request to your own HTTPS endpoint (your incident tooling, a chat bot, any service that takes a webhook). Set them up under Settings → Alerts.
What you can watch
| Alert | Measured as | Default |
|---|---|---|
| Memory used | used memory of the busiest node, as a percentage of the memory each node has for data | above 80 % |
| Operations per second | commands per second across all nodes, over the last 2 minutes | above 10,000 |
| p99 command latency | 99th percentile of command time across all nodes, over the last 5 minutes | above 5 ms |
| Connected clients | client connections across all nodes | above 1,000 |
| Replication lag | the furthest-behind replica, in seconds | above 10 s |
| Failover | a replica was promoted to primary | every failover |
| Credit runway | days your credit balance lasts at the current hourly spend of all running databases | below 7 days |
Every alert except credit runway is about one database. Credit runway is about the organization, and has no reading while nothing is running.
When a notice is sent
Alerts are checked every minute.
- When the condition starts to hold, the alert is pending. Once it has held for the time you chose (for at least, 5 minutes by default; 0 sends at once), it is firing and every channel of the alert is told.
- While it keeps firing, the channels are told again after the repeat interval (60 minutes by default), and not more often.
- When the condition clears, the channels get a resolved notice and the alert goes back to OK.
- A failover alert sends one notice for each failover, once the new primary is serving. There is no resolved notice for it.
A stopped database, or one being resized or upgraded, has no readings and its alerts are left where they are until it is running again. Changing an alert starts it over from OK.
A notice that cannot be delivered is tried again after 1, 5, 15 and 60 minutes, then marked failed. Recent notices on the same page shows each one, and the error when it failed. The history is kept for 30 days.
Channels
Goes to the members of your organization with the roles you choose (owners and admins by default). Alerts cannot be sent to addresses outside the organization; invite a member to add someone.
Slack
Create an incoming webhook in Slack (Apps → Incoming WebHooks → Add to
Slack, then pick the channel) and paste its URL, which starts with
https://hooks.slack.com/services/. Use Test to check it.
Microsoft Teams
On the Teams channel, open … → Workflows and choose Post to a channel
when a webhook request is received. Paste the URL the workflow gives you
(on logic.azure.com or api.powerplatform.com); an older Office 365
connector URL (on webhook.office.com) works too. Each notice is a card with
the alert, the reading and a button to the console.
PagerDuty
On the PagerDuty service, add an Events API v2 integration and paste its Integration Key, and choose the region your PagerDuty account is in (US or EU). A firing alert opens an incident, repeats while it keeps firing join the same incident, and the resolved notice resolves it. A failover is sent as critical, other alerts as errors. Test opens an incident and resolves it straight away. The key is stored encrypted and never shown again; the console shows its last four characters.
Webhook
An HTTPS URL on a public address. Each notice is a POST with a JSON body:
{
"event": "firing",
"alert": {
"id": "6f1c0e8e-…",
"name": "Memory above 80 %",
"metric": "memory_pct",
"op": "gt",
"threshold": 80
},
"database": { "id": "2fc8cad4-…", "name": "sessions" },
"organization": { "id": "9a0b…" },
"value": 83.4,
"at": "2026-10-22T09:14:00.000Z",
"console_url": "https://kividb.io/dashboard/2fc8cad4-…/metrics"
}
event is firing, resolved or test. database is null for credit
runway and for tests, and value is null for failover and tests. The
X-KiviDB-Event header repeats event.
Answer with any 2xx status within 10 seconds. Redirects are not followed.
Verifying the signature
When you add a webhook, its signing secret (whsec_…) is shown once. Every
request carries a header:
X-KiviDB-Signature: t=1792660440,v1=5d41402abc4b2a76b9719d911017c592…
v1 is the hex HMAC-SHA256, keyed with the signing secret, of the timestamp,
a full stop, and the raw request body: "{t}.{body}". Compare it in constant
time, and refuse a timestamp more than five minutes old so a captured request
cannot be replayed.
Node.js:
import crypto from "node:crypto";
function verify(secret, header, rawBody) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
const age = Math.abs(Date.now() / 1000 - Number(parts.t));
if (!parts.t || !parts.v1 || age > 300) return false;
const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
return parts.v1.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected));
}
Python:
import hashlib, hmac, time
def verify(secret: str, header: str, raw_body: bytes) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
if "t" not in parts or "v1" not in parts or abs(time.time() - int(parts["t"])) > 300:
return False
expected = hmac.new(secret.encode(), parts["t"].encode() + b"." + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(parts["v1"], expected)
Sign the body exactly as received, before parsing it: re-serialized JSON will not match.
Who can change alerts
Owners, admins and members can add, change and remove channels and alerts; viewers can see them. Webhook, Slack and Teams URLs are shown shortened, and a PagerDuty key only by its last four characters, because whoever holds one can post to it. An API key limited to particular databases cannot use the alerts endpoints.
API
The same settings are available to an API key:
| Method and path | |
|---|---|
GET /alerts/channels | list channels |
POST /alerts/channels | add one: {"kind":"email","name":"…","roles":["owner","admin"]}, {"kind":"slack","name":"…","url":"…"} or {"kind":"webhook","name":"…","url":"…"} |
POST /alerts/channels/{id}/test | send a test notice |
DELETE /alerts/channels/{id} | remove a channel no alert uses |
GET /alerts/rules | list alerts, with where each stands |
POST /alerts/rules | add one: {"name":"…","metric":"memory_pct","instance_id":"…","op":"gt","threshold":80,"for_minutes":5,"cooldown_minutes":60,"channel_ids":["…"]} |
PUT /alerts/rules/{id} | replace an alert |
DELETE /alerts/rules/{id} | remove an alert |
GET /alerts/deliveries | the last 100 notices |
metric is one of memory_pct, ops_per_sec, latency_p99_ms,
connected_clients, replication_lag_seconds, failover and
credit_runway_days. An organization can have up to 20 channels and 100
alerts.