diff options
author | Kinga Tanska <kinga.tanska@intel.com> | 2022-06-06 12:32:13 +0200 |
---|---|---|
committer | Jes Sorensen <jsorensen@fb.com> | 2022-06-14 16:36:03 +0200 |
commit | f5ff2988761625b43eb15555993f2797af29f166 (patch) | |
tree | 27fd585c9a74b5e51baa0b03a56b668e02ae7f3d /Monitor.c | |
parent | Mdmonitor: Fix segfault (diff) | |
download | mdadm-f5ff2988761625b43eb15555993f2797af29f166.tar.xz mdadm-f5ff2988761625b43eb15555993f2797af29f166.zip |
Mdmonitor: Improve logging method
Change logging, and as a result, mdmonitor in verbose
mode will report its configuration.
Signed-off-by: Kinga Tanska <kinga.tanska@intel.com>
Signed-off-by: Oleksandr Shchirskyi <oleksandr.shchirskyi@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to 'Monitor.c')
-rw-r--r-- | Monitor.c | 25 |
1 files changed, 14 insertions, 11 deletions
@@ -136,24 +136,27 @@ int Monitor(struct mddev_dev *devlist, struct mddev_ident *mdlist; int delay_for_event = c->delay; - if (!mailaddr) { + if (!mailaddr) mailaddr = conf_get_mailaddr(); - if (mailaddr && ! c->scan) - pr_err("Monitor using email address \"%s\" from config file\n", - mailaddr); - } - mailfrom = conf_get_mailfrom(); - if (!alert_cmd) { + if (!alert_cmd) alert_cmd = conf_get_program(); - if (alert_cmd && !c->scan) - pr_err("Monitor using program \"%s\" from config file\n", - alert_cmd); - } + + mailfrom = conf_get_mailfrom(); + if (c->scan && !mailaddr && !alert_cmd && !dosyslog) { pr_err("No mail address or alert command - not monitoring.\n"); return 1; } + + if (c->verbose) { + pr_err("Monitor is started with delay %ds\n", c->delay); + if (mailaddr) + pr_err("Monitor using email address %s\n", mailaddr); + if (alert_cmd) + pr_err("Monitor using program %s\n", alert_cmd); + } + info.alert_cmd = alert_cmd; info.mailaddr = mailaddr; info.mailfrom = mailfrom; |