]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Add a copy of /proc/mdstat to the mail message send by mdadm --monitor.
authorNeil Brown <neilb@suse.de>
Fri, 19 May 2006 03:58:45 +0000 (03:58 +0000)
committerNeil Brown <neilb@suse.de>
Fri, 19 May 2006 03:58:45 +0000 (03:58 +0000)
Signed-off-by: Neil Brown <neilb@suse.de>
ChangeLog
Monitor.c

index fe22413a3affaba6d779f1e625a2d225a87be2ee..79a4322e3ba38d50a2b796147d11dd057d1b4c35 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,8 @@ Changes Prior to this release
        in report.
     -   When using --update=uuid on an array with a bitmap, update the
        bitmap's uuid too.
+    -   Add a copy of /proc/mdstat to the mail message send by mdadm
+        --monitor.
 
 Changes Prior to 2.4.1 release
     -   Honour --write-mostly when adding to an array without persistent
index 306c43cfe8e118f4a2d05776475dafe1467d5d17..6bc7ea16e2dc0a7cdc6dd362d668d2017df8a775 100644 (file)
--- a/Monitor.c
+++ b/Monitor.c
@@ -493,6 +493,7 @@ static void alert(char *event, char *dev, char *disc, char *mailaddr, char *mail
             strncmp(event, "Degrade", 7)==0)) {
                FILE *mp = popen(Sendmail, "w");
                if (mp) {
+                       FILE *mdstat;
                        char hname[256];
                        gethostname(hname, sizeof(hname));
                        signal(SIGPIPE, SIG_IGN);
@@ -512,6 +513,16 @@ static void alert(char *event, char *dev, char *disc, char *mailaddr, char *mail
                                fprintf(mp, "It could be related to component device %s.\n\n", disc);
 
                        fprintf(mp, "Faithfully yours, etc.\n");
+
+                       mdstat = fopen("/proc/mdstat", "r");
+                       if (mdstat) {
+                               char buf[8192];
+                               int n;
+                               fprintf(mp, "\nP.S. The /proc/mdstat file current contains the following:\n\n");
+                               while ( (n=fread(buf, 1, sizeof(buf), mdstat)) > 0)
+                                       fwrite(buf, 1, n, mp);
+                               fclose(mdstat);
+                       }
                        fclose(mp);
                }