Skip to content

Statistics Server

The statistics server collects usage data from admin servers, tracks storage consumption over time, and generates billing reports. When SMTP is configured, it sends periodic email notifications with usage summaries.

The statistics server uses SMTP credentials for sending email notifications. Without them, no report email is sent. Initialize them as the user that runs the server; this writes ~/.flexfs/stat/creds in that user’s home folder:

Terminal window
stat.flexfs init creds \
--smtpAddr <smtp-host>:587 \
--smtpFrom <smtp-from> \
--smtpTo <smtp-to> \
--smtpUser <username> \
--smtpPass <password>

If --smtpPass is omitted, the command prompts for it on a terminal when an SMTP username is set (--smtpUser). An unauthenticated relay needs no username or password, and none is prompted for. With --smtpAddr, --smtpFrom and --smtpTo are required; without it, the other SMTP flags are refused.

If --marketplaceToken is omitted, the command also prompts on a terminal for a Marketplace API token. A token must be a UUID; leave it empty to disable the marketplace API.

See stat.flexfs init creds for the full list of flags and their defaults.

Run stat.flexfs start as any user. A non-root user needs a --bindAddr port above 1023, since the default is port 443.

Optionally, to run it as a root service that starts at boot, create a systemd unit. The service runs as root, so it reads /root/.flexfs/stat/creds unless --startFlags names another --credsFile; create the credentials with sudo stat.flexfs init creds.

Terminal window
sudo stat.flexfs init systemd --now

See stat.flexfs start for the full list of flags and their defaults.

  1. Admin servers periodically report volume usage statistics to the statistics server.
  2. The statistics server stores these reports in its database.
  3. At 03:01 UTC on the 1st of each month, it generates usage summaries for the previous month and sends them via email to the configured recipients.
  4. The database retains historical usage data for billing reconciliation.

The admin server reads the statistics server address from its credentials file, where admin.flexfs init creds --statAddr stores it when it differs from the default stat.flexfs.io. A file with no address uses the default. The internal --statAddr flag on admin.flexfs start overrides the file value. The admin server pushes usage reports to the statistics server over HTTPS.