From 899aac977fcadf53df4e1c9d747bc62566d70acf Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 3 Jan 2024 09:21:24 +0000 Subject: [PATCH] add storage tracker script --- .gitea/workflows/publish.yml | 1 - storage-tracker.sh | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 storage-tracker.sh diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml index 0f865e7..90aa335 100644 --- a/.gitea/workflows/publish.yml +++ b/.gitea/workflows/publish.yml @@ -4,7 +4,6 @@ on: push: branches: - "master" - - "influx-only" jobs: docker: diff --git a/storage-tracker.sh b/storage-tracker.sh new file mode 100644 index 0000000..85e1c4b --- /dev/null +++ b/storage-tracker.sh @@ -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" \ No newline at end of file