Fix metric name in directory size text collector example

The directory size text collector example uses the wrong metric name in the HELP and TYPE lines rendering the comments unusable.

This fixes that by using the same metric name.

Signed-off-by: Sandor Zeestraten <sandor@zeestrataca.com>
This commit is contained in:
Sandor Zeestraten 2018-05-19 20:52:59 +02:00
parent 699b6d7f15
commit 578d814744

View file

@ -9,7 +9,7 @@
# sed pattern taken from https://www.robustperception.io/monitoring-directory-sizes-with-the-textfile-collector/ # sed pattern taken from https://www.robustperception.io/monitoring-directory-sizes-with-the-textfile-collector/
# #
# Author: Antoine Beaupré <anarcat@debian.org> # Author: Antoine Beaupré <anarcat@debian.org>
echo "# HELP anarcat_dir_space_bytes Disk space used by some directories" echo "# HELP node_directory_size_bytes Disk space used by some directories"
echo "# TYPE anarcat_dir_space_bytes gauge" echo "# TYPE node_directory_size_bytes gauge"
du --block-size=1 --summarize "$@" \ du --block-size=1 --summarize "$@" \
| sed -ne 's/\\/\\\\/;s/"/\\"/g;s/^\([0-9]\+\)\t\(.*\)$/node_directory_size_bytes{directory="\2"} \1/p' | sed -ne 's/\\/\\\\/;s/"/\\"/g;s/^\([0-9]\+\)\t\(.*\)$/node_directory_size_bytes{directory="\2"} \1/p'