summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2013-04-18 21:01:05 +0200
committerFlorian Pritz <bluewind@xinu.at>2013-04-18 21:01:05 +0200
commitb4d77c4403600680c8b8c0f7aa824a0f3d2bad24 (patch)
tree60a17aab16bf498a5e3e9503e2f93738456d6035 /extras
parent05b58916b25d4ff3cada5d7e78e4a6cf6de1058a (diff)
Add munin plugin
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'extras')
-rw-r--r--extras/munin/filebin_stats25
1 files changed, 25 insertions, 0 deletions
diff --git a/extras/munin/filebin_stats b/extras/munin/filebin_stats
new file mode 100644
index 000000000..f638ecc4b
--- /dev/null
+++ b/extras/munin/filebin_stats
@@ -0,0 +1,25 @@
+#!/bin/bash
+#
+# Put something along those lines into your munin-node config
+#
+# [filebin_stats]
+# env.mysqlopts --defaults-file=/var/lib/munin/.my.cnf
+# env.database filebin
+
+case $1 in
+ config)
+ cat <<'EOM'
+graph_title FileBin
+graph_args --base 1024 --logarithmic --units=si
+graph_vlabel Space
+used.label Storage used
+dedup.label Storage saved by deduplication
+EOM
+ exit 0;;
+esac
+
+echo -n "used.value "
+mysql $mysqlopts -sr $database <<<"select sum(filesize) as 'Used storage' from (select filesize from files group by hash) a;" || echo "a"
+
+echo -n "dedup.value "
+mysql $mysqlopts -sr $database <<<"select sum((c - 1) * sub.filesize) 'Space saved by deduplication' from (select hash, filesize, count(*) c from files group by hash having c > 1 order by c) sub;" || echo "a"