Page 1 of 1

Email Filter

Posted: Fri Sep 22, 2006 6:14 pm
by vbludov
I wanted to share my problem and solution with you and maybe some of you will find this useful,
My OS is Linux Mandrake 10 and I had problems getting Email filter to send messages.
All previous versions of ZoneMinder did the same thing, did not send mail :) WHY !?!? I got frustrated and decided to figure it out.


so here is what I did:

1.) "Options / Email" menu of zoneminder and made sure that it has important settings:

ZM_NEW_MAIL_MODULES: checked
ZM_EMAIL_HOST: localhost (for some of you it could be different may have to use your ISP's SMTP host, contact them and ask)
ZM_FROM_EMAIL: me@myhost.com
ZM_URL: http://www.myhost.com/zminstallfolder/



2.) E-mail is still not working, what's next ?
I went to ZM forums and found out that filter has to be created in order to send emails!
Ok, that makes sense! ZM needs to know when and which alerts to send.

3.) creating new filter
clicked on the number of events (the total) then in the new window the one that has all the events listed "ShowFilterWindow"
in the FilterWindow i have configures the following rule:
"Alarm Frames" "greater than" "20"
click Save
the filter could be saved with a new name, ok let it be "Email"
checked the following boxes:
Automatically archive all matches:
Automatically email details of all matches:
Automatically message details of all matches:
Hit Save !


4.)
The email is still not working! what is wrong?
for Linux junkies the following command will make sense:

tail -f /var/log/messages

Output:
Sep 22 13:15:22 bludov zmc_dvideo[20768]: INF [New: 127000 - Capturing at 30.30 fps]
Sep 22 13:15:23 bludov zma_m1[20772]: INF [New: 127000 - Processing at 29.41 fps]
Sep 22 13:15:27 bludov zmdc[20745]: INF [Starting pending process, zmfilter.pl]
Sep 22 13:15:27 bludov zmdc[21179]: INF ['zmfilter.pl' started at 06/09/22 13:15:27]
Sep 22 13:15:27 bludov zmdc[20745]: INF ['zmfilter.pl' starting at 06/09/22 13:15:27, pid = 21179]
Sep 22 13:15:27 bludov zmdc[20745]: ERR ['zmfilter.pl ' exited abnormally, exit status 2]


"exited abnormally" F ^@%! that is not good, now I need to see what makes zmfilter.pl (perl) script to freak out.


now it is probably not a bad idea to check if zmfilter can run and the Perl has all required modules installed.

cd /usr/local/bin/zmfilter.pl
./zmfilter.pl


Can't locate MIME/Lite.pm in @INC (@INC contains: /usr/lib/perl5/5.8.3/i386-linux-thread-multi /usr/lib/perl5/5.8.3 /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.2 /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl) at ./zmfilter.pl line 80.

OOH SNAP! my perl is missing "MIME::Lite" package,
it's time to install the package!

perl -MCPAN -e shell
install MIME::Lite



5.)
tail -f /var/log/messages

Output:
Sep 22 13:26:20 bludov zmfilter[21371]: INF [Scanning for events]
Sep 22 13:26:25 bludov zmfilter[21371]: INF [Archiving event 106]
Sep 22 13:26:25 bludov zmfilter[21371]: INF [Creating notification email]
Sep 22 13:26:25 bludov zmfilter[21371]: INF [Sending notification email 'ZoneMinder: Alarm - New-106 (39 - 13 158)']
Sep 22 13:26:26 bludov zmfilter[21371]: INF [Notification email sent]


It works now!


P.S.
Thank you for developing ZoneMinder, excellent work !

Posted: Wed Sep 27, 2006 11:28 am
by zoneminder
Thanks for posting this. If you feel like it, you can add this guide to the Wiki, perhaps to the FAQ. Anyone can post there.

Posted: Thu May 31, 2007 12:49 am
by danielareas
vbludov,

How was your SENDMAIL configuration done?

What were de contents of your /etc/mailhosts file?

My messages.log says the email notification was sent, but it doesn realy send anything.

thanks,

Daniel Areas

Almost works....

Posted: Fri Jun 01, 2007 6:51 pm
by john.a.sutherland
THanks for this, I used the instructions to fix most my problems, but now I get this from my messages:

Jun 1 08:00:28 linux2 zmfilter[12906]: INF [Creating notification message]
Jun 1 08:00:28 linux2 zmfilter[12906]: INF [Sending notification message 'ZoneMinder: Alarm - Front_Door-111']
Jun 1 08:00:28 linux2 zmfilter[12906]: INF [Archiving event 112]
Jun 1 08:00:28 linux2 zmfilter[12906]: INF [Creating notification email]
Jun 1 08:00:28 linux2 zmfilter[12906]: INF [Sending notification email 'ZoneMinder: Alarm - Front_Door-112 (32 - 10 25)']

Jun 1 08:00:28 linux2 zmfilter[12906]: INF [Creating notification message]
Jun 1 08:00:28 linux2 zmfilter[12906]: INF [Sending notification message 'ZoneMinder: Alarm - Front_Door-112']
Jun 1 08:00:28 linux2 zmfilter[12906]: INF [Archiving event 117]
Jun 1 08:00:28 linux2 zmfilter[12906]: INF [Creating notification email]
Jun 1 08:00:28 linux2 zmfilter[12906]: INF [Sending notification email 'ZoneMinder: Alarm - Front_Door-117 (70 - 27 291)']


Looks like it never sends.

Any ideas on how to troubleshoot?

Thanks,

John

Posted: Sat Jun 02, 2007 1:38 pm
by rdmelin
From vbluov's first post
ZM_EMAIL_HOST: localhost (for some of you it could be different may have to use your ISP's SMTP host, contact them and ask)
What are you using for ZM_EMAIL_HOST ?
To use localhost you must have sendmail (or postfix on mandriva) properly configured. It's much simpler to use your ISP's mail host.

It works! Now how can I attach an avi or mpg file ?

Posted: Sat Jun 02, 2007 3:39 pm
by john.a.sutherland
I have sendmail working, but I put in my ISP smtp for ZM_EMAIL_HOST.

Now, how can I attach an avi or mpg file of the event?

Thanks,

John

Attach file

Posted: Tue Jun 05, 2007 1:58 pm
by danielareas
I got sendmail working.
Does anybody know how to send an image attached to the email message?

Thanks,

Daniel Areas