add storage tracker script

This commit is contained in:
Lee 2024-01-03 09:21:24 +00:00
parent d76c5a9131
commit 899aac977f
2 changed files with 12 additions and 1 deletions

@ -4,7 +4,6 @@ on:
push: push:
branches: branches:
- "master" - "master"
- "influx-only"
jobs: jobs:
docker: docker:

12
storage-tracker.sh Normal file

@ -0,0 +1,12 @@
usage_engine=$(du -s /home/tracker/influx/db/engine/data/setme/ | cut -f1)
usage_wal=$(du -s /home/tracker/influx/db/engine/wal/setme/ | cut -f1)
# Calculate the sum of usage_engine and usage_wal
total_usage=$((usage_engine + usage_wal))
docker exec influxdb influx write \
--org homelab \
--bucket influx_metrics \
--token setme \
--precision s \
"storage_usage,db=mc-tracker value=$total_usage"