# Can I query the size of a database in influx db?

**URL:** <https://discourse.nodered.org/t/can-i-query-the-size-of-a-database-in-influx-db/48983>\
**Category:** General\
**Created:** [27 July 2021 21:41 UTC](https://discourse.nodered.org/t/can-i-query-the-size-of-a-database-in-influx-db/48983 "2021-07-27T21:41:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikefila](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mikefila/32/95223_2.png) [@mikefila](https://discourse.nodered.org/u/mikefila)\
**Post date:** [27 July 2021 21:41 UTC](https://discourse.nodered.org/t/can-i-query-the-size-of-a-database-in-influx-db/48983/1 "2021-07-27T21:41:39Z")

</div>

I looked through the influx nodes and I can't find an example of how to get the total size of a particular db. Is this possible, I'm using 1.x databases.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [28 July 2021 01:11 UTC](https://discourse.nodered.org/t/can-i-query-the-size-of-a-database-in-influx-db/48983/2 "2021-07-28T01:11:02Z")

</div>

Influx doesn't report its size directly I don't think but something like the following command should do the trick:

```bash
sudo du -sh /var/lib/influxdb/data/

```

It is possible to run that from node-red if you add the command to sudoers so that it doesn't require a password to run.

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [28 July 2021 18:05 UTC](https://discourse.nodered.org/t/can-i-query-the-size-of-a-database-in-influx-db/48983/3 "2021-07-28T18:05:45Z")

</div>

You can get the the total size of the dbase [InfluxDb usage statistics - Store - InfluxData Community](https://community.influxdata.com/t/influxdb-usage-statistics/779) from the \_internal database.  
However I think the solution provided by TotallyInformation is much easier.

---

<div class="post-metadata">

**Author:** ![mikefila](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mikefila/32/95223_2.png) [@mikefila](https://discourse.nodered.org/u/mikefila)\
**Post date:** [28 July 2021 23:08 UTC](https://discourse.nodered.org/t/can-i-query-the-size-of-a-database-in-influx-db/48983/4 "2021-07-28T23:08:33Z")

</div>

I want to thank everyone for the replies. I am already using a `sudo du` sensor in home assistant which works. Because of HA's container structure it's a bit convoluted.

I was hoping that this was built into one of the nodes, I'm surprised how difficult it is. Executing a command from NR to influx under HA's OS will probably be worse, so I'm just going to leave it as is.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [11 August 2021 23:09 UTC](https://discourse.nodered.org/t/can-i-query-the-size-of-a-database-in-influx-db/48983/5 "2021-08-11T23:09:12Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
