Opened 8 years ago
Closed 8 years ago
#731 closed enhancement (fixed)
Send warning mails via PowerShell script under MS-Windows
Reported by: | Gabriele Pohl | Owned by: | Christian Franke |
---|---|---|---|
Priority: | minor | Milestone: | Release 6.6 |
Component: | smartd | Version: | 6.5 |
Keywords: | windows smartd.conf | Cc: |
Description
A smartmontools user wrote:
We use smartmontools on MS Windows computers (and of course on our Linux boxes)
because they are small, they support multi platform usage and they work just great.
The only point that we did not like too much was the use of an external
program to send email warnings (blat on Windows). That's why I changed
the file smard_warning.cmd and wrote a PowerShell script to send the warning emails.
Now, if you are interested, I would like to share my scripts with the
smartmontools dev team. If you like it - feel free to integrate it.
Attachments (5)
Change History (8)
by , 8 years ago
Attachment: | smartd_warning.cmd added |
---|
by , 8 years ago
Attachment: | emailSender.ps1 added |
---|
comment:1 by , 8 years ago
Keywords: | smartd.conf added; mail removed |
---|
by , 8 years ago
Attachment: | smartd_warning.2.cmd added |
---|
Proposed new version of smartd_warning.cmd. Runs smartd_mailer.ps1 if configured.
by , 8 years ago
Attachment: | smartd_mailer.ps1 added |
---|
PowerShell script which sends mail via Send-MailMessage.
by , 8 years ago
Attachment: | smartd_mailer.conf.ps1 added |
---|
Sample confugration file for smartd_mailer.ps1.
comment:2 by , 8 years ago
Milestone: | → Release 6.6 |
---|---|
Owner: | set to |
Status: | new → accepted |
If possible, please test the above scripts:
- Replace
%PROGRAMFILES%/smartmontools/bin/smartd_warning.cmd
with smartd_warning.2.cmd. - Copy smartd_mailer.ps1 and smartd_mailer.conf.ps1 to
%PROGRAMFILES%/smartmontools/bin
. - Edit
%PROGRAMFILES%/smartmontools/bin/smartd_mailer.conf.ps1
. - Run
set SMARTD_ADDRESS=ADDRESS & smartd_warning.cmd --dryrun
to see the parameters of theSend-MailMessage
command that would be executed. - Run smartd service with
-m ADDRESS -M test
(and without-M exec ...
) directive.
If smartd_mailer.conf.ps1
is not present, blat.exe
is be used instead.
Thanks for your contribution. Using PowerShell as an alternative to blat makes plenty of sense. This wasn't an option in the early days (2004) when email support was added to the Windows port of smartd.
Unfortunately the attached scripts are not backward compatible and break existing functionality (e.g.
-m console
,-m <nomailer> -M /path/to/script
). Therefore these scripts cannot replace the current smartd_warning.cmd.