This is a continuous collector that uses the hadoop fs -du -s /hbase/*
command to get details about the HDFS disk usage. This metric is very useful for tracking space in an OpenTSDB system.
#!/bin/bash
while true; do
while read -r bytes raw_bytes path; do
echo "hdfs.du $(date +"%s") $bytes path=$path"
#https://community.cloudera.com/t5/Storage-Random-Access-HDFS/hdfs-du-format-change/td-p/27192 KMB 2015-08-24T12:01:20Z
echo "hdfs.du.raw $(date +"%s") $raw_bytes path=$path"
done < <(hadoop fs -du -s /hbase/*)
sleep 30
done