Changes

Talk:ZoneMinder CCTV Camera Monitoring Software

2,651 bytes added, 01:26, 28 April 2008
variables and arrays
The following lines were added (+) and removed (-):
== run mplayer to play sound on alarm ==Location of sound files cd /usr/share/zoneminder/www/soundszmtrack.pl perl zmtrack.pl -m 9 zmtrack.pl -m id_cameraerror perl -T /usr/bin/zmtrack.pl -m 9 Tracker daemon 9 (experimental) starting at 08/04/12 03:24:59 Monitor '9' is not controllablerecord when there is motion to trigger an alarm event.detect alarm event.filters.Filtering EventsThe other columns on the main console window contain various event totals for your monitors over the last hour, day, week and month as well as a grand total and a total for events that you may have archived for safekeeping.Instant Notification* http://www.zoneminder.com/wiki/index.php/Instant_Notification mplayer /usr/share/zoneminder/www/sounds/redalert.wav== How can I use ZoneMinder to trigger something else when there is an alarm? ==ZoneMinder includes a perl API which means you can create a script to interact with the ZM shared memory data and use it in your own scripts to react to ZM alarms or to trigger ZM to generate new alarms. Full details are in the README or by doing 'perdoc ZoneMinder', 'perldoc ZoneMinder::SharedMem' etc.Below is an example script that checks all monitors for alarms and when one occurs, prints a message to the screen. You can add in your own code to make this reaction a little more useful.<pre>#!/usr/bin/perl -wuse strict;use ZoneMinder;$| = 1;zmDbgInit( "myscript", level=>0, to_log=>0, to_syslog=>0, to_term=>1 );my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_HOST, ZM_DB_USER, ZM_DB_PASS );my $sql = "select M.*, max(E.Id) as LastEventId from Monitors as M left join Events as E on M.Id = E.MonitorId where M.Function != 'None' group by (M.Id)";my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );my $res = $sth->execute() or die( "Can't execute '$sql': ".$sth->errstr() );my @monitors;while ( my $monitor = $sth->fetchrow_hashref() ){    push( @monitors, $monitor );}while( 1 ){    foreach my $monitor ( @monitors )    {        next if ( !zmShmVerify( $monitor ) );         if ( my $last_event_id = zmHasAlarmed( $monitor, $monitor->{LastEventId} ) )        {            $monitor->{LastEventId} = $last_event_id;            print( "Monitor ".$monitor->{Name}." has alarmed\n" );            #            # Do your stuff here            #        }    }    sleep( 1 );}</pre>== variables and arrays == $monitor->{Id} $monitor->{Device} $monitor->{Name} $monitor->{MaxFPS} $monitor->{Function} $event->{Id} $event->{MonitorId} $event->{MonitorHeight} $event->{MonitorWidth}
Bureaucrat, administrator
16,212
edits