Mdadm raid 5 monitor


is there a way to monitor the mdadm (linux) raid health with HA?



I use Netdata for one of my system monitoring solutions, it natively monitors mdstat. There are 4 ways to get those metrics.

Scrape the web page
Export to a time series database then read that directly from HA
Set up an alert in Netdata, then monitor that alert platform in HA (less cpu usage)
OR the easiest, the local JSON REST api

This is the url that pulls the amount of failed disks:

and returns this data which you parse:

   "api": 1,
   "id": "mdstat.mdstat_health",
   "name": "mdstat.mdstat_health",
   "view_update_every": 600,
   "update_every": 1,
   "first_entry": 1618544491,
   "last_entry": 1618631481,
   "before": 1618631400,
   "after": 1618630801,
   "dimension_names": ["md126"],
   "dimension_ids": ["md126"],
   "latest_values": [0],
   "view_latest_values": [0],
   "dimensions": 1,
   "points": 1,
   "format": "json",
   "result": {
 "labels": ["time", "md126"],
      [ 1618631400, 0]
 "min": 0,
 "max": 0

The latest_values array gives you the current failed disk count to match the array of the mdraid arrays from dimension_names, if it is anything but 0s you have a problem. dimensions will match the amount of raid arrays you have in mdraid, so use that value as the size of the arrays.

thx for the answer.

i have netdata installed, but no mdstat on mine :frowning: i’m trying to find out why and how.

it is part of the proc plugin should just read the output of proc/mdstat if it exists

yes, i know, but it doesn’t show up.

solved. was using 1.9.0, update to 1.30.1 and it’s working. thx!