Page 1 of 2
zmfilter - when it is actually launched?
Posted: Sun Dec 04, 2005 4:40 pm
by SyRenity
Hi.
I defined a filter to upload events to an FTP, but for some reason the zmfilter doesn't start. The error logs shows nothing. When I run it manually (via zmfilter.pl), it processes only one event, and then stops.
The question is, when the zmfilter is running, and what is causing it to be launched? Is it a scheduled event, or perhaps one that happens because of a new filter creation?
Posted: Tue Dec 06, 2005 10:13 am
by SyRenity
Hi.
I'm still puzzled what actually launches the zmfilter (zmdc?), and when it actually running (on creation of a new filter?). The FTP upload still not working, but I hope it will give me some hint how to resolve it.
Thanks.
Posted: Tue Dec 06, 2005 10:16 am
by jameswilson
I had a problem with ftp upload (i have only used it on a live cd) and it was due to some missing perl thingies. I had to run the filter from the command line and it just stalled, did nothing no errors etc so i turned things of in options till it started again. (it also knocked out my purge when full) then when i found out it was happening as soon as i enabled ftp Ross told some thing perl things to check. It should be in the live cd forum
if thats your problem
James
Posted: Tue Dec 06, 2005 10:31 am
by zoneminder
zmfilter runs from zmdc.pl. If you do 'zmdc.pl status' it should report it as running. It will load new filters usually every five minutes and run filters every minute or so. If there is a problem with modules you should see it in the zmdc.log.
Phil
Posted: Tue Dec 06, 2005 11:39 am
by SyRenity
Hi.
zmfilter.pl status gives me the following time every time:
"'zmfilter.pl' pending at 05/12/06 13:39:38", which seems to increase every 5 minutes.
Running it manually, the zmfilter.pl simple hangs, until ended by Ctrl-Z. Nothing present in the zmdc.log.
I checked also the DB, and the events were set to uploaded=0.
There was indeed a problem with missing Perl libraries (Archive/Zip), and they were logged in the zmdc.log, but since then it doesn't show any error.
Posted: Tue Dec 06, 2005 11:53 am
by zoneminder
zmfilter should 'hang' when you run it manually as it just sits there and loops around filtering. If zmdc says pending then it means it has crashed and it is pending a restart, that should be mentioned in zmdc.log. If it runs ok from the command line but not from zmdc then check the permissions/ownership of zmfilter.log. Possibly it's become owned by root at some point and can't be opened by a process owned by apache.
Phil
Posted: Tue Dec 06, 2005 12:38 pm
by SyRenity
Hi.
Well - this was the solution
. Apparently by running it manually as root, it indeed created a log file with root permissions.
Now, it has run, and uploaded only a single set of events, although the filter has many more defined. Any idea when the next will process (if at all?), or it's possibly another issue?
zmdc.pl returns the following line:
'zmfilter.pl' running at 05/12/06 14:29:43, pid = 8292. Also, zmfilter.pl is visible in ps.
zmdc.log has it listed as running as well.
Posted: Tue Dec 06, 2005 12:44 pm
by zoneminder
Do you have a limit in your filter? Otherwise it should do all of the ones it matches. Run the filter manually via the web page and whatever events you get listed should be processed by the script.
Phil
Posted: Tue Dec 06, 2005 12:51 pm
by SyRenity
Hi.
It shows 353 events in the list, but the zmfilter only uploaded the first event.
I disabled the FTP debugging, and restarted the ZM. It has now the following line in the zmfilter.log:
12/06/2005 14:46:45.416152 zmfilter[8748].INF [Scanning for events]
No new tmp files are created in the /tmp folders, which means it didn't reach the required events?
Posted: Tue Dec 06, 2005 2:14 pm
by zoneminder
The other thing to check is whether the events have already been tagged as uploaded. In 1.22.0 that shouldn't happen but it's possible in earlier releases that the tagging occurred even if the file wasn't sent. You'll have to go into the DB and check the Uploaded flag on the events in question. Set it to 0 if you want them uploaded.
Phil
Posted: Tue Dec 06, 2005 2:22 pm
by SyRenity
Hi.
Well, I also start experimenting with the execute function, and here are my results:
The first event is processed OK, but then the zmfilter.pl stucks after completing it. After killing the zmfilter process, the zmfilter adds the following line in the zmdc.log, and then hangs again:
12/06/2005 16:18:26.340475 zmfilter[22972].INF [Scanning for events]
The only event with the "uploaded" (or "executed" for the matter) field set to 1 is only the first event - the only one that got processed. Resetting this field to 0 and killing/restarting the ZM, this event gets processed again, and all the story repeats on itself.
Update:
What is even more curious, is that the processed event doesn't even belong to the said filter. I mean, this event is not appearing in the list of the events presented by this filter.
By the way, the used version of ZM is the latest one, 1.21.4.
Posted: Tue Dec 06, 2005 2:27 pm
by zoneminder
Are you sure it's not the uploading/execution itself that is locking up and jamming up zmfilter? Uploading especially can take a while obviously.
Phil
Posted: Tue Dec 06, 2005 2:35 pm
by SyRenity
Hi.
Not really, as I'm basically using a modified version of zmvideo.pl, in order to create videos for a required set of events. It usually updates the zmvideo.log file with it's process, but in this case, I can see that after the first successfully created video, it stays unmodified.
I disabled the uploading for now.
Posted: Tue Dec 06, 2005 3:37 pm
by zoneminder
One other thing to try is to edit zmfilter.pl and look for the debug level variable. If you set that to 1 you should get more debug in the logs which might help.
Phil
Posted: Tue Dec 06, 2005 4:29 pm
by SyRenity
Hi.
I enabled the debug output, below is the SQL output in zmfilter.log:
select E.Id,E.MonitorId,M.Name as MonitorName,E.Name,E.StartTime,unix_timestamp(E.StartTime) as Time,E.Length,E.Frames,E.AlarmFrames,E.TotScore,E.AvgScore,E.MaxScore,E.Archived,E.Uploaded,E.Emailed,E.Messaged,E.LearnState from Events as E inner join Monitors as M on M.Id = E.MonitorId where not isnull(E.EndTime) and ( E.MonitorId = 6 and E.Archived = 0 and E.StartTime >= '2005-12-02 06:00:00' and E.StartTime <= '2005-12-02 08:00:00' ) and ( E.Executed = 0 ) order by E.StartTime asc]
The times are wrong thought - I set a filter to be between 9:30 and 11:30, with these parameters:
"12/02 09:30" - "12/02 11:30". Perhaps I should use another format? Submitting the filter thought, shows all the correct events.
This might be the reason - as there is indeed only one event between 6 and 8 AM.