Making a port for ZoneMinder

Ah, I figured you added more and included another line. In that case you probably need to change the last line from bsd.port.mk to bsd.port.post.mk.
 
I would like to switch a camera from modect mode to monitor mode and vice-versa via cli. I have setup tmpfs in /tmp
Code:
# ls -1 /tmp/shm/*
/tmp/shm/zm.mmap.1
/tmp/shm/zm.mmap.2
/tmp/shm/zm.mmap.3

If try to put camera 2 into monitor mode
Code:
#curl -d "username=somebody&password=mypassword&action=login&view=console" -c /tmp/cookies.txt http://myzm/index.php
#curl -b /tmp/cookies.txt -XPOST http://myzm/api/monitors/2.json -d "Monitor[Function]=Monitor&Monitor[Enabled]=1"

Instead of just changing camera 2, it kills all the cameras with a message that mmap file is not available
Code:
#cat zmwatch.log
08/13/17 09:41:50.160670 zmwatch[81702].ERR [Memory map file '/tmp/shm/zm.mmap.2' does not exist.  zmc might not be running.]
08/13/17 09:41:50.161066 zmwatch[81702].INF [Restarting capture daemon for Camera-2, shared data not valid]
08/13/17 09:41:58.617506 zmwatch[81520].INF [Restarting capture daemon for Camera-2, shared data not valid]
08/13/17 09:41:58.621416 zmwatch[81521].INF [Restarting capture daemon for Camera-2, shared data not valid]
08/13/17 09:41:58.927755 zmwatch[81521].INF [Restarting capture daemon for Camera-1, shared data not valid]
08/13/17 09:41:58.929024 zmwatch[81520].INF [Restarting capture daemon for Camera-1, shared data not valid]
08/13/17 09:42:09.198986 zmwatch[81521].ERR [Memory map file '/tmp/shm/zm.mmap.1' does not exist.  zmc might not be running.]
08/13/17 09:42:09.199464 zmwatch[81521].INF [Restarting capture daemon for Camera-1, shared data not valid]
08/13/17 09:42:14.272303 zmwatch[81521].ERR [Memory map file '/tmp/shm/zm.mmap.2' should have been 896 but was instead 0]
08/13/17 09:42:14.272720 zmwatch[81521].INF [Restarting capture daemon for Camera-2, shared data not valid]
08/13/17 09:42:14.538649 zmwatch[81521].ERR [Memory map file '/tmp/shm/zm.mmap.3' should have been 896 but was instead 0]
08/13/17 09:42:14.539052 zmwatch[81521].INF [Restarting capture daemon for Camera-3, shared data not valid]
08/13/17 09:42:15.329443 zmwatch[81520].ERR [Memory map file '/tmp/shm/zm.mmap.1' does not exist.  zmc might not be running.]
08/13/17 09:42:15.329909 zmwatch[81520].INF [Restarting capture daemon for Camera-1, shared data not valid]

Any idea why ZM complains about the mmap file?
 
No, the web page indicates that Zoneminder is stopped. I have to change the state to 'Start' to bring it up again.
 
abishai, I set a Ubuntu VM with bhyve with the exact camera configuration as the FreeBSD jail. The Ubuntu packages were installed using this. I dont see this issue in the Ubuntu jail. The API call does not cause the ZM to go into stopped state. The only difference between Ubuntu and FreeBSD is that the former runs apache instead of nginx.

Btw, my ZM mysql db is on hdd rather than ssd. And i see the following in mysql log
Code:
/usr/local/libexec/mysqld, Version: 5.6.37-log (Source distribution). started with:
Tcp port: 3306  Unix socket: /tmp/mysql.sock
Time                 Id Command    Argument

I suspect this a race condition between zoneminder and mysql.
-----------------------------------------------------------------------
I moved my mysql database files to SSD. In addition i made the following changes to the database and zfs data set, and it has helped a lot. I am to give API commands without zoneminder ging into Stopped state.

Code:
#/usr/local/etc/mysql/my.cnf
innodb_buffer_pool_size         = 20G
innodb_data_home_dir            = /var/db/mysql/innodb
innodb_log_group_home_dir       = /var/db/mysql/logs
innodb_data_file_path           = ibdata1:128M:autoextend
innodb_flush_method             = O_DIRECT
innodb_log_file_size            = 256M
innodb_log_buffer_size          = 16M
innodb_write_io_threads         = 8
innodb_read_io_threads          = 8
innodb_autoinc_lock_mode        = 2
innodb_flush_log_at_trx_commit=2
innodb_file_per_table = off
skip-innodb_doublewrite

For the mysql zfs dataset
Code:
zfs set primarycache=metadata tank/db
zfs set atime=off tank/db
zfs set recordsize=16k tank/db/innodb
zfs set recordsize=128k tank/db/logs
zfs set sync=disabled tank/db
 
the web page indicates that Zoneminder is stopped
Is zms and zmc daemons continue to run in this state? I observing this issue from time to time, but found no clue yet. ZM web page shows stopped state, but other stuff continue to operate.
 
I am seeing lots of error logging just like above nmap for each camera. I do have events setup and they work good and can export OK.
Since i was worried I was missing something as I am new to Zoneminder so I fired up Debian9.2 and it works good. I still see some errors in the logs though much less red.
I am going to rebuild my FreeBSD zoneminder box fresh again. Seems like it is so close to working good.
My zoneminder service does not stop either. Just a very noisy log. Maybe felt sluggish.
2 IQeye 2MP cams, 2 Arecont 1.3MP,5MP, and an older Samsung B2335
Using different cameras has been challenging because they all offer different image sizes. Montage looks ok after some work.

zm-screenshot3.png
 
I pulled my FreeBSD disk back up. Here are the errors. I seem to see that nmap error for every monitor # even though the file exists.
Code:
root@NVR:~ # ls -1 /tmp/*
/tmp/feed1.ffm
/tmp/mysql.sock
/tmp/sess_4nt0ik2uo9t1egmhm5t8b0gh43
/tmp/sess_t8rqiqklk8phot422bk2795mf7
/tmp/zm.mmap.1
/tmp/zm.mmap.2
/tmp/zm.mmap.3
/tmp/zm.mmap.4
/tmp/zm.mmap.5
 

Attachments

  • zm-screenshot4.png
    zm-screenshot4.png
    110.3 KB · Views: 647
I disabled database logging a long time ago. Re-enabled it with INFO level. When you get these errors ? Nothing suspicious upon restart http://i.imgur.com/ZnXf59P.png
Also, I don't recommend to restart ZM daemon at all (restart jail instead)
zmdc.pl code is unreliable. You can't killall perl scripts by name, their names are perl script_name.pl At least under FreeBSD, not sure about Linux, maybe systemd cleans them.
Code:
sub killAll
{
    my $delay = shift;
    sleep( $delay );
    my $killall;
    if ( '@HOST_OS@' eq 'BSD' )
    {
        $killall = 'killall -q -';
    } elsif ( '@HOST_OS@' eq 'solaris' ) {
        $killall = 'pkill -';
    } else {
        $killall = 'killall -q -s ';
    }
    foreach my $daemon ( @daemons )
    {
        my $cmd = $killall ."TERM $daemon";
        Debug( $cmd );
        qx( $cmd );
    }
    sleep( $delay );
    foreach my $daemon ( @daemons )
    {
        my $cmd = $killall."KILL $daemon";
        Debug( $cmd );
        qx( $cmd );
    }
}
 
Unfortunately, I had to give up on running zoneminder in the FreeBSD jail for now. The API calls to the ZM server are not reliable and the server goes into a stopped state. I moved my config into a bhye virtual machine running debian and it is quite stable.
 
Back
Top