diff --git a/modules/rhizo_base/files/collectd-hack b/modules/rhizo_base/files/collectd-hack index 22a490d..e76e396 100644 --- a/modules/rhizo_base/files/collectd-hack +++ b/modules/rhizo_base/files/collectd-hack @@ -13,8 +13,15 @@ is_empty () { exit fi if [ "$_o" == "" -o "$_o" == "0.0000000000e+00" -o "$_o" == "NaN" ] ;then - debug $1 "$2 is empty" - return 1 + _o=`rrdtool xport DEF:A=/var/lib/collectd/rrd/$(hostname -f)/$2:value:LAST XPORT:A -s -1min -m10 | xmllint --xpath 'string(xport/data/row[v>0]/v)' -` + if [ $? != 0 ] ; then + echo "Error. exiting." + exit + fi + if [ "$_o" == "" -o "$_o" == "0.0000000000e+00" -o "$_o" == "NaN" ] ;then + debug $1 "$2 is empty" + return 1 + fi fi if [ "$1" == "ne" ] ; then echo "$2 has data"