Skip to content

Statistics Server

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

The statistics server requires SMTP credentials for sending email notifications. 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 interactively when an SMTP username is set (--smtpUser). An unauthenticated relay needs no username or password, and none is prompted for.

If --marketplaceToken is omitted, the command also prompts on a terminal for a Marketplace API token. Leave it empty to disable the marketplace API; a token must be at least 32 characters with no spaces.

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 (default stat.flexfs.io). The internal --statAddr flag on admin.flexfs start overrides the file value. The admin server pushes usage reports to the statistics server over HTTPS.