CLICKHOUSE_URL. NervesHub calls this “analytics” in its code and in its messages to users.
What is missing without ClickHouse
Extensions that are not offered
Three extensions report as disabled whenCLICKHOUSE_URL is unset, so NervesHub does not attach them to any device:
The Health, Geo, Alarms, Local Shell and Network Identity extensions do not depend on ClickHouse. See Extensions overview.
Pages and data
Health status
With ClickHouse, NervesHub judges each device against its product’s health profile, over a window of stored readings. Without ClickHouse, health profiles are not evaluated. NervesHub instead checks the values in each health report against fixed thresholds:API
What keeps working
Current metric values, the devices list’s metrics filter andmetric: advanced queries read PostgreSQL. They work without ClickHouse, using the metrics devices report through the Health extension.
Enable it
1
Run a ClickHouse server
Use a ClickHouse server or a managed service that every NervesHub node can reach. Create a database for NervesHub.
2
Set the URL
Set If your ClickHouse presents a certificate from a private CA, also set
CLICKHOUSE_URL on every node, with the user, password, host, port and database:CLICKHOUSE_CA_PEM to the base64-encoded PEM bundle of that CA.3
Restart the nodes
Each node connects at boot and runs any pending ClickHouse migrations.
Check that it works
- Open a device’s Data History tab. It lists the device’s messages instead of the “Analytics aren’t enabled” notice.
- Turn on the Logging extension for a product, then open the Logs tab of one of its devices. See Logging.
- Open the device’s Health tab after it has reported. The charts show readings stored since you connected ClickHouse.
Variables
All of these are only read in a production release, and only whenCLICKHOUSE_URL is set.
Health evaluation also uses analytics connections. Each running evaluation holds one, so keep
HEALTH_EVALUATION_CONCURRENCY below ANALYTICS_POOL_SIZE multiplied by ANALYTICS_POOL_COUNT. Unset, it is half the analytics pool, and at most 10. The node logs a warning at boot if the concurrency is not below the pool.
Writes are buffered on each node and sent in batches. A page can take a moment to show something a device just sent.
Migrations
ClickHouse has its own migrations, separate from the PostgreSQL ones. They live inpriv/analytics_repo/migrations in the NervesHub source.
With ANALYTICS_AUTO_MIGRATOR=true, the default, each node runs pending ClickHouse migrations when it boots.
If you set ANALYTICS_AUTO_MIGRATOR=false, run migrations yourself before starting the new version:
CLICKHOUSE_URL is set.
NervesHub creates its tables with the MergeTree family of engines, and sets MergeTree as the default table engine, which ClickHouse Cloud requires.
Retention
Each ClickHouse table has a time to live (TTL) written into its definition when the migration creates it. ClickHouse deletes rows older than the TTL on its own. None of these TTLs follows an environment variable.
Two environment variables look like they control retention and do not:
EXTENSIONS_LOGGING_DAYS_TO_KEEP(default3) is read at boot, but no code on main uses the value. Device logs follow the 3 day TTL ofdevice_log_lines.HEALTH_CHECK_DAYS_TO_RETAIN(default7) is read at boot, but no code on main uses the value. Metric history follows the 30 day TTL ofdevice_metrics.

