#++++++++++++++++++++++++++++#
#++++Heartbeat Monitoring++++#
#++++++++++++++++++++++++++++#
#++++++Visibility Only+++++++#
UserParameter=heartbeat.node1_name[*],sudo cl_status listnodes | sed -n '1p'
UserParameter=heartbeat.node1_status[*],sudo cl_status listnodes | xargs -n 1 cl_status nodestatus | sed -n '1p'
UserParameter=heartbeat.node2_name[*],sudo cl_status listnodes | sed -n '2p'
UserParameter=heartbeat.node2_status[*],sudo cl_status listnodes | xargs -n 1 cl_status nodestatus | sed -n '2p'
#++++++Heatbeat Alerts+++++++#
UserParameter=heartbeat.status_alert[*],sudo /bin/sh -c 'if cl_status hbstatus > /dev/null 2>&1; then echo "1"; else echo "0"; fi'

#+++++++++++++++++++++++#
#++++DRBD Monitoring++++#
#+++++++++++++++++++++++#
UserParameter=drbd.discover,sudo drbdadm sh-resources|tr ' ' '\n'| awk 'BEGIN{printf "{\"data\":["}    ; /.*/ {printf c"{\"{#}\":\""$1"\"}";c=","}; END{print "]}"}'
UserParameter=drbd.cstate[*],sudo drbdadm cstate $1
UserParameter=drbd.dstate_local[*],sudo drbdadm dstate $1|cut -f1 -d/
UserParameter=drbd.dstate_remote[*],sudo drbdadm dstate $1|cut -f2 -d/
UserParameter=drbd.role_local[*],sudo drbdadm role $1|cut -f1 -d/
UserParameter=drbd.role_remote[*],sudo drbdadm role $1|cut -f2 -d/
UserParameter=drbd.device[*],sudo drbdadm sh-dev $1
UserParameter=drbd.ip[*],sudo drbdadm sh-ip $1
UserParameter=drbd.mdev[*],sudo drbdadm sh-md-dev $1
UserParameter=drbd.version,cat /proc/drbd |grep "^version: "|sed -e 's/^version: //g'
UserParameter=drbd.resource_status[*],sudo /bin/sh -c 'if drbdadm cstate $1 > /dev/null 2>&1; then echo "1"; else echo "0"; fi'

#++++++++++++++++++++++#
#++++LVM Monitoring++++#
#++++++++++++++++++++++#
UserParameter=lvm.pv_discover,sudo pvdisplay -c | awk -F: 'BEGIN {printf "{\"data\":["} {printf c"{\"{#PVNAME}\":\""$1"\"}"; c=","} END {print "]}"}'
UserParameter=lvm.pv_name[*],sudo pvs $1 --noheadings -o pv_name
UserParameter=lvm.pv_size[*],sudo pvs $1 --units b --noheadings -o pv_size | sed 's/B//'
UserParameter=lvm.pv_free[*],sudo pvs $1 --units b --noheadings -o pv_free | sed 's/B//'
UserParameter=lvm.vg_discover,sudo vgdisplay -c | awk -F: 'BEGIN {printf "{\"data\":["} {printf c"{\"{#VGNAME}\":\""$1"\"}"; c=","} END {print "]}"}'
UserParameter=lvm.vg_name[*],sudo vgs $1 --noheadings -o vg_name 
UserParameter=lvm.vg_size[*],sudo vgs $1 --units b --noheadings -o vg_size | sed 's/B//'
UserParameter=lvm.vg_free[*],sudo vgs $1 --units b --noheadings -o vg_free | sed 's/B//'
UserParameter=lvm.lv_discover,sudo lvdisplay -c | awk -F: 'BEGIN {printf "{\"data\":["} {printf c"{\"{#LVNAME}\":\""$1"\"}"; c=","} END {print "]}"}'
UserParameter=lvm.lv_name[*],sudo lvs $1 --noheadings -o lv_name
UserParameter=lvm.lv_size[*],sudo lvs $1 --units b --noheadings -o lv_size | sed 's/B//'

#++++++++++++++++++++++#
#++++XEN Monitoring++++#
#++++++++++++++++++++++#
UserParameter=xen.discover, sudo xl list | awk 'BEGIN {printf "{\"data\":["} NR>1 {printf c"{\"{#VMNAME}\":\""$1"\"}"; c=","} END {print "]}"}'
UserParameter=xen.xl_list[*], sudo xl list $1 | awk 'NR>1 {print $1}'
UserParameter=xen.vm_status[*],sudo /bin/sh -c 'if xl list $1 > /dev/null 2>&1; then echo "1"; else echo "0"; fi'
