glensc / nagios-plugin-check_raid

Nagios/Icinga/Sensu plugin to check current server's RAID status ⛺
144 stars 84 forks source link

[bug] with parsing mdadm output => Unexpected parse #199

Open aplufr opened 4 years ago

aplufr commented 4 years ago

Plugin report an unexpected parse error when executing.

Tried with 4.0.9 (from Debian 10) and 4.0.10 (from this git).

Output of check_raid -d:

# perl ./check_raid.pl -d
check_raid 4.0.10
Visit <https://github.com/glensc/nagios-plugin-check_raid#reporting-bugs> how to report bugs
Please include output of **ALL** commands in bugreport

DEBUG EXEC: /sbin/dmsetup status --noflush at ./check_raid.pl line 503.
DEBUG EXEC: /proc/mdstat at ./check_raid.pl line 503.
Unexpected parse at ./check_raid.pl line 3578, <$fh> line 2.

Output of cat /proc/mdstat:

# cat /proc/mdstat
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sda3[2] sdc3[3](W)(R) sdb3[0]
      976015360 blocks super 1.2 [2/3] [UU]
      [===>.................]  check = 15.6% (152996864/976015360) finish=153.2min speed=89504K/sec
      bitmap: 2/8 pages [8KB], 65536KB chunk

md1 : active raid1 sdc2[3](W)(S) sda2[2] sdb2[0]
      409280 blocks super 1.2 [2/2] [UU]

unused devices: <none>

After giving a look at the code, I suspect that's because disk sdc3 have two flags: W (write-mostly) and R (recovery) or S (spare) but I'm not good in perl.