# Statistics and metrics

> Per-subscription CPU, memory, disk I/O and database load, traffic and storage per type, server OS metrics with a disk-full forecast, visitor reports, and a Prometheus /metrics endpoint with a scoped token.

Source: https://www.berthpanel.app/library/statistics-and-metrics/ · Category: monitoring · Updated: 2026-10-30

Berth measures what each subscription uses and how the server itself is doing, and keeps the history so you can see trends rather than single moments. Customers see their own usage; administrators see every subscription and the server. Everything is also available on the command line and, for the server, as Prometheus metrics.

## Where to find what

| You want to know | Panel | CLI |
|---|---|---|
| How the server performs right now and over time | *Statistics*, tab *Overview* for administrators | `berth stats server`, `berth stats live` |
| CPU, memory, disk I/O and database load per subscription | *Statistics → Performance* | `berth stats performance [--sysuser acme_nl]` |
| Traffic, mail and storage of one subscription | *Statistics* → the subscription | `berth stats subscription`, `berth stats domain` |
| Detailed OS metrics (PSI, steal, conntrack, per NIC and per disk) | *System → Monitoring* | `berth stats os --period 24h --text` |
| When a disk will be full | *System → Disks* and *System → Monitoring* | `berth stats forecast --text` |
| Visitors of a website | Domain → *Statistics → Visitors* | `berth stats visitors --all` (rebuilds the reports now) |
| Health of a subscription over the last week (overload, error pages, PHP pool full) | — | `berth stats health` |

Customers see the menu item as *Usage*. Everything below is scoped: a customer only ever sees their own subscriptions, a reseller only their customers.

## Per subscription: CPU, memory, I/O and database load

Every subscription runs in its own systemd slice (see [isolation](https://www.berthpanel.app/library/isolation/)), so the kernel's cgroup accounting gives exact figures per customer rather than estimates from process lists. The panel measures every five minutes:

- **Processor time**, split into websites and apps on one side and SSH and scheduled tasks on the other, with the average and the peak.
- **Memory**, as PSS (proportional set size), so shared libraries are not counted once per process.
- **Disk I/O** in bytes read and written, and **IOPS**.
- **Database load**: the query time the subscription's database users consumed.
- **Restarts** of the subscription's apps.

*Statistics → Performance* shows these for all subscriptions side by side, with a live view that refreshes itself (**Pause** stops it). It is the quickest way to find the one customer who is using the server's capacity. Click a column header to sort.

If a subscription sits at or above a share of its package limit for several hours in a row, the administrators get a notice; the percentage is set with `berth notify set --perf-percent`. For the database side, *Databases → Performance* adds slow queries and MariaDB settings with recommended values; see [databases](https://www.berthpanel.app/library/databases/).

## Traffic and storage per type

The subscription page breaks traffic and storage down by what caused it:

- web traffic per domain (requests and bytes in and out; every file counts as a request),
- apps and containers,
- mail delivered into mailboxes and mail sent out via the server, and mail fetched from external accounts,
- databases, logs, and backups kept on the server.

The card *What takes up space?* shows storage per type against the package's disk limit. Traffic is measured every five minutes and disk usage every hour. The overview for administrators shows storage now, web traffic this month and traffic per day for the last 30 days, for all subscriptions together and per subscription.

## The server: OS metrics

*System → Monitoring* has the server's own numbers:

- processor time split into user, system, iowait and **steal** (time a hypervisor took from the VM),
- load, available memory and swap,
- **pressure stall information (PSI)** for CPU, memory and I/O, which shows how much of the time tasks had to wait,
- processes per state (running, waiting on disk, zombie), file descriptors and conntrack usage,
- network per interface and disk I/O per device, including how busy each disk was.

You pick the period (one hour to 30 days) and the resolution. The watchdog takes a light measurement every minute (CPU, load, memory, PSI, swap) and keeps it for 24 hours, so a one-minute spike that disappears in a five-minute average is still visible. The rest is collected every five minutes.

**Retention.** Raw measurements are kept for 3 days, hourly values for 93 days and daily values for two years.

## Disk-full forecast and memory leaks

For every file system, both for bytes and for inodes, Berth fits a straight line through the last one to two weeks of usage and reports when it will reach 100 %, with the fit quality (R²) as a measure of confidence. It only warns when the fit is good and usage also rose over the last few days, so the sawtooth of log rotation or nightly backups does not produce false alarms. The forecast appears on *System → Disks* and *System → Monitoring*, and as the notice *Disk filling up, forecast*: first as a warning, then as critical when the date comes close.

The same analysis watches services and apps for memory that keeps rising since their last restart (*Possible memory leak*), with the suggestion to restart them in the next maintenance window. MariaDB is excluded because it fills its cache on purpose.

```bash
berth stats forecast --text
```

What to do when the forecast is short is in [disks and snapshots](https://www.berthpanel.app/library/disks-and-snapshots/).

## Visitors

For each domain, Berth builds a nightly visitor report with GoAccess from the web server's access logs: visitors, pages, referrers, browsers and status codes for the last 30 days. IP addresses are anonymised, and search engines and crawlers are left out. Nothing is added to the website itself: there is no tracking script and no cookie. Find it on the domain under *Statistics → Visitors*.

## Prometheus and Grafana

The panel serves Prometheus metrics at `https://<panel-hostname>/metrics`. Access needs an API token with the scope `metrics`, which can do nothing else. Any login can create one; a customer's token returns only their own subscriptions and domains, an administrator's also the server:

```bash
berth token create --login admin --name prometheus --scope metrics
```

A matching scrape job:

```yaml
scrape_configs:
  - job_name: berth
    scheme: https
    metrics_path: /metrics
    authorization:
      type: Bearer
      credentials_file: /etc/prometheus/berth.token
    static_configs:
      - targets: ["panel.example.nl"]
```

What you get:

- `berth_*` metrics for the panel and its subscriptions, including `berth_filesystem_full_eta_seconds{mount,resource}`, the forecast as seconds until full.
- For administrators, the server's metrics under the **node_exporter** names (`node_cpu_seconds_total`, `node_memory_*`, `node_network_*`, `node_disk_*`, `node_filesystem_*`, `node_pressure_*`, `node_nf_conntrack_*`, `node_sockstat_*` and more), read directly from the kernel. The *Node Exporter Full* dashboard for Grafana works without installing a separate exporter; the hwmon, timex and systemd collectors are not included.

Prometheus asks for OpenMetrics and gets it; add `?format=openmetrics` to request it by hand. If MariaDB is down, `/metrics` keeps answering for an administrator's server-wide metrics token that the panel recently accepted, with `berth_database_up 0`, so your monitoring can tell you the database is the problem. Without the database you can also read the same numbers on the server with `berth stats live`.

> [!NOTE]
> The token is a secret. Store it in a file readable only by Prometheus, as above, rather than in the scrape config itself.

## Related

- [Uptime and status pages](https://www.berthpanel.app/library/uptime-and-status-pages/)
- [Notifications and alerts](https://www.berthpanel.app/library/notifications-and-alerts/), for alert rules on these metrics
- [Logs and log drains](https://www.berthpanel.app/library/logs-and-log-drains/)
- [REST API](https://www.berthpanel.app/library/rest-api/)
- [Home Assistant](https://www.berthpanel.app/library/home-assistant/), for a read-only status view in your home dashboard
