q1x / zabbix-templates

My collection of Zabbix Templates
54 stars 50 forks source link

[linux-md] vfs.md.level breaks when auto-read-only comes up #11

Open charlesgoyard opened 5 years ago

charlesgoyard commented 5 years ago

Hi, when /proc/mdstat contains the following the (auto-read-only) flag, the vfs.md.level item breaks.

Personalities : [raid1] [raid6] [raid5] [raid4]
md0 : active (auto-read-only) raid1 sdb1[0] sdc1[1]
      9767424 blocks [2/2] [UU]

md1 : active raid5 sda6[0] sdf6[5] sde6[4] sdd6[3] sdc6[2] sdb6[1]
      1357371520 blocks level 5, 64k chunk, algorithm 2 [6/6] [UUUUUU]

unused devices: <none>

These expressions work:

UserParameter=vfs.md.level[*], sed -n -r -e "s/^$1 *:.* raid([[:digit:]]+).*$/\1/p" /proc/mdstat
UserParameter=vfs.md.level[*], grep "^$1 *:" /proc/mdstat | grep -o 'raid[0-9][0-9]*' | grep -o '[0-9]'

Thanks, Charles