Unreliable InfluxDB size sensor

All going swimmingly.

So, to wrap it all up. Use this init_command in the SSH & Web Terminal addon with protection mode disabled:

init_commands:
  - >-
    while [ 1 = 1 ]; do docker exec addon_a0d7b954_influxdb du -s
    /data/influxdb/data/homeassistant >
    /config/file_sensors/ha_influx_db_size.txt && sleep 300; done &

Then create this file sensor:

- platform: file
  name: 'InfluxDB HA DB Size'
  file_path: '/config/file_sensors/ha_influx_db_size.txt'
  unit_of_measurement: 'MB'
  value_template: "{{ (value.split('\t')[0]|int/1000)|round(3) }}"

You can then disable the InfluxDB internal database if you wish (recommended by InfluxDB).

To do so, in the Influxdb addon configuration add this:

envvars:
  - name: INFLUXDB_MONITOR_STORE_ENABLED
    value: "false"

Don’t expect it to be as active as the shard method. I only see an increase every day or two.

2 Likes