Collect folder size with Telegraf

grafana
influxdb
telegraf
#1

Hey!

I have Telegraf, InfluxDB and Grafana set up and working. I’m wondering if it is possible to collect directory sizes (actual folders, not mounted drives).

Thanks in advance,
panzerschreck

#2

You could use a custom script with the exec plugin for this.

#3

I tried that before. The problem is, I didn’t figure out yet how to do that in a way that is not killing my CPU every X seconds. I tried using du -msh and similar commands. I just thought maybe there’s something as resource effective as the other collection plugins that Telegraf already supplies :slight_smile:

#4

Yeah, I can see how this could be a problem. Off the top of my head the only reasonable way to do this would be with a long lived process that watches the directory for changes and only updates the total as needed, which isn’t currently possible with the exec plugin. You may want to keep an eye on this issue.

Adding a mount at the point you want to monitor is probably going to cause the least amount of load.

#5

I’ll have an eye on that!

“Adding a mount at the point you want to monitor is probably going to cause the least amount of load.”

Well, the thing is I’m running Telegraf, InfluxDB and Grafana on unRAID using docker containers. unRAID distributes data on multiple disks and then creates a mount where all that data is brought together. If I create a mount point of subdirectories of that collective mount, Telegraf gives crude results. For example, my whole array has 15TB of usable storage. When I monitor one of the subfolders Grafana shows around 15GB of total space used and free. But I guess that’s an unRAID problem, not one with Telegraf / InfluxDB / Grafana.