summaryrefslogtreecommitdiffstats
path: root/Monitor.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-05-19 03:58:45 +0000
committerNeil Brown <neilb@suse.de>2006-05-19 03:58:45 +0000
commit008e1100b80c571427ba8230bf04928ba0de8bcb (patch)
treec0c7a5fde11d63102ebc177e098159d8e3b6cbc9 /Monitor.c
parent751406f361dd6d4d8d9253bf580120f17f61dcbd (diff)
downloadmdadm-008e1100b80c571427ba8230bf04928ba0de8bcb.tar.gz
mdadm-008e1100b80c571427ba8230bf04928ba0de8bcb.tar.xz
mdadm-008e1100b80c571427ba8230bf04928ba0de8bcb.zip
Add a copy of /proc/mdstat to the mail message send by mdadm --monitor.
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'Monitor.c')
-rw-r--r--Monitor.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/Monitor.c b/Monitor.c
index 306c43c..6bc7ea1 100644
--- 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);
}