]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Monitor.c
Just updaqte copyright dates and email address
[thirdparty/mdadm.git] / Monitor.c
index d52b418293e34212191322243653bdb25e734201..c94bfd85d6e188d8710c6cc764a12751cfd2cac1 100644 (file)
--- a/Monitor.c
+++ b/Monitor.c
@@ -1,7 +1,7 @@
 /*
  * mdadm - manage Linux "md" devices aka RAID arrays.
  *
- * Copyright (C) 2001-2002 Neil Brown <neilb@cse.unsw.edu.au>
+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
  *
  *
  *    This program is free software; you can redistribute it and/or modify
@@ -489,9 +489,11 @@ static void alert(char *event, char *dev, char *disc, char *mailaddr, char *mail
        if (mailaddr && 
            (strncmp(event, "Fail", 4)==0 || 
             strncmp(event, "Test", 4)==0 ||
+            strncmp(event, "Spares", 6)==0 ||
             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);
@@ -511,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);
                }
 
@@ -527,7 +539,8 @@ static void alert(char *event, char *dev, char *disc, char *mailaddr, char *mail
                        priority = LOG_CRIT;
                /* Good to know about, but are not failures: */
                else if (strncmp(event, "Rebuild", 7)==0 ||
-                        strncmp(event, "MoveSpare", 9)==0)
+                        strncmp(event, "MoveSpare", 9)==0 ||
+                        strncmp(event, "Spares", 6) != 0)
                        priority = LOG_WARNING;
                /* Everything else: */
                else