#!/bin/bash
#
# test_drbd
#
# Schickt DRBD-Mirror-Status
#
if [[ $# -ge 2 ]]
 then
  DT="$1 $2"
else
  DT=`date '+%F %H:%M:00%:z'`
fi
#
awk '/^[ 0-9][0-9]:/{gsub(":","",$1);gsub("cs:", "", $2);gsub("st:", "", $3);gsub("ld:", "", $NF);print $1, $2, $3, $NF}' /proc/drbd 2>/dev/null | while read d c s l
 do
  send_test_value System "DRBD-Status:$d" cs $DT $c '_'
  send_test_value System "DRBD-Status:$d" st $DT $s '_'
  send_test_value System "DRBD-Status:$d" ld $DT $l '_'
done
