linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix mdmonitor-oneshot.service fail to be executed
@ 2023-06-07  6:57 Guanqin Miao
  2023-06-07  7:58 ` Paul Menzel
  2023-06-07 11:05 ` Mariusz Tkaczyk
  0 siblings, 2 replies; 3+ messages in thread
From: Guanqin Miao @ 2023-06-07  6:57 UTC (permalink / raw)
  To: jes, mariusz.tkaczyk, pmenzel, linux-raid
  Cc: linfeilong, lixiaokeng, louhongxiang, miaoguanqin

When we start mdmonitor-oneshot.service, we found an fail 
for mdmonitor-oneshot.service:

mdadm: No mail address or alert command - not monitoring

According to the error information, We modified the Environment 
field and added the syslog parameter.The service can be 
executed successfully.
---
 systemd/mdmonitor-oneshot.service | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/systemd/mdmonitor-oneshot.service b/systemd/mdmonitor-oneshot.service
index ba86b44e..032b8aad 100644
--- a/systemd/mdmonitor-oneshot.service
+++ b/systemd/mdmonitor-oneshot.service
@@ -10,7 +10,7 @@ Description=Reminder for degraded MD arrays
 Documentation=man:mdadm(8)
 
 [Service]
-Environment=MDADM_MONITOR_ARGS=--scan
+Environment=MDADM_MONITOR_ARGS="--scan --syslog"
 EnvironmentFile=-/run/sysconfig/mdadm
 ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh
 ExecStart=BINDIR/mdadm --monitor --oneshot $MDADM_MONITOR_ARGS
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix mdmonitor-oneshot.service fail to be executed
  2023-06-07  6:57 [PATCH] Fix mdmonitor-oneshot.service fail to be executed Guanqin Miao
@ 2023-06-07  7:58 ` Paul Menzel
  2023-06-07 11:05 ` Mariusz Tkaczyk
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Menzel @ 2023-06-07  7:58 UTC (permalink / raw)
  To: Guanqin Miao
  Cc: jes, mariusz.tkaczyk, linux-raid, linfeilong, lixiaokeng,
	louhongxiang

Dear Guanqin,


Thank you very much for your patch.

Am 07.06.23 um 08:57 schrieb Guanqin Miao:

For the commit message summary/title I’d suggest:

mdmonitor-oneshot.service: Pass `--syslog` to fix start failure

> When we start mdmonitor-oneshot.service, we found an fail

a fail

> for mdmonitor-oneshot.service:

Maybe even:

mdmonitor-oneshot.service fails with the error below:

> mdadm: No mail address or alert command - not monitoring
> 
> According to the error information, We modified the Environment

s/We/we/

> field and added the syslog parameter.The service can be

s/added/add/
Please add a space after the dot/period.

> executed successfully.

Maybe:

Pass the switch `--syslog`, so alerts are reported to syslog and not by 
email or an alert program.

> ---
>   systemd/mdmonitor-oneshot.service | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/systemd/mdmonitor-oneshot.service b/systemd/mdmonitor-oneshot.service
> index ba86b44e..032b8aad 100644
> --- a/systemd/mdmonitor-oneshot.service
> +++ b/systemd/mdmonitor-oneshot.service
> @@ -10,7 +10,7 @@ Description=Reminder for degraded MD arrays
>   Documentation=man:mdadm(8)
>   
>   [Service]
> -Environment=MDADM_MONITOR_ARGS=--scan
> +Environment=MDADM_MONITOR_ARGS="--scan --syslog"

Isn’t it more idiomatic for systemd to capture standard out and standard 
error directly? Adding `--syslog` here would add an unwanted redirection?

>   EnvironmentFile=-/run/sysconfig/mdadm
>   ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh
>   ExecStart=BINDIR/mdadm --monitor --oneshot $MDADM_MONITOR_ARGS

Could mdadm be fixed to allow to be started without email or alert program?


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix mdmonitor-oneshot.service fail to be executed
  2023-06-07  6:57 [PATCH] Fix mdmonitor-oneshot.service fail to be executed Guanqin Miao
  2023-06-07  7:58 ` Paul Menzel
@ 2023-06-07 11:05 ` Mariusz Tkaczyk
  1 sibling, 0 replies; 3+ messages in thread
From: Mariusz Tkaczyk @ 2023-06-07 11:05 UTC (permalink / raw)
  To: Guanqin Miao
  Cc: jes, pmenzel, linux-raid, linfeilong, lixiaokeng, louhongxiang

On Wed, 7 Jun 2023 14:57:34 +0800
Guanqin Miao <miaoguanqin@huawei.com> wrote:

> When we start mdmonitor-oneshot.service, we found an fail 
> for mdmonitor-oneshot.service:
> 
> mdadm: No mail address or alert command - not monitoring
> 
> According to the error information, We modified the Environment 
> field and added the syslog parameter.The service can be 
> executed successfully.
> ---
Hi Guanqin,

I'm against this approach because systemd service should contains
parameters specifies systemd wide mode only, like "--scan".

It globally enables syslog logging for --oneshoot. I know that
it is not configurable right now and nobody is asking but I believe that user
will prefer to have possibility to enable/disable it, not to have it always
enabled.

If you want add the syslog logging then it should be configurable via config
like MAILADDR is e.g.

SYSLOG = yes

Please also consider that we have two services: mdmonitor and mdmonitor-oneshoot
and logging for them should be configured separately, so I think it is better to
give two options: SYSLOG, SYSYLOG_ONESHOT.

But the question is, if you want the syslog logging or just to make the service
working by default.

If service is not working by default it means that your package provider does
not provide default configuration to run that. It depends on them. We are
providing a solution which may need to be additionally configured.
There is not requirement saying "service must work by default" so I do not
consider it as a bug. Please correct me if you think that I'm wrong here.

Thanks,
Mariusz

>  systemd/mdmonitor-oneshot.service | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/systemd/mdmonitor-oneshot.service
> b/systemd/mdmonitor-oneshot.service index ba86b44e..032b8aad 100644
> --- a/systemd/mdmonitor-oneshot.service
> +++ b/systemd/mdmonitor-oneshot.service
> @@ -10,7 +10,7 @@ Description=Reminder for degraded MD arrays
>  Documentation=man:mdadm(8)
>  
>  [Service]
> -Environment=MDADM_MONITOR_ARGS=--scan
> +Environment=MDADM_MONITOR_ARGS="--scan --syslog"
>  EnvironmentFile=-/run/sysconfig/mdadm
>  ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh
>  ExecStart=BINDIR/mdadm --monitor --oneshot $MDADM_MONITOR_ARGS


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-07 11:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-07  6:57 [PATCH] Fix mdmonitor-oneshot.service fail to be executed Guanqin Miao
2023-06-07  7:58 ` Paul Menzel
2023-06-07 11:05 ` Mariusz Tkaczyk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).