Skip to content

Monitoring your server

Argavon reports its own health at GET /metrics (Prometheus text format) and can push the same numbers to any OpenTelemetry endpoint. Ready-made alert rules and a Grafana dashboard are in deploy/monitoring/.

Scraping /metrics

/metrics answers loopback and private addresses without a token, which covers Prometheus in the same Docker network or Kubernetes cluster (and Fly's managed scrape). A request without the token that came through a proxy (it carries X-Forwarded-For, Forwarded, X-Real-IP or Fly-Client-IP, as through the web container's nginx) is refused, because it started outside. From anywhere else set METRICS_TOKEN and send Authorization: Bearer <token>. It contains counts and timings only: no workspace names, ids or alert text.

scrape_configs:
  - job_name: neuroops          # the alert rules expect this job name
    static_configs: [{targets: ["backend:8080"]}]

What it measures

Metric What
neuroops_notification_dispatch_delay_seconds Seconds from when a page was due to its first send attempt, by channel. The target: within 60 s.
neuroops_notifications_total Send attempts by channel, kind (page, verify, test) and result (sent, retry, failed).
neuroops_queue_due Work due now and not done yet: deliveries, mail, escalations, meter events.
neuroops_notification_queue_oldest_due_seconds How long the oldest due notification has waited.
neuroops_page_outcome_total Page SMS and calls by channel and what the phone network reported (delivered, not_delivered). Needs TWILIO_CALLBACK_BASE.
neuroops_page_delivery_seconds Seconds from a page being queued to the network reporting it reached the phone (SMS on the handset, call answered), by channel.
neuroops_alert_processing_seconds, neuroops_alerts_processed_total Turning alerts into incidents.
neuroops_ingest_inbox Ingest inbox rows not done, by status: pending (accepted, not in an incident yet) and failed (dead letters). A pending count that keeps growing means alerts are not being processed; see Ingest inbox.
neuroops_http_requests_total, neuroops_http_request_duration_seconds API traffic by status class.
neuroops_db_connections_* The database pool.
neuroops_build_info Version, edition, deployment.

A watchdog outside the server

Alert rules on your own Prometheus cannot tell you that the machine running both is gone. Set WATCHDOG_URL to the ping URL of a dead-man's-switch check at an outside service (healthchecks.io and Better Stack heartbeats both work, and both have free tiers). Every minute the server pings it while it can page: the database answers and no page is more than 5 minutes overdue. When it cannot, it calls <WATCHDOG_URL>/fail with the reason (for example database unreachable: … or 3 pages are more than 5 minutes overdue: the dispatcher is stuck). When the pings stop altogether (the server, the VPS or its network is down), the outside service calls and texts you through its own provider. Set its grace period to about 3 minutes.

Alert rules

deploy/monitoring/alerts.yml (with unit tests in alerts_test.yml, run by promtool test rules):

Alert Fires when
ArgavonDown a server stops answering for 2 min
NotificationDispatchSLOBreach more than 5% of pages started over 60 s late (30 min)
NotificationQueueBacklog a notification waited over 2 min
EscalationsStuck escalation steps are overdue for 5 min
PageDeliveriesFailing over 20% of page attempts failed for good (15 min)
HighServerErrorRate, SlowAPI 5xx over 5%, or p95 latency over 2 s
DatabasePoolSaturated the pool over 90% busy for 10 min
MailOutboxStuck, UsageMeterEventsStuck mail or billing events not going out

Route them somewhere that does not depend on this server being up (a second Argavon, or Alertmanager's own email).

OpenTelemetry

Set OTEL_EXPORTER_OTLP_ENDPOINT (and OTEL_EXPORTER_OTLP_HEADERS for credentials) and the server pushes its metrics as OTLP/HTTP JSON every OTEL_METRIC_EXPORT_INTERVAL milliseconds (default 60 000). For Grafana Cloud: the OTLP endpoint of your stack and Authorization=Basic%20<base64 of instance-id:token>. OTEL_RESOURCE_ATTRIBUTES adds attributes such as deployment.environment=production.

How long data is kept

Self-hosted: alerts and notification deliveries for RETENTION_DAYS (default 90), resolved incidents for INCIDENT_RETENTION_DAYS (default 0, forever). Open incidents and their alerts are never removed. The purge runs hourly in small batches. A platform operator can give one workspace its own window: PUT /api/v1/admin/tenants/{id}/retention {"retention_days": 30} (null goes back to the default, 0 keeps forever). On Argavon Cloud the plan decides (docs: Plan and billing).

Backups

Back up the database and MASTER_ENCRYPTION_KEY. scripts/backup/backup.sh (nightly dump to S3-compatible storage, optional encryption with gpg, or openssl where gpg is missing, 35 days kept), scripts/backup/restore.sh (puts a dump into an empty database; it refuses one that has tables) and scripts/backup/restore-test.sh (restores the newest dump into a scratch server and checks it) work for any install. scripts/backup/backup_live_test.sh runs the whole round trip on one machine with Docker and a local MinIO. Use PostgreSQL client tools of the server's major version, and a database role with BYPASSRLS for the dump (row-level security is forced).