Statistics Server
Overview
Section titled “Overview”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.
Initialize credentials
Section titled “Initialize credentials”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:
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 the server
Section titled “Run the server”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.
sudo stat.flexfs init systemd --nowStart flags
Section titled “Start flags”See stat.flexfs start for the full list of flags and their defaults.
How it works
Section titled “How it works”- Admin servers periodically report volume usage statistics to the statistics server.
- The statistics server stores these reports in its database.
- 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.
- The database retains historical usage data for billing reconciliation.
Connection to the admin server
Section titled “Connection to the admin server”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.