summaryrefslogtreecommitdiffstats
path: root/Monitor.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-12-14 17:31:25 +1100
committerNeil Brown <neilb@suse.de>2006-12-14 17:31:25 +1100
commit37dfc3d638aee1fe3ae6d6b4aa0e648e1a9d61ca (patch)
tree76f3fab53edd53f03fa76149c78ab3451cf7f449 /Monitor.c
parentb90c0e9a12090c435f23da8378b3436c93f77f2f (diff)
downloadmdadm-37dfc3d638aee1fe3ae6d6b4aa0e648e1a9d61ca.tar.gz
mdadm-37dfc3d638aee1fe3ae6d6b4aa0e648e1a9d61ca.tar.xz
mdadm-37dfc3d638aee1fe3ae6d6b4aa0e648e1a9d61ca.zip
When resync finished, report the mismatch count if there is one.
This doesn't get mailed out, but will appear in syslog... Maybe it should be mailed if it was a 'check' or 'repair' pass...
Diffstat (limited to 'Monitor.c')
-rw-r--r--Monitor.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/Monitor.c b/Monitor.c
index 5091c51..f7bb48c 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -303,8 +303,22 @@ int Monitor(mddev_dev_t devlist,
if (mse &&
mse->percent == -1 &&
- st->percent >= 0)
- alert("RebuildFinished", dev, NULL, mailaddr, mailfrom, alert_cmd, dosyslog);
+ st->percent >= 0) {
+ /* Rebuild/sync/whatever just finished.
+ * If there is a number in /mismatch_cnt,
+ * we should report that.
+ */
+ struct sysarray *sra =
+ sysfs_read(-1, st->devnum, GET_MISMATCH);
+ if (sra && sra->mismatch_cnt > 0) {
+ char cnt[40];
+ sprintf(cnt, " mismatches found: %d", sra->mismatch_cnt);
+ alert("RebuildFinished", dev, cnt, mailaddr, mailfrom, alert_cmd, dosyslog);
+ } else
+ alert("RebuildFinished", dev, NULL, mailaddr, mailfrom, alert_cmd, dosyslog);
+ if (sra)
+ free(sra);
+ }
if (mse)
st->percent = mse->percent;
@@ -510,8 +524,10 @@ static void alert(char *event, char *dev, char *disc, char *mailaddr, char *mail
fprintf(mp, "A %s event had been detected on md device %s.\n\n", event, dev);
- if (disc)
+ if (disc && disc[0] != ' ')
fprintf(mp, "It could be related to component device %s.\n\n", disc);
+ if (disc && disc[0] == ' ')
+ fprintf(mp, "Extra information:%s.\n\n", disc);
fprintf(mp, "Faithfully yours, etc.\n");