I have a whole topic discussing that.
In short yes.
You need an mqtt broker connected to home assistant and the SSH & web terminal addon with protection mode disabled. You then add this option to your SSH & web terminal addon configuration:
init_commands:
- >-
while [ 1 = 1 ]; do docker exec addon_a0d7b954_influxdb du -s
/data/influxdb/data/homeassistant | mosquitto_pub -t
home-assistant/sensor/dbsize -r -u <user> -P <password> -l && sleep
300; done &
Replacing <user> and <password> with your mqtt broker connection credentials.
Then add this sensor to home assistant:
mqtt:
sensor:
- name: InfluxDB DB Size
unit_of_measurement: 'MB'
icon: hass:chart-line
state_topic: "home-assistant/sensor/dbsize"
value_template: "{{ (value.split('\t')[0]|int(0)/1000)|round(3) }}"