Docs menu

Health and alerts

See how the computer and each app are doing, and get an email when something needs you.

Health

$ secretbase health
<machine> now: …memory <n> of <n> GB · disk <n> GB used, <n> GB free · …
  Room for …
  Allocated: <n> of <n> CPUs · <n> of <n> GB memory (<n> reserved) · <n> of <n> GB disk
Apps and websites (CPU: share of this machine; memory: with the app's workers, Postgres and Redis):
  my-app  website: <n> GB disk

It shows this machine's CPU, memory, disk and temperature now, the highest in the last 24 hours, how many more apps fit, and what each app is allocated with its CPU and memory now. Secretbase reads them once a minute and keeps 30 days. secretbase health my-app shows one app:

$ secretbase health my-app
my-app: website: <n> GB disk. Websites use no CPU or memory of their own.

On the dashboard: Machines, Health, with charts for 24 hours, 7 days or 30 days. Each app's own chart is on its page.

From a laptop, add --to <server> (Connect from a laptop). An App token reads its own app's health; the whole server's takes a Server token.

$ secretbase health my-app --to server

Alerts

$ secretbase alerts
Nothing is wrong now.
Email is off, so alerts aren't emailed. Turn it on: secretbase email set --to <the email address of your Resend account>
Once email is on, email me when (recommended: all on):
  on   crash   An app keeps crashing
  on   start   An app doesn't start after the computer restarts
  on   backup  A backup fails
  on   place   A backup place can't be reached for 2 hours
  on   disk    The disk is almost full
  on   key     The Tailscale sign-in is due
  on   update  An update is ready
Switch one: secretbase alerts <kind> on|off · Send a test alert: secretbase alerts test

It lists what is wrong now and what was fixed in the last 30 days. Each alert is emailed once, and once more when it is fixed. On the dashboard: Settings, Alerts. On a desktop, secretbase notify also shows them as desktop notifications.

Email

Alerts go out through your own free Resend account, to the address you signed up with:

$ secretbase email set --to you@example.com
Send alerts by email through your own Resend account (free):
1. Sign up or sign in at https://resend.com with the email address the alerts should go to.
2. Open https://resend.com/api-keys, press "Create API Key", choose Full access (recommended: it also lets Secretbase add your own domain; a Sending access key sends alerts only), and copy the key (it starts with re_).
3. Paste the key here and press Enter (it isn't shown while you type).
…
$ secretbase email test

Then secretbase alerts test sends a test alert. secretbase email off removes the key and the address from this computer.

Your own scripts on the computer can send an alert the same way, without a key of their own. It is emailed at once and the command prints "Alert emailed."; it exits with 1 when it wasn't sent (for example while email is off):

$ secretbase alert send --level error "Disk mirror: 3 files differ"

The level is error (the default), warning or info, and the line can have up to 500 characters. At most 10 are emailed in any hour, and they share your apps' 90 emails a day, so the emails kept for the real alerts are always there.

Watch from outside

Alerts come from the computer itself, so they can't tell you it is off. secretbase watch on puts a small checker in your own Cloudflare account (a Cloudflare Worker) that asks the computer every minute and emails you when it stops answering, and again when it is back. It needs Cloudflare, email and the online dashboard (secretbase dashboard on).

$ secretbase watch status
Watching from outside: off. Turn it on to get an email when this computer stops answering: secretbase watch on

If something goes wrong

  • "Email isn't set up yet. Add your Resend key and the address alerts go to": run secretbase email set as above.
  • The test email doesn't arrive: look in that inbox's spam folder.