Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
Hi!
Has anyone accomplished to send smartd reports via esmtp? I read all the documentations and man pages, but that stuff is far too advanced for me. :-( All I want to do is to set up smartd to send me mail reports about special occurrences. While I think I can handle the smartd.conf syntax, esmtp seems out of reach.
This essentially is what I have in smartd.conf:
/dev/sda -d marvell -m tab3@example.com -M exec /ffp/bin/esmtp -M test /dev/sdb -d marvell -m tab3@example.com -M exec /ffp/bin/esmtp -M test
When running smartd, this is what I get:
Executing test of /ffp/bin/esmtp to tab3@example.com ...
Test of /ffp/bin/esmtp to tab3@example.com produced unexpected output (112 bytes) to STDOUT/STDERR:
0 (null)
tab3@example.com: 0 (null)
procmail: Unknown user "smart error (emailtest) detected on host: nurunas"
Test of /ffp/bin/esmtp to tab3@example.com: failed (32-bit/8-bit exit status: 17920/70)
Executing test of /ffp/bin/esmtp to tab3@example.com ...
Test of /ffp/bin/esmtp to tab3@example.com produced unexpected output (112 bytes) to STDOUT/STDERR:
0 (null)
tab3@example.com: 0 (null)
procmail: Unknown user "smart error (emailtest) detected on host: nurunas"
Test of /ffp/bin/esmtp to tab3@example.com: failed (32-bit/8-bit exit status: 17920/70)
My esmtprc looks like this:
hostname = post.strato.de:25 username = "tab3@example.com" password = "myPass" force sender = "NAS Admin" mda "/ffp/bin/procmail -d %T"
procmail in /etc looks like this:
# Please check if all the paths in PATH are reachable, # remove the ones that are not. PATH=$HOME/bin:/usr/bin:/bin:. MAILDIR=/ffp/mail # You'd better make sure it exists DEFAULT=$MAILDIR/mbox LOGFILE=$MAILDIR/from LOCKFILE=$HOME/.lockmail
I guess I'm doing a lot of things wrong here, as I don't really know what I am doing at all. Can anyone help me fix this mess? If I could finish smartd config, I'd be ready to use the CH3SNAS productively.
Greeting
Ben
Offline
I think what is happening is that smartd is sending
-s "Subject text" joe@x.com
to esmtp. esmtp does not understand the -s option and is treating both "Subject text" and joe@x.com as recipients. "Subject text" is an unknown user.
Turns out that the mail will still get sent, without a subject, to joe@x.com. It does for me.
I'm not sure what the best way is to fix this. Easiest would probably be to install a mail program that accepts the above syntax.
Offline
karlrado wrote:
Easiest would probably be to install a mail program that accepts the above syntax.
Offline
Although this might not be what you desired: I am using a separate script with estmp to send the smartctl logs via cron:
crontab has:
--------------
3 */6 * * * /mnt/HD_a2/root/bin/email_smartctl.sh
Requires to set MAILTO variable eg. in ~/.profile and edit the <your hostname> and <your domain> and make the paths fit your needs
script is:
----------
!/bin/sh
. /mnt/HD_a2/root/.profile
body="$logdir/.body.$$"
header="$logdir/.header.$$"
subject=$*
#------------------------
if [[ 1=0 ]]; then
while [[ "$1" = "-*" ]]; do
echo "\$1 = $1 \$2 = $2"
case $1 in
-subject ) echo "\$1 = $1 \$2 = $2"; subject=$2;;
esac
shift;
if [[ "-$3" != "-" ]]; then
shift;
fi
done
fi
#------------------------
subject=${subject:-"DNS-323 ($HOST) sending smartctl logs on schedule"}
echo "Subject: $subject" > $header
echo "From: <your hostname>@<your domain>" >> $header
echo "To: $MAILTO" >> $header
echo >> $header
cat $header > $body
cd /mnt/HD_a2/root/cronjobs
for s in sda sdb ; do
echo "=== START of $s ===" >> $body
cat smartctl.$s.log >> $body
echo -en "=== END of $s ===\n\n" >> $body
done
cat $body | esmtp -v $MAILTO
/bin/rm -f $body $header
~/.esmtprc is:
-----------------
identity root@<domain>
hostname = <mailserver>:25
username = "<user>"
password = "<password>"
default
Offline
fonz wrote:
karlrado wrote:
Easiest would probably be to install a mail program that accepts the above syntax.
I ended up using mutt, which was already present on the system.
I copy this .muttrc to /home/root on bootup.
set sendmail="/opt/sbin/sendmail" set from="dlink" set use_from=no set assumed_charset="utf-8" set move=no set sendmail_wait=0 set copy=no
I had installed esmtp from the optarc packages and /opt/sbin/sendmail is just a symlink to esmtp.
Then, change the smartctl config file to use mutt:
-m <email addr> -M exec /usr/bin/mutt
Offline