Skip to content

Monitor Litebackup with Prometheus and Grafana

Every Litebackup server shows its own load on the console's Monitoring page, and exports the same measures as Prometheus metrics, so they reach the dashboards and alerts you already run.

In the console

The Monitoring page charts the last hour, day, week, or 30 days, with rates per minute:

  • Throughput. Syncs, bytes received from machines, bytes and objects written to buckets.
  • Requests. API requests, errors, and requests answered with HTTP 429 when a limit was reached.
  • Lag. How long the oldest version has waited for a bucket, the number of databases with late uploads, and replica lag.
  • Host load. CPU, memory, and pressure stalls (PSI) of the server's cgroup or machine.

Thresholds on the Settings page fire alerts when a measure stays past its limit, and the Monitoring page lists them. The Databases page charts totals for the whole server, a database's page its versions and size, and the Disk page free space against the reserve.

Scrape the metrics

The server answers /health and /metrics over plain HTTP, without authentication, on --health-address (LITEBACKUP_HEALTH_ADDRESS). It is 127.0.0.1:8099 by default and 0.0.0.0:8099 in the container image. Keep it on a private network: anyone who reaches it reads the server's load and database count.

# Read the metrics on the server's host.
curl --fail --silent --show-error http://127.0.0.1:8099/metrics

To scrape from another host, bind it to a private address, such as --health-address 10.0.0.5:8099, and add a job to prometheus.yml:

scrape_configs:
  - job_name: litebackup
    scrape_interval: 30s
    static_configs:
      - targets: ["10.0.0.5:8099"]

With the container image in Docker Compose, Prometheus on the same network scrapes litebackup:8099.

Metrics

Counters end in _total; take their rate(). Gauges marked "as of the last minute" are measured once a minute.

Throughput

Metric Type What it measures
litebackup_syncs_total counter Versions committed by sync requests.
litebackup_upload_bytes_total counter Bytes received by sync and stage requests.
litebackup_archive_bytes_total counter Bytes of objects written to buckets.
litebackup_archive_objects_total{type} counter Objects written to buckets, by type.
litebackup_archive_objects_deleted_total{reason} counter Objects deleted from buckets: retention, garbage, or purge.

Requests

Metric Type What it measures
litebackup_requests_total{route,status} counter API requests by route and status code.
litebackup_request_seconds{route} histogram API request latency by route.
litebackup_rate_limited_requests_total{reason} counter HTTP 429 responses with error code rate_limited, grouped by reason.
litebackup_pool_reserved_slots{pool} gauge Slots reserved in each slot pool.
litebackup_pool_queued{pool} gauge Requests queued for a slot in each pool.
litebackup_open_copies gauge Database copies open on the server.
litebackup_open_files_limit gauge The soft limit on open files; each open copy holds about five.

Backups and buckets

Metric Type What it measures
litebackup_databases gauge Databases that are not deleted, as of the last minute.
litebackup_unarchived_versions gauge Versions no bucket holds yet, as of the last minute.
litebackup_unarchived_databases gauge Databases with versions not yet in a bucket.
litebackup_archive_oldest_unarchived_seconds gauge Age of the oldest version not yet in a bucket; 0 when everything is archived.
litebackup_late_archive_databases gauge Databases whose oldest pending change has waited more than twice the configured archive delay for upload.
litebackup_archive_overdue_databases gauge Databases whose archive was due more than five minutes ago.
litebackup_archive_integrity_errors_total counter Bucket restores that found a missing base or a digest mismatch.
litebackup_bucket_check_age_seconds gauge Seconds after the last bucket check that finished without failures; -1 before the first.
litebackup_bucket_check_failures gauge Bucket checks in a row that failed; 0 after a success.
litebackup_retention_removal_backlog gauge Objects retention gave up that are not deleted from their buckets yet.
litebackup_retention_paused{reason} gauge 1 when the last retention pass did nothing for this reason.
litebackup_replica_lag_seconds gauge The longest lag of a replica that polled in the last 10 minutes, as of the last minute.

Disk and host

Metric Type What it measures
litebackup_disk_free_bytes gauge Free bytes on the data filesystem.
litebackup_disk_reserve_bytes gauge Bytes the server keeps in reserve; syncs pause before the disk fills.
litebackup_disk_reserved_bytes gauge Bytes held for uploads, staging, and archive files being written.
litebackup_segment_fsync_seconds histogram Time to fsync each synced record.
litebackup_cpu_usage_ratio gauge Share of the CPU in use over the last 10 seconds; -1 where unknown.
litebackup_memory_usage_ratio gauge Share of the memory limit in use; -1 where unknown.
litebackup_pressure_some_ratio{resource} gauge Share of the last minute in which some tasks stalled on cpu, memory, or io.
litebackup_pressure_full_ratio{resource} gauge Share of the last minute in which all tasks stalled on the resource.

License

Metric Type What it measures
litebackup_license_state gauge 0 active, 1 ending within 30 days, 2 in its 14-day grace period, 3 lapsed (new databases refused), -1 none.
litebackup_license_end_seconds gauge The license's end date in Unix seconds, 0 with none.

Queries

# Syncs per minute
sum(rate(litebackup_syncs_total[5m])) * 60

# Bytes received from machines and written to buckets, per minute
sum(rate(litebackup_upload_bytes_total[5m])) * 60
sum(rate(litebackup_archive_bytes_total[5m])) * 60

# 99th percentile request latency
histogram_quantile(0.99, sum by (le) (rate(litebackup_request_seconds_bucket[5m])))

# Rate-limited requests per minute, by limit
sum by (reason) (rate(litebackup_rate_limited_requests_total[5m])) * 60

# How long the oldest version has waited for a bucket
max(litebackup_archive_oldest_unarchived_seconds)

Alerts

These rules cover what needs a person: backups not reaching the bucket, failed bucket checks, a filling disk, and a license about to end. Set the durations to suit your archive delays.

groups:
  - name: litebackup
    rules:
      - alert: LitebackupDown
        expr: up{job="litebackup"} == 0
        for: 5m
        annotations:
          summary: The Litebackup server does not answer /metrics.
      - alert: LitebackupBucketBehind
        expr: max(litebackup_archive_oldest_unarchived_seconds) > 3600
        for: 10m
        annotations:
          summary: A version has waited more than an hour for the bucket.
      - alert: LitebackupBackupUploadLate
        expr: max(litebackup_late_archive_databases) > 0
        for: 15m
        annotations:
          summary: A database has changes waiting more than twice its archive delay for upload.
      - alert: LitebackupBucketCheckFailing
        expr: max(litebackup_bucket_check_failures) > 0
        for: 1h
        annotations:
          summary: Bucket checks are failing.
      - alert: LitebackupIntegrityErrors
        expr: increase(litebackup_archive_integrity_errors_total[1h]) > 0
        annotations:
          summary: A restore from the bucket found a missing or damaged object.
      - alert: LitebackupDiskLow
        expr: min(litebackup_disk_free_bytes) < 2 * max(litebackup_disk_reserve_bytes)
        for: 10m
        annotations:
          summary: Free disk is under twice the reserve; syncs pause at the reserve.
      - alert: LitebackupReplicaLag
        expr: max(litebackup_replica_lag_seconds) > 60
        for: 10m
        annotations:
          summary: A replica is more than a minute behind.
      - alert: LitebackupRequestRateLimiting
        expr: sum(rate(litebackup_rate_limited_requests_total[5m])) > 1
        for: 15m
        annotations:
          summary: The server is returning HTTP 429 because a limit was reached.
      - alert: LitebackupLicenseEnding
        expr: max(litebackup_license_state) >= 1
        annotations:
          summary: The server's license ends soon or has ended.

Grafana

Import the Litebackup dashboard in Grafana (Dashboards, New, Import), and choose your Prometheus data source. It shows the database count, syncs, throughput, requests by route, latency percentiles, rate-limited requests, the bucket backlog, lag, host load, and disk, for one server or all of them.

SDK guides · Source on GitHub