Skip to content

Commit

Permalink
mdadm.man: elaborate more about mdmonitor.service
Browse files Browse the repository at this point in the history
Describe how it behaves and how it can be configured to work.

Signed-off-by: Mariusz Tkaczyk <[email protected]>
  • Loading branch information
mtkaczyk committed Oct 10, 2024
1 parent a7a5e67 commit 70f3a1b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 29 deletions.
52 changes: 27 additions & 25 deletions mdadm.8.in
Original file line number Diff line number Diff line change
Expand Up @@ -1878,11 +1878,15 @@ script.
.SH For Monitor mode:
.TP
.BR \-m ", " \-\-mail
Give a mail address to send alerts to.
Give an mail address to send alerts to. Can be configured in
.B mdadm.conf
as MAILADDR.

.TP
.BR \-p ", " \-\-program ", " \-\-alert
Give a program to be run whenever an event is detected.
Give a program to be run whenever an event is detected. Can be configured in
.B mdadm.conf
as PROGRAM.

.TP
.BR \-y ", " \-\-syslog
Expand All @@ -1891,13 +1895,12 @@ facility of 'daemon' and varying priorities.

.TP
.BR \-d ", " \-\-delay
Give a delay in seconds.
.I mdadm
polls the md arrays and then waits this many seconds before polling
again. The default is 60 seconds. Since 2.6.16, there is no need to
reduce this as the kernel alerts
Give a delay in seconds. The default is 60 seconds.
.I mdadm
immediately when there is any change.
polls the md arrays and then waits this many seconds before polling again if no event happened.
Can be configured in
.B mdadm.conf
as MONITORDELAY.

.TP
.BR \-r ", " \-\-increment
Expand Down Expand Up @@ -2595,30 +2598,29 @@ is given, then a
.B program
or an
.B e-mail
address must be specified on the
command line or in the config file. If neither are available, then
address must be specified on the command line or in the config file. If neither are available, then
.I mdadm
will not monitor anything.
For devices given directly in command line, without
will not monitor anything. For devices given directly in command line, without
.B program
or
.B email
specified, each event is reported to
.BR stdout.

Note: For systems where
.If mdadm monitor
is configured via systemd,
.B mdmonitor(mdmonitor.service)
should be configured. The service is designed to be primary solution for array monitoring,
it is configured to work in system wide mode.
It is automatically started and stopped according to current state and types of MD arrays in system.
The service may require additional configuration, like
.B e-mail
or
.B delay.
That should be done in
.B mdadm.conf.
Note: On systems where mdadm monitoring is managed through systemd, the mdmonitor.service
should be present. This service is designed to be the primary solution for array monitoring.
It is configured to operate in system-wide mode. It is initiated by udev when start criteria are
met, e.g.
.B mdadm.conf
exists and necessary configuration parameters are set.
It is kept alive as long as a redundant RAID array is active; it stops otherwise. User should
customize MAILADDR in
.B mdadm.conf
to receive mail notifications. MONITORDELAY, MAILFROM and PROGRAM are optional. See
.BR mdadm.conf (5)
for detailed description of these options.
Use systemctl status mdmonitor.service to verify status or determine if additional configuration
is needed.

The different events are:

Expand Down
11 changes: 7 additions & 4 deletions systemd/mdmonitor.service
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ Documentation=man:mdadm(8)

[Service]
# For Maintainers:
# We need to provide consistent mdmonitor configuration man page to the users. We don't want to get
# asked continuously how it can be configured.
# /etc/sysconfig/mdadm or /etc/sysconfig/mdmonitor or whatever else, should be abandoned.
# Following parameters should be customized via mdadm.conf only:
# We need to ensure that the mdmonitor configuration aligns with the guidelines provided
# in the man page for users.
# /etc/sysconfig/mdadm, /etc/sysconfig/mdmonitor, or any other similar configuration file should
# not be supported because non upstream components are not described in man pages.

# Parameters designed to be customized by user, should be settable via mdadm.conf:
# - MONITORDELAY (do not set --delay in service)
# - MAILADDR (do not set --mail in service)
# - MAILFROM (not settable from cmdline)
Expand All @@ -25,4 +27,5 @@ Documentation=man:mdadm(8)
# - --syslog (configure syslog logging)
# - --fork (Type=forking must be added, not recommended and not needed with systemd)
# - --pid-file (allowed only when --fork selected)

ExecStart=BINDIR/mdadm --monitor --scan

0 comments on commit 70f3a1b

Please sign in to comment.