Difference between revisions of "Filters"
(15 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
Here are some example filters for use with Zoneminder. If you have a useful filter, please add it here. | Here are some example filters for use with Zoneminder. If you have a useful filter, please add it here. | ||
Also review the official documentation: https://zoneminder.readthedocs.io/en/stable/userguide/filterevents.html | |||
==Note about purgewhenfull and Additional HDDs== | ==Note about purgewhenfull and Additional HDDs== | ||
Line 5: | Line 7: | ||
==Examples== | ==Examples== | ||
===Receive email alarm on Weekends=== | ===Receive email alarm on Weekends=== | ||
For monitoring on the weekend you might have: | For monitoring on the weekend you might have: | ||
<pre>date/time greater than or equal to -1 minute AND | <pre>end date/time greater than or equal to -1 minute AND | ||
alarm frames greater than or equal to 1 AND | alarm frames greater than or equal to 1 AND | ||
Weekday equal to Saturday OR | Weekday equal to Saturday OR | ||
Line 18: | Line 19: | ||
Choose "email details upon match" in the filter. For more details see [[Email]] | Choose "email details upon match" in the filter. For more details see [[Email]] | ||
Note that this is an example without brackets. Brackets can make this simpler, and see below | |||
for an example with those. | |||
===Receive email for specific monitor on Sunday=== | ===Receive email for specific monitor on Sunday=== | ||
Line 23: | Line 26: | ||
Monitor id equal to ### AND | Monitor id equal to ### AND | ||
Cause not equal to Signal AND | Cause not equal to Signal AND | ||
Date/Time greater than or equal to -1 minute AND | End Date/Time greater than or equal to -1 minute AND | ||
Alarm frames greater than or equal to 10 AND | Alarm frames greater than or equal to 10 AND | ||
Weekday equal to Sunday | Weekday equal to Sunday | ||
</pre> | </pre> | ||
===Run filter from the command line=== | |||
From the forum: | |||
You can use cron job to run the filter. Don't check the run in | |||
background box .. then in cron job run zmfilter.pl --filter_id=[whatever | |||
the id is]. | |||
===Run a filter from the command line (alt.)=== | |||
From the forum: | |||
sudo zmdc.pl status zmfilter .pl --filter_id=2 --daemon to see what zmdc.pl thinks about it. | |||
sudo zmdc.pl start zmfilter .pl --filter_id=2 --daemon | |||
Is basically how to web ui tells zmdc.pl to run it, so running that from command line should do the same thing. | |||
ps ax | grep zmfilter should either list it or not. | |||
===Play audio notification upon alert=== | |||
See forum post: | |||
https://forums.zoneminder.com/viewtopic.php?t=32650 | |||
===ZMES example=== | |||
Reference: https://forums.zoneminder.com/viewtopic.php?p=126956 | |||
[[File:Zmes email filter.png|800px|||]] | |||
===Example with brackets / parenthesis=== | |||
The brackets can be confusing, so here's an example that makes it clear. | |||
This filter should fire off on any alerts that are at nights or weekends. | |||
[[File:Filter with brackets fixed.png|600px|||]] | |||
==Troubleshooting== | |||
Always run the filter with 'list matches' after saving it. This way you will see if there is an error in your SQL syntax. | |||
For example, one error might be to set EndStartTime to 'is' Sunday when it must instead be EndStartTime 'is equal to' Sunday. | |||
==Related Links== | |||
https://forums.zoneminder.com/viewtopic.php?f=42&t=29280 | |||
https://zoneminder.readthedocs.io/en/latest/userguide/filterevents.html#relative-items-in-date-strings | |||
https://forums.zoneminder.com/viewtopic.php?f=40&t=28961 | |||
[[Category:Dummies_Guide]] | [[Category:Dummies_Guide]] |
Revision as of 23:50, 26 August 2023
Here are some example filters for use with Zoneminder. If you have a useful filter, please add it here.
Also review the official documentation: https://zoneminder.readthedocs.io/en/stable/userguide/filterevents.html
Note about purgewhenfull and Additional HDDs
See: https://wiki.zoneminder.com/Using_a_dedicated_Hard_Drive
Examples
Receive email alarm on Weekends
For monitoring on the weekend you might have:
end date/time greater than or equal to -1 minute AND alarm frames greater than or equal to 1 AND Weekday equal to Saturday OR Weekday equal to Sunday AND alarm frames greater than or equal to 1 AND date/time greater than or equal to -1 minute
Choose "email details upon match" in the filter. For more details see Email Note that this is an example without brackets. Brackets can make this simpler, and see below for an example with those.
Receive email for specific monitor on Sunday
Monitor id equal to ### AND Cause not equal to Signal AND End Date/Time greater than or equal to -1 minute AND Alarm frames greater than or equal to 10 AND Weekday equal to Sunday
Run filter from the command line
From the forum:
You can use cron job to run the filter. Don't check the run in background box .. then in cron job run zmfilter.pl --filter_id=[whatever the id is].
Run a filter from the command line (alt.)
From the forum:
sudo zmdc.pl status zmfilter .pl --filter_id=2 --daemon to see what zmdc.pl thinks about it. sudo zmdc.pl start zmfilter .pl --filter_id=2 --daemon Is basically how to web ui tells zmdc.pl to run it, so running that from command line should do the same thing. ps ax | grep zmfilter should either list it or not.
Play audio notification upon alert
See forum post: https://forums.zoneminder.com/viewtopic.php?t=32650
ZMES example
Reference: https://forums.zoneminder.com/viewtopic.php?p=126956
Example with brackets / parenthesis
The brackets can be confusing, so here's an example that makes it clear. This filter should fire off on any alerts that are at nights or weekends.
Troubleshooting
Always run the filter with 'list matches' after saving it. This way you will see if there is an error in your SQL syntax. For example, one error might be to set EndStartTime to 'is' Sunday when it must instead be EndStartTime 'is equal to' Sunday.