#!/bin/bash

now=$(date '+s/$/ %s/')

cat << EOF
# HELP mdadm_monitor Follows events on the arrays.
# TYPE mdadm_monitor gauge
EOF
mdadm --monitor --scan --test --oneshot -p /bin/echo \
  | awk '{print("mdadm_monitor{event=\"" $1 "\",device=\"" $2 "\"}");}' \
  | sed "$now"