Page 1 of 1

Timing of events written to MariaDB and impact on email filter

Posted: Mon Nov 25, 2019 1:28 pm
by clangren
Good day. I'm running Debian 10, ZM version 1.33.14~20191125.638-buster on a fresh install. In process of upgrading hardware from prior install of 1.30.4.

I have reconfigured everything from scratch as I am only running 2 cameras. All went well with the install. I searched the forums and could not find anything on this question so hopefully I did not miss it if it's already posted.

My question centers on the timing of events being actually written out to MariaDB.

In my configuration each block of recording spans 600 seconds and it appears this block is not written to MariaDB until the end of the 600 seconds. I monitored zmfilter.pl logs and used the zmfilter.pl SQL query to monitor the DB for changes and can see the event get recorded in the DB at the end of the 600 seconds. Are events stored somewhere else prior to being written to the DB?

The question comes up because I could not generate an email with a time comparator of '-8 minutes' like I did on 1.30.4. This is due to the passage of 10 minutes before anything was in the DB for the SQL query to find. If I change the time comparator to '-20 minutes' the SQL query finds the alarmed event and sends the email as per my understanding of design.

Is there an option i need to change or what am I missing?

Thanks for the help and thanks for the excellent application!

Re: Timing of events written to MariaDB and impact on email filter

Posted: Mon Nov 25, 2019 11:00 pm
by iconnor
When an event starts, a record is inserted. When the event ends, the endtime and duration are updated.

Filters at the moment generally only match events that have the endtime populated. I thought about changing this for 1.34 but apparently havn't done so.

To correct you need to edit /usr/share/perl5/ZoneMinder/Filter.pm at line 324 from

$sql .= ' WHERE (E.EndTime IS NOT NULL) AND ( '.$self->{Sql}.' )';
to
$sql .= ' WHERE ( '.$self->{Sql}.' )';

Be aware that other filters will need to have an EndTime IS NOT NULL term added to them.