Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1647534 - Use smartd_warning plugin method to notify users
Summary: Use smartd_warning plugin method to notify users
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: smartmontools
Version: 29
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Michal Hlavinka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-11-07 17:21 UTC by Orion Poplawski
Modified: 2019-04-03 11:37 UTC (History)
3 users (show)

Fixed In Version: smartmontools-7.0-3.fc29
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-04-03 11:37:31 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Orion Poplawski 2018-11-07 17:21:12 UTC
Description of problem:

The email message generated by smartd_warning.sh is much better than that generated by smartdnotify.  Make smartdnotify a smartd_warning plugin instead.

Pull request to follow.

Version-Release number of selected component (if applicable):
smartmontools-6.6-5

Comment 2 Michal Hlavinka 2019-01-03 09:56:59 UTC
I've updated smartmontools to 7.0 and included your changes. It was not possible to merge PR, so I made changes manually. Check the changes and update PR if something is missing or close it. Thanks

Comment 3 Fedora Update System 2019-01-03 13:54:35 UTC
smartmontools-7.0-3.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-3cb342f650

Comment 4 Fedora Update System 2019-01-03 13:54:38 UTC
smartmontools-7.0-3.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2019-d4727a746a

Comment 5 Orion Poplawski 2019-01-03 16:54:12 UTC
Looks good, thanks.  One thing, you can remove this unneeded mkdir:

diff --git a/smartmontools.spec b/smartmontools.spec
index 38a3e3f..0a4f2a3 100644
--- a/smartmontools.spec
+++ b/smartmontools.spec
@@ -55,7 +55,6 @@ rm -f examplescripts/Makefile*
 chmod a-x -R examplescripts/*
 install -D -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/smartmontools
 install -D -p -m 755 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/smartd_warning.d/smartdnotif
-mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/smartd_warning.d
 rm -rf $RPM_BUILD_ROOT/etc/{rc.d,init.d}
 rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}
 mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}

Comment 6 Orion Poplawski 2019-01-03 16:54:50 UTC
diff --git a/smartmontools.spec b/smartmontools.spec
index 38a3e3f..0a4f2a3 100644
--- a/smartmontools.spec
+++ b/smartmontools.spec
@@ -55,7 +55,6 @@ rm -f examplescripts/Makefile*
 chmod a-x -R examplescripts/*
 install -D -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/smartmontools
 install -D -p -m 755 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/smartd_warning.d/smartdnotify
-mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/smartd_warning.d
 rm -rf $RPM_BUILD_ROOT/etc/{rc.d,init.d}
 rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}
 mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}

Comment 7 Fedora Update System 2019-01-04 01:42:09 UTC
smartmontools-7.0-3.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-d4727a746a

Comment 8 Fedora Update System 2019-01-04 02:06:53 UTC
smartmontools-7.0-3.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-3cb342f650

Comment 9 Harald Reindl 2019-01-06 03:05:49 UTC
breaking existing configurations by remove "/usr/libexec/smartmontools/smartdnotify" is not very smart

DEFAULT -H -m root -M exec /usr/libexec/smartmontools/smartdnotify -n standby,10,q -d sat -s (S/../.././05|L/../../2/07|O/../../3/11) -W 0,0,50 -l error -l selftest /dev/sda /dev/sdb

Comment 10 Christian Franke 2019-01-06 16:56:48 UTC
Another problem: .../smartd_warning.d/smartdnotify runs the following bogus mail command:

echo "$SMARTD_MESSAGE" | mail -s "$SMARTD_FAILTYPE" 'root @ALL'

(BTW: @ALL should possibly not be in SMARTD_ADDRESS when running ALL plugins. Hmm... I should fix that upstream)

To keep existing configurations intact, I would suggest:
1) Undo all previous changes done for this Bug.
2) Apply this simple patch to /usr/libexec/smartdnotify:

  if which mail >/dev/null 2>&1
  then
-   echo "$SMARTD_MESSAGE" | mail -s "$SMARTD_FAILTYPE" "$SMARTD_ADDRESS"
+   echo "$SMARTD_FULLMESSAGE" | mail -s "$SMARTD_SUBJECT" $SMARTD_ADDRESS
  fi

This does not fix the topic ("Use smartd_warning plugin method ..."), but the intention behind it ("email message ... is much better").

Note that tests could be done with smartd.conf '-M test' directive or by directly running:

  SMARTD_ADDRESS=root SMARTD_MAILER=/usr/libexec/smartdnotify \
    /etc/smartmontools/smartd_warning.sh [--dryrun]

Comment 11 Michal Hlavinka 2019-04-03 11:37:31 UTC
I've tried to write notifications through smartd_warning and keep some backward compatibility as possible, to see how pretty/ugly the result will get and I was not happy with the result at all.

Thus, I've went back to the method we've used before. If someone wants to use it differently, he still can, but that is admins configuration choice, not the default we will ship. That's why I will close this bug as WONTFIX.

I've made the MESSAGE->FULLMESSAGE and FAILTYPE->SUBJECT changes as Christian suggested.


Note You need to log in before you can comment on or make changes to this bug.