From e4f60eb438e4f62bb7289181776aa6d1b774fd64 Mon Sep 17 00:00:00 2001 From: bugwz Date: Thu, 29 Aug 2024 22:50:07 +0800 Subject: [PATCH] mgr/dashboard: alerts module supports setting multiple email recipients Signed-off-by: bugwz --- doc/mgr/alerts.rst | 3 ++- src/pybind/mgr/alerts/module.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/mgr/alerts.rst b/doc/mgr/alerts.rst index 319d9d9278701..8428424a371a3 100644 --- a/doc/mgr/alerts.rst +++ b/doc/mgr/alerts.rst @@ -23,7 +23,8 @@ The *alerts* module is enabled with:: Configuration ------------- -To configure SMTP, all of the following config options must be set:: +To configure SMTP, all of the following config options must be set +(When setting ``mgr/alerts/smtp_destination``, you can use commas to separate multiple):: ceph config set mgr mgr/alerts/smtp_host ** ceph config set mgr mgr/alerts/smtp_destination ** diff --git a/src/pybind/mgr/alerts/module.py b/src/pybind/mgr/alerts/module.py index f20f047162d01..50ec520d346e1 100644 --- a/src/pybind/mgr/alerts/module.py +++ b/src/pybind/mgr/alerts/module.py @@ -28,7 +28,7 @@ class Alerts(MgrModule): Option( name='smtp_destination', default='', - desc='Email address to send alerts to', + desc='Email address to send alerts to, use commas to separate multiple', runtime=True), Option( name='smtp_port', @@ -243,7 +243,7 @@ class Alerts(MgrModule): server = smtplib.SMTP(self.smtp_host, self.smtp_port) if self.smtp_password: server.login(self.smtp_user, self.smtp_password) - server.sendmail(self.smtp_sender, self.smtp_destination, message) + server.sendmail(self.smtp_sender, self.smtp_destination.split(','), message) server.quit() except Exception as e: return { -- 2.39.5