MD Softraid Service does not differentiate

…between a normal scheduled check and a (forced) resync/resilvering process.

Hey guys,

I have machines with Softraids (mdadm). According to /etc/cron.d/mdadm every sunday morning, the raid will check if everything is mirrored properly, by running some routine consistency checks.

The MD Softraid Service is not able to differentiate this and gives me a warning.
However, it can be clearly seen by running mdadm --detail /dev/mdX | grep State that the array is clean.

I suggest to check the line for clean (ok) or degraded (warn) and provide a patch for this service check.

Details:
Output of check plugin WARN - Status: active, Spare: 0, Failed: 0, Active: 2, Status: 2/2, UU, [Resync/Recovery] Finish: 251.5min, Speed: 51986K/secWARN

root@hetzner ~ # mdadm --detail /dev/md1
/dev/md1:
        Version : 1.2
  Creation Time : Wed Apr 13 10:09:16 2016
     Raid Level : raid1
     Array Size : 2928036288 (2792.39 GiB 2998.31 GB)
  Used Dev Size : 2928036288 (2792.39 GiB 2998.31 GB)
   Raid Devices : 2
  Total Devices : 2
    Persistence : Superblock is persistent

  Intent Bitmap : Internal

    Update Time : Sun Sep 13 15:02:49 2020
          State : clean, checking
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

   Check Status : 72% complete

           Name : rescue:1
           UUID : 85a3f6f0:2a8ec0e8:5e643266:da9b7413
         Events : 1063228

    Number   Major   Minor   RaidDevice State
       0       8        2        0      active sync   /dev/sda2
       2       8       18        1      active sync   /dev/sdb2

Also, it would be great if the percentage could also be shown.

As it seems, I was not the only one with this issue and there already is an attempt to fix it: https://github.com/tribe29/checkmk/pull/222

Also this thread is related: Mdadm - check causing warning

Werk #11340: md-raid: add detection for check-state

Nice!