Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

ZoneMinder 1.34.9 and newer best practice thread, updated as needed?

Is there any interest in a thread listing related threads about best practice setup of ZM?


  • Total voters
    13

Frank Collins

Member
Joined
Apr 10, 2019
Messages
50
ZM is a complicated piece of software, as we all know, and it is a hard task to get it set up properly, particularly as both it and FreeNAS are subject to constant change. Threads that worked on the last plugin version, 1.32.3, no longer apply. I thought it would be a good idea to amalgamate all relevant threads to a central index. Given my limited ability with both FreeNAS and ZoneMinder, I would be willing to contribute by maintaining such an exercise as a way of contributing to the forum.

There are many options that are recommended in the docs and should be implemented, such as;
Use of tmps (RAM) instead of tmp to reduce disk activity,
Use of lower camera resolution and resolution in motion detection mode but switch to highest when motion detected and recording occurs,
Save videos outside the jail,
and whatever comes up as we proceed.
I will also start threads on these so we, hopefully, find the best way to achieve these for all.
 

nikinp

Member
Joined
Sep 7, 2014
Messages
25
ZM is a complicated piece of software, as we all know, and it is a hard task to get it set up properly, particularly as both it and FreeNAS are subject to constant change. Threads that worked on the last plugin version, 1.32.3, no longer apply. I thought it would be a good idea to amalgamate all relevant threads to a central index. Given my limited ability with both FreeNAS and ZoneMinder, I would be willing to contribute by maintaining such an exercise as a way of contributing to the forum.

There are many options that are recommended in the docs and should be implemented, such as;
Use of tmps (RAM) instead of tmp to reduce disk activity,
Use of lower camera resolution and resolution in motion detection mode but switch to highest when motion detected and recording occurs,
Save videos outside the jail,
and whatever comes up as we proceed.
I will also start threads on these so we, hopefully, find the best way to achieve these for all.
I see that you said that you would start these threads. Are they supposed to be listed here?
 

Frank Collins

Member
Joined
Apr 10, 2019
Messages
50
@nikinp,
Not yet but I will in the next few days.
I don't know whether you have ever replaced gutters on an old house but, take it from me, it isn't easy or quick. As winter approaches, I must make use of the fine days.

Thanks for voting too. There have been 158 views and only two votes, disappointing.
 

nikinp

Member
Joined
Sep 7, 2014
Messages
25
Upgraded to 11.3 Freenas and used the plugin from the GUI. Installed without any hitches. I am a supernewby. This is the way to go and avoids any code
 

tokensolution

Neophyte
Joined
Apr 26, 2018
Messages
6
Long time listener first time caller- very interested in this thread. I have zoneminder plugin installed on a FreeNAS system that is 12 drives, 1 pool of two RAID z2 vdevs.

I have joined one camera with Mocord and I can see my NAS's blinking lights going crazy- I can imagine this is a very non-optimum setup. I can imagine the recordings are being striped and hashed constantly and would it be better practice to have a vdev and pool dedicated to just zoneminder recorderings?
 

ngalfas

Neophyte
Joined
Jul 19, 2020
Messages
8
I think the first thing to do is setup TMPFS for /tmp on the plugin.
 

ngalfas

Neophyte
Joined
Jul 19, 2020
Messages
8
Yes, now i have a plugin installation which went smoothly as other noted.
It really needs the tmpfs setup.
The disk stats are staggering.
 

ngalfas

Neophyte
Joined
Jul 19, 2020
Messages
8
In zmNinja app (android version for me) you need to change Setting "path to cgi-bin" from "zoneminderIP/zm/cgi-bin" to "zoneminderIP/cgi-bin".
This solves the live monitor feed - (Montage) not been displayed.
For latest FreeNAS plugin installation 1.34.9
 

Roy360

Member
Joined
Nov 27, 2017
Messages
27
I think the first thing to do is setup TMPFS for /tmp on the plugin.
How does one this do? I do not see it in the Zoneminder documentation.
Edit: found this... still haven't implemented but looks like there are two ways to approach this.

 
Last edited:

Roy360

Member
Joined
Nov 27, 2017
Messages
27
Can someone recommend best disk practices?
Zoneminder is my first and only jail.
I only had 1 pool prior to setting this up.

I added a single drive to my machine and made it the default for all jails. Zoneminder automatically started storing records to the drive without any need to play with fstab or storage mounts.
I'm getting warnings from FreeNAS about the pool being too full, but since it's meant for loop recording I just dismiss it.
Is this approach bad? (Is it wasting RAM/CPU cycles that could be going to my actual ZFS pool)

The only other approach I can think of is: install Zoneminder on my main pool, and then format the new drive as EXT4 and mount it as the root for Zoneminder.

Anyone experiencing high CPU usage after install Zoneminder?
Zoneminder's console only reports 5-10% usage with 3x 5MP cameras running. FreeNAS system load never goes above 10%, however CPU usage is pinned at 100% and my temps in the high 70s.
CPU: Xeon E3-1220 (I'm using the stock cooler, so maybe it's time to reapply the thermal paste?)

1601997031487.png
 

elmo putney

Newbie
Joined
Nov 12, 2020
Messages
3
I think the first thing to do is setup TMPFS for /tmp on the plugin.
Another noob here, I've had FREENAS up and running for about 9 Months and ventured into zoneminder about 2 Months ago, I soon trashed a fresh SSD (2 weeks) which I've swapped out for a mechanical drive - but I've only bought myself a bit of time.

But I still have not been able to figure out how to move to TMPFS, in the thread that Roy360 points to I get stuck at "enforce_statfs=0 " I'm on truenas core and that setting doesn't exist, so I tried adding it to sysctl.conf but it doesn't seem to have any effect - so right now I don't have a solution and I've run out of talent.

Very in favour of some best practices knowledge being pooled!
 

elmo putney

Newbie
Joined
Nov 12, 2020
Messages
3
Can someone recommend best disk practices?
Zoneminder is my first and only jail.
I only had 1 pool prior to setting this up.

I added a single drive to my machine and made it the default for all jails. Zoneminder automatically started storing records to the drive without any need to play with fstab or storage mounts.
I'm getting warnings from FreeNAS about the pool being too full, but since it's meant for loop recording I just dismiss it.
Is this approach bad? (Is it wasting RAM/CPU cycles that could be going to my actual ZFS pool)

The only other approach I can think of is: install Zoneminder on my main pool, and then format the new drive as EXT4 and mount it as the root for Zoneminder.

Anyone experiencing high CPU usage after install Zoneminder?
Zoneminder's console only reports 5-10% usage with 3x 5MP cameras running. FreeNAS system load never goes above 10%, however CPU usage is pinned at 100% and my temps in the high 70s.
CPU: Xeon E3-1220 (I'm using the stock cooler, so maybe it's time to reapply the thermal paste?)

Are you doing any analysis on the capture? - i.e. motion detection, is it set-up as MOCORD or RECORD?
Are you transcoding before writing to disk - i.e. what is your setting for video writer on the storage tab of your monitors?
 

Roy360

Member
Joined
Nov 27, 2017
Messages
27
Are you doing any analysis on the capture? - i.e. motion detection, is it set-up as MOCORD or RECORD?
Are you transcoding before writing to disk - i.e. what is your setting for video writer on the storage tab of your monitors?
I am using MoCord on 3x 5MP Cameras. Recording at 15fps.
I am using h254 passthrough with video writer.

CPU is now pegged at 60% across all four cores according to FreeNAS. Goes up to 80% during events. (Temps unfortunately are also pegged around the 70-80 degree range, so there's probably some throttling happening)


Regarding your tmpfs question, just find the fstab of your Zoneminder install and add something similar to this at the end:
Code:
tmpfs /mnt/Plugins/iocage/jails/Zoneminder/root/tmp tmpfs rw,nosuid,noexec,size=1G,mode=01777 0 0


I use 1G for my 3 cameras, and have ~70% usage.
 

elmo putney

Newbie
Joined
Nov 12, 2020
Messages
3
Sorry this probably should not be in this thread - deserves a separate one. Not surprised on your cpu with 3 cameras doing motion detection @5mp 15fps, you are asking a lot from the cpu. Can you not use one of your three cameras in motion detection mode to add events to the others? Or use a low res/fps stream to do the MoCord to identify events?

My one camera has 2 streams - stream 1 is high resolution 15 fps, stream 2 is setup as 6 fps and 800x600 (or similar).

Stream 2 does the motion detection which triggers stream 1 to record.

As for tmpfs - I am ok to follow a dummies guide but beyond that I am stuffed - I wouldn't know where to inject the code you suggest.
 

ngalfas

Neophyte
Joined
Jul 19, 2020
Messages
8
posting here my 11.3 -> 12.1 plugin upgrade experience.

First upgraded FreeNAS 11.3 to TrueNAS 12.0.
Then
# iocage upgrade -r 12.1-RELEASE zoneminder
this seems to finish fine, but it's not.

You need to
# iocage console zoneminder
# pkg-static install -f pkg
# pkg upgrade -f

this will bring zoneminder-1.34.21 (latest release) so we also need to update the database.

# service zoneminder stop
# zmupdate.pl

and ther restart the jail to see if it works ok and starts recording from cameras.
 
Last edited:

YodaBagoata

Newbie
Joined
Nov 26, 2020
Messages
1
After upgrading FreeNAS 11.2 -> 11.3 and trying to update the ZoneMinder plugin from the FreeNAS UI, my ZM setup was borked. I couldn't find any solutions, so here's how I fixed it...

Symptoms:
1) ZM Web UI reports: 502 Bad Gateway
2) Errors in /var/log/messages: root: /etc/rc: WARNING: failed to start php_fpm
3) php-fpm service is not running; starting it manually reveals this error message: Undefined symbol "setproctitle_fast@FBSD_1.5"

First try:
# iocage console zoneminder
root@zoneminder:~ # pkg update -f && pkg upgrade

Upgrade jail:
# iocage fetch 11.3-RELEASE
# iocage upgrade zoneminder --release 11.3-RELEASE
# iocage console zoneminder
root@zoneminder:~ # pkg update && pkg upgrade

Upgrade ZM database schema (from 1.32.x to 1.34.21):
root@zoneminder:~ # service zoneminder stop
root@zoneminder:~ # zmupdate.pl

Original symptoms fixed; new symptoms:
4) Errors in /var/log/messages: ERR [SQL-ERR dbFetchOne no result, statement was 'SHOW variables WHERE variable_name='max_connections'']
5) Errors in /var/log/messages: ERR [SQL-ERR 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'performance_schema.session_status' doesn't exist', ...]
6) Errors in /var/log/messages: ERR [ZoneMinder is not configured properly: php's date.timezone +0000 does not match the system timezone -0800! Please check Options->System->Timezone.]

Check database integrity and update MySQL schema:
root@zoneminder:~ # mysqlcheck -p`cat /root/dbpassword` --all-databases
root@zoneminder:~ # mysql_upgrade -u root -p`cat /root/dbpassword`

Set correct timezone in ZoneMinder > Options > System > TIMEZONE. I had never done this since it was working fine before.

I hope this helps someone.

root@zoneminder:~ # pkg info | cut -d' ' -f1
aom-2.0.0_1
argp-standalone-1.3_4
bash-5.0.18_3
bash-completion-2.11,2
ca_root_nss-3.58
curl-7.73.0
cyrus-sasl-2.1.27_1
dav1d-0.8.0
expat-2.2.10
fcgi-devkit-2.4.0_5
fcgiwrap-1.1.0_11
ffmpeg-4.3.1_7,1
fontconfig-2.13.92_2,1
freetype2-2.10.4
fribidi-1.0.10
gettext-runtime-0.21
giflib-5.2.1
glib-2.66.3,1
gmp-6.2.1
gnutls-3.6.15
graphite2-1.3.14
harfbuzz-2.7.2_1
indexinfo-0.3.1
jbigkit-2.1_1
jpeg-turbo-2.0.5
lame-3.100_2
libX11-1.6.12,1
libXau-1.0.9
libXdmcp-1.1.3
libXext-1.3.4,1
libXfixes-5.0.3_2
libargon2-20190702
libass-0.15.0
libdrm-2.4.103,1
libedit-3.1.20191231,1
libepoll-shim-0.0.20200602
libevent-2.1.12
libffi-3.3_1
libgcrypt-1.8.7
libgd-2.3.0,1
libgpg-error-1.39
libiconv-1.16
libidn2-2.3.0_1
liblz4-1.9.2_1,1
libnghttp2-1.41.0
libogg-1.3.4,4
libpciaccess-0.16
libpthread-stubs-0.4
libtasn1-4.16.0
libtheora-1.1.1_7
libudev-devd-0.4.2_1
libunistring-0.9.10_1
libv4l-1.18.0
libva-2.9.1
libvdpau-1.4
libvorbis-1.3.7_2,3
libvpx-1.9.0
libx264-0.161.3020
libxcb-1.14_1
libxml2-2.9.10_1
mp4v2-2.0.0
mysql57-client-5.7.32
mysql57-server-5.7.32
nettle-3.6
nginx-1.18.0_30,2
opencv-core-3.4.1_36
opus-1.3.1
p11-kit-0.23.21
p5-AppConfig-1.71
p5-Authen-NTLM-1.09_1
p5-B-Hooks-EndOfScope-0.24
p5-Class-Load-0.25
p5-Class-Mix-0.006
p5-Class-Std-0.013
p5-Class-Std-Fast-0.0.8_2
p5-Clone-0.45
p5-Cpanel-JSON-XS-4.25
p5-Crypt-Eksblowfish-0.009_3
p5-Crypt-Rijndael-1.15
p5-DBD-mysql-4.050
p5-DBI-1.643
p5-Data-Dump-1.23_1
p5-Data-Entropy-0.007_1
p5-Data-Float-0.013
p5-Data-OptList-0.110
p5-Data-UUID-1.226
p5-Date-Manip-6.82
p5-Device-SerialPort-1.040000_2
p5-Digest-HMAC-1.03_1
p5-Dist-CheckConflicts-0.11_1
p5-Encode-Locale-1.05
p5-File-Listing-6.11
p5-HTML-Parser-3.75
p5-HTML-Tagset-3.20_1
p5-HTTP-Cookies-6.09
p5-HTTP-Daemon-6.12
p5-HTTP-Date-6.05
p5-HTTP-Lite-2.44
p5-HTTP-Message-6.26
p5-HTTP-Negotiate-6.01_1
p5-IO-HTML-1.001_1
p5-IO-Interface-1.09_1
p5-IO-Socket-INET6-2.72_1
p5-IO-Socket-Multicast-1.12_2
p5-IO-Socket-SSL-2.068
p5-JSON-MaybeXS-1.004003
p5-LWP-MediaTypes-6.04
p5-LWP-Protocol-https-6.09
p5-Module-Implementation-0.09_1
p5-Module-Runtime-0.016
p5-Mozilla-CA-20200520
p5-Net-HTTP-6.19
p5-Net-SSLeay-1.88
p5-Number-Bytes-Human-0.11_1
p5-Package-Stash-0.38
p5-Package-Stash-XS-0.29
p5-Params-Classify-0.015
p5-Params-Util-1.07_2
p5-SOAP-WSDL-3.004_1
p5-Safe-Isa-1.000010
p5-Socket6-0.29
p5-Sub-Exporter-0.987_1
p5-Sub-Exporter-Progressive-0.001013
p5-Sub-Install-0.928_1
p5-Sys-CPU-0.61
p5-Sys-MemInfo-0.99
p5-Sys-Mmap-0.20
p5-Template-Toolkit-3.009
p5-Term-ReadKey-2.38_1
p5-Test-LWP-UserAgent-0.030
p5-TimeDate-2.33,1
p5-Try-Tiny-0.30
p5-URI-1.76
p5-Variable-Magic-0.62
p5-WWW-RobotRules-6.02_1
p5-XML-Parser-2.44
p5-libwww-6.49
p5-namespace-clean-0.27
pciids-20201025
pcre-8.44
pcre2-10.35
perl5-5.32.0
php74-7.4.12
php74-ctype-7.4.12
php74-gd-7.4.12
php74-json-7.4.12
php74-opcache-7.4.12
php74-openssl-7.4.12
php74-pdo-7.4.12
php74-pdo_mysql-7.4.12
php74-pecl-APCu-5.1.19
php74-session-7.4.12
php74-sockets-7.4.12
pkg-1.15.10
png-1.6.37
protobuf-3.13.0,1
python37-3.7.9_1
readline-8.0.4
sudo-1.9.3p1
tiff-4.1.0
tpm-emulator-0.7.4_2
trousers-0.3.14_3
wayland-1.18.0_4
webp-1.1.0
x265-3.4
xorgproto-2020.1
xvid-1.3.7,1
zip-3.0_1
zoneminder-1.34.21_1
 
Top