summaryrefslogtreecommitdiff
blob: 1e0b46eadca31cadef2e82c53dd8cf27a98ac69a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
From 226f1bda813f15e4b977da95e420ec09ff10eac9 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Thu, 7 Apr 2011 19:59:21 -0400
Subject: [PATCH 2/4] mdadm: add missing --syslog option to monitor help

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 ReadMe.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/ReadMe.c b/ReadMe.c
index 00b24d4..57c10f3 100644
--- a/ReadMe.c
+++ b/ReadMe.c
@@ -506,6 +506,7 @@ char Help_monitor[] =
 "  --mail=       -m   : Address to mail alerts of failure to\n"
 "  --program=    -p   : Program to run when an event is detected\n"
 "  --alert=           : same as --program\n"
+"  --syslog      -y   : Report alerts via syslog\n"
 "  --increment=  -r   : Report RebuildNN events in the given increment. default=20\n"
 "  --delay=      -d   : seconds of delay between polling state. default=60\n"
 "  --config=     -c   : specify a different config file\n"
-- 
1.7.4.1

From 38cf2f1179517e54c54cbed85f76950ea9e918ea Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Thu, 7 Apr 2011 20:02:05 -0400
Subject: [PATCH 3/4] mdadm: respect --syslog in monitor mode

A few places don't accept syslog as a monitor mode, so fix that.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 Monitor.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Monitor.c b/Monitor.c
index 337785d..a3ea724 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -143,7 +143,7 @@ int Monitor(struct mddev_dev *devlist,
 			fprintf(stderr, Name ": Monitor using program \"%s\" from config file\n",
 			       alert_cmd);
 	}
-	if (scan && !mailaddr && !alert_cmd) {
+	if (scan && !mailaddr && !alert_cmd && !dosyslog) {
 		fprintf(stderr, Name ": No mail address or alert command - not monitoring.\n");
 		return 1;
 	}
@@ -335,7 +335,7 @@ static void alert(char *event, char *dev, char *disc, struct alert_info *info)
 {
 	int priority;
 
-	if (!info->alert_cmd && !info->mailaddr) {
+	if (!info->alert_cmd && !info->mailaddr && !info->dosyslog) {
 		time_t now = time(0);
 
 		printf("%1.15s: %s on %s %s\n", ctime(&now)+4, event, dev, disc?disc:"unknown device");
-- 
1.7.4.1