Zoneminder est considéré comme un des logiciels opensource de vidéosurveillance de référence. Le site officiel est https://zoneminder.com. On y récupère la dernier version qu'on décompresse en tapant
Il faut commencer par créer une base de données mysql en tapant:
mariadb -u root -p < /usr/share/zoneminder/db/zm_create.sql
on vérifie si la base est bien créée, elle se nomme simplement zm
et on crée un utilisateur privilégié zmuser sur la base zm avec
le mot de passe zmpass qu'il faudra évidemment changer
mariadb -u root -p
voilà le résultat
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 25
Server version: 11.4.2-MariaDB Source distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input
statement.
MariaDB [(none)]> show databases;
+---------------------+
|
Database
|
+---------------------+
| MyMusic82
|
| MyMusic83
|
| MyVideos121 |
| MyVideos131 |
|
digikam
|
| digikam_similarites |
| digikam_vignettes |
| digikam_visages |
| information_schema |
|
mysql
|
| performance_schema |
| phpmyadmin |
| roundcubemail |
| spamassassin |
| syncstorage_rs |
|
sys
|
| tokenserver_rs |
|
zm
|
+---------------------+
18 rows in set (0,096 sec)
MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> CREATE USER 'zmuser' IDENTIFIED BY 'zmpass';
Query OK, 0 rows affected (0,087 sec)
MariaDB [mysql]> GRANT ALL ON zm.* TO 'zmuser'@'localhost';
Query OK, 0 rows affected (0,201 sec)
maintenant j'ai créé le fichier /usr/lib/systemd/system/zoneminder.service qui contiendra
[Unit]
Description=ZoneMinder CCTV recording and security system
After=network.target mariadb.service httpd.service
Requires=mariadb.service httpd.service
[Service]
User=apache
Type=forking
ExecStart=/usr/bin/zmpkg.pl start
ExecReload=/usr/bin/zmpkg.pl reload
ExecStop=/usr/bin/zmpkg.pl stop
[Install]
WantedBy=multi-user.target
Attention le user doit correspondre au propriétaire du processus Apache httpd. On active le service en tapant
systemctl enable zoneminder
Le fichier de configuration /etc/zm/zm.conf ressemble à ça
#
==========================================================================
#
# ZoneMinder Base Configuration
#
#
==========================================================================
#
# *** DO NOT EDIT THIS FILE ***
#
# To make custom changes to the variables below, create a new
configuration
# file, with an extention of .conf, under the /etc/zm/conf.d
# folder, containing your desired modifications.
#
# Path to installed data directory, used mostly for finding DB upgrade
scripts
ZM_PATH_DATA=/usr/share/zoneminder
# Path to ZoneMinder binaries
ZM_PATH_BIN=/usr/bin
# Path to ZoneMinder libraries (none at present, for future use)
ZM_PATH_LIB=/usr/lib64
# Path to ZoneMinder configuration (this file only at present)
ZM_PATH_CONF=/etc/zm
# Path to ZoneMinder web files
ZM_PATH_WEB=/usr/share/zoneminder/www
# Path to ZoneMinder cgi files
ZM_PATH_CGI=/usr/share/zoneminder/cgi-bin
# Username and group that web daemon (httpd/apache) runs as
# utilisateur et groupe propriétaire du daemon apache httpd
ZM_WEB_USER=apache
ZM_WEB_GROUP=apache
# ZoneMinder database type: so far only mysql is supported
ZM_DB_TYPE=mysql
# ZoneMinder database hostname or ip address and optionally port or unix
socket
# Acceptable formats include hostname[:port], ip_address[:port], or
# localhost:/path/to/unix_socket
# le nom du serveur sur lequel tourne le serveur mariadb
ZM_DB_HOST=mariadb-serveur
# ZoneMinder database name
ZM_DB_NAME=zm
# ZoneMinder database user
ZM_DB_USER=zmuser
# ZoneMinder database password
# le mot de passe tel que défini dans mariadb
ZM_DB_PASS=zmpass
# SSL CA certificate for ZoneMinder database
ZM_DB_SSL_CA_CERT=
# SSL client key for ZoneMinder database
ZM_DB_SSL_CLIENT_KEY=
# SSL client cert for ZoneMinder database
ZM_DB_SSL_CLIENT_CERT=
# Do NOT set ZM_SERVER_HOST if you are not using Multi-Server
# You have been warned
#
# The name specified here must have a corresponding entry
# in the Servers tab under Options
ZM_SERVER_HOST=
Autre fichier /etc/zm/conf.d/01-system-paths.conf qui contiendra
#
==========================================================================
#
# ZoneMinder System Paths Configuration
#
#
==========================================================================
#
# This config file contains the variables previously found under Options
-> Paths
#
# *** DO NOT EDIT THIS FILE ***
#
# To make custom changes to the variables below, create a new
configuration
# file, with an extention of .conf, containing your desired
modifications.
#
# Full path to the folder events are recorded to.
# The web account user must have full read/write permission to this
folder.
# répertoire où les évènements sont enregistrés
# le détenteur du process httpd doit être proprio, c'est apache
ZM_DIR_EVENTS=/media/motion/events
# Foldername under the webroot where ZoneMinder looks for optional sound
files
# to play when an alarm is detected.
ZM_DIR_SOUNDS=sounds
# Full path to the folder where exported archives are stored
# The web account user must have full read/write permission to this
folder.
# répertoire où les archives sont exportés
# l'utilisateur apache doit être propriétaire du répertoire
ZM_DIR_EXPORTS=/var/tmp/zm
# ZoneMinder url path to the zms streaming server
ZM_PATH_ZMS=/zm/cgi-bin/nph-zms
# Full Path to ZoneMinder's mapped memory files
# The web account user must have full read/write permission to this
folder.
ZM_PATH_MAP=/dev/shm
# Full Path to ZoneMinder's socket folder
# The web account user must have full read/write permission to this
folder.
# répertoire des sockets
# l'utilisateur apache doit en être propriétaire
ZM_PATH_SOCKS=/var/run/zm
# Full path to ZoneMinder's log folder
# The web account user must have full read/write permission to this
folder.
# répertoire des logs
# l'utilisateur apache doit en être propriétaire
ZM_PATH_LOGS=/var/log/zm
# Full path to ZoneMinder's swap folder
# The web account user must have full read/write permission to this
folder.
ZM_PATH_SWAP=/var/tmp/zm
# Full path to optional arp binary
# ZoneMinder will find the arp binary automatically on most systems
ZM_PATH_ARP="/usr/sbin/arp"
#Full path to shutdown binary
ZM_PATH_SHUTDOWN="/sbin/shutdown"
# Path to FFmpeg binary
ZM_PATH_FFMPEG="/usr/local/bin/ffmpeg"
il faudra veiller à ce que l'utilisateur apache soit bien propriétaire de certains répertoires nécessaires au fonctionnement de zoneminder
chown -R apache:apache /var/run/zm
chown -R apache:apache /var/log/zm
chown -R apache:apache /var/lib/zoneminder
chown -R apache:apache /usr/share/zoneminder/www
chown -R apache:apache /var/cache/zoneminder
chown -R apache:apache /etc/zm
accessoirement j'ai créé le lien suivant
ln -s /var/cache/zoneminder/ /usr/share/zoneminder/www/cache
il faudra ensuite modifier la configuration du serveur Apache httpd dans le fichier /usr/local/apache2/conf/httpd/conf, tout d'abord la liste des modules utiles et nécessaires
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule filter_module modules/mod_filter.so
LoadModule mime_module modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule unixd_module modules/mod_unixd.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgid_module modules/mod_cgid.so
LoadModule dir_module modules/mod_dir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php_module
modules/libphp.so
(...)
# le propriétaire du daemon apache/httpd
User apache
Group apache
(...)
#directives spécifiques zoneminder
<Directory "/usr/share/zoneminder/www">
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory "/var/cache/zoneminder">
Options -Indexes +FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<Directory "/usr/share/zoneminder/cgi-bin">
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
AllowOverride All
Require all granted
</Directory>
<Directory "/usr/share/zoneminder/www/api">
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
RewriteBase /zm/api
</Directory>
<Directory "/usr/share/zoneminder/www/api/app">
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
RewriteBase /zm/api
</Directory>
<Directory "/usr/share/zoneminder/www/api/app/webroot">
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteBase /zm/api
</Directory>
#alias zoneminder dans cet ordre précis
ScriptAlias /zm/cgi-bin "/usr/share/zoneminder/cgi-bin"
Alias /zm/cache "/var/cache/zoneminder"
Alias /zm "/usr/share/zoneminder/www"
on veillera également à ce que la variable de la zone horaire du fichier /usr/local/apache2/conf/php.ini soit bien initialisée
date.timezone = Europe/Paris
on relance Apache httpd pour la prise en compte de la mise à jour de ces deux derniers fichiers
systemctl httpd restart
et on lance zoneminder en tapant
systemctl start zoneminder
et voilà ce que renvoie la commande
systemctl status zoneminder
● zoneminder.service - ZoneMinder CCTV recording and security system
Loaded: loaded
(/usr/lib/systemd/system/zoneminder.service; disabled; preset: disabled)
Active: active (running) since Fri 2024-08-09
16:03:47 CEST; 11s ago
Process: 3570 ExecStart=/usr/bin/zmpkg.pl start
(code=exited, status=0/SUCCESS)
Main PID: 3578 (zmdc.pl)
Tasks: 5 (limit: 9239)
Memory: 91.5M
CPU: 2.077s
CGroup: /system.slice/zoneminder.service
├─3578 /usr/bin/perl -wT /usr/bin/zmdc.pl startup
├─3606 /usr/bin/perl -wT /usr/bin/zmfilter.pl --filter_id=1 --daemon
├─3610 /usr/bin/perl -wT /usr/bin/zmfilter.pl --filter_id=2 --daemon
├─3616 /usr/bin/perl -wT /usr/bin/zmwatch.pl
└─3620 /usr/bin/perl -wT /usr/bin/zmstats.pl
août 09 16:03:44 ultra.kervao.fr systemd[1]: Starting
zoneminder.service...
août 09 16:03:47 ultra.kervao.fr systemd[1]: Started zoneminder.service.
On téléchargera la dernière version en tapant la commande
git clone https://github.com/ZoneMinder/ZoneMinder
cela va donner un répertoire ZoneMinder dans lequel on tape
mkdir build
cd build
git submodule update --init --recursive
à ce moment on veillera à avoir installé les packages lib64gsoap-devel et json-devel, on tape ensuite
cmake .. -DMYSQLCLIENT_LIBRARIES=/usr/local/mysql/lib/libmysqlclient.so -DZM_DB_HOST=mariadb-serveur -DZM_WEB_USER=apache -DZM_DIR_EVENTS=/media/motion/events -DZM_CGIDIR=/usr/share/zoneminder/cgi-bin -DCMAKE_INSTALL_PREFIX=/usr/local -DZM_CONFIG_DIR=/etc/zm -DZM_CONFIG_SUBDIR=/etc/zm/conf.d -DZM_PERL_SEARCH_PATH=/usr/share/perl5/vendor_perl -DZM_SYSTEMD=ON -DZM_WEBDIR=/usr/share/zoneminder/www
voici la fin du résultat
-- Found PerlModules: TRUE
-- Using web user: apache
-- Using web group: apache
-- Checking for one of the modules 'polkit-gobject-1;polkit'
-- Checking for module 'glib-2.0'
-- Found glib-2.0, version 2.76.3
-- Found GLIB2: /usr/lib64/libglib-2.0.so
-- Found Polkit: /usr/lib64/libpolkit-gobject-1.so
-- Found OpenSSL: /usr/lib64/libcrypto.so (found suitable version
"3.0.15", minimum required is "1.0.1")
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
INFO Expanding CMAKE_PREFIX_PATH to include package
build dir
Building unit tests: No (default)
-- Optional libraries found: zlib cURL OpenSSL PCRE Mosquitto
Mosquittopp libVLC gsoap
-- Optional libraries not found: libVNC
-- Enabled crypto backend: openssl
-- Enabled JWT backend: jwt_cpp
-- Running ZoneMinder configuration generator
Generating
'/usr/local/linux/securite/ZoneMinder/build/zm_config_defines.h'
Updating '/usr/local/linux/securite/ZoneMinder/build/db/zm_create.sql'
-- ZoneMinder configuration generator completed successfully
-- Configuring done (10.4s)
-- Generating done (0.2s)
-- Build files have been written to:
/usr/local/linux/securite/ZoneMinder/build
on tape alors make puis en tant que root
make install
cp -Rf /root/perl5/lib/perl5/WSDiscovery11
/usr/share/perl5/vendor_perl
cp -Rf /root/perl5/lib/perl5/WSDiscovery10
/usr/share/perl5/vendor_perl
cp -Rf /root/perl5/lib/perl5/WSNotification
/usr/share/perl5/vendor_perl
cp -Rf /root/perl5/lib/perl5/ONVIF /usr/share/perl5/vendor_perl
cp -Rf /root/perl5/lib/perl5/WSNotification/
/usr/share/perl5/vendor_perl
cp -Rf /root/perl5/lib/perl5/ZoneMinder*
/usr/share/perl5/vendor_perl
cp -Rf /root/perl5/lib/perl5/WSSecurity/
/usr/share/perl5/vendor_perl
cp -Rf /root/perl5/lib/perl5/WSDiscovery
/usr/share/perl5/vendor_perl
cp -Rf /usr/share/zoneminder/cgi-bin/zms
/usr/local/apache2/cgi-bin/nph-zms
et pour éviter cette erreur
avril 26 17:49:33 ultra.kervao.fr zmpkg[1997204]: FAT
[Version mismatch, system is version 1.37.66, database is 1.36.35,
please run zmupdate.pl to update.]
avril 26 17:49:33 ultra.kervao.fr systemd[1]: zoneminder.service:
Control process exited, code=exited, status=255/EXCEPTION
avril 26 17:49:33 ultra.kervao.fr systemd[1]: zoneminder.service:
Failed with result 'exit-code'.
avril 26 17:49:33 ultra.kervao.fr systemd[1]: Failed to start
zoneminder.service.
on mettra à jour la base de données de zoneminder en tapant
/usr/local/bin/zmupdate.pl
voici une partie du résultat
Initiating database upgrade to version 1.37.66 from
version 1.36.35
Do you wish to take a backup of your database prior to upgrading?
This may result in a large file in /var/tmp/zm if you have a lot
of events.
Press 'y' for a backup or 'n' to continue : y
Creating backup to /var/tmp/zm/zm-1.36.35.dump. This may take
several minutes.
mysqldump: Deprecated program name. It will be removed in a
future release, use '/usr/local/mysql/bin/mariadb-dump' instead
Database successfully backed up to /var/tmp/zm/zm-1.36.35.dump,
proceeding to upgrade.
Upgrading database to version 1.37.66
Upgrading DB to 1.37.1 from 1.36.35
mysql: Deprecated program name. It will be removed in a future
release, use '/usr/local/mysql/bin/mariadb' instead
(...)
Database successfully upgraded to version 1.37.62.
Upgrading DB to 1.37.63 from 1.36.35
mysql: Deprecated program name. It will be removed in a future
release, use '/usr/local/mysql/bin/mariadb' instead
Database successfully upgraded to version 1.37.63.
Upgrading DB to 1.37.66 from 1.36.35
mysql: Deprecated program name. It will be removed in a future
release, use '/usr/local/mysql/bin/mariadb' instead
Database successfully upgraded to version 1.37.66.
Database upgrade to version 1.37.66 successful.
Voilà l'écran principal avec une caméra rajoutée à partir de la commande Ajouter Caméra avec le mode Modect, c'est à dire qu'il va détecter les mouvements et créer un évènement pour chacun.

Il aura fallu définir la source vidéo de la vue, en mettant le chemin
















Il faut procéder ensuite en tâtonnant pour le reste des paramètres.
Maintenant à la détection d'un évènement la ou les zones concernées seront
indiquées

Le serveur de notification d'évènement "Event Notification Server" ou ZMES est un outil complémentaire à zoneminder, il dispose d'une "machine learning" ou d'un apprentissage automatique qui lui permet de reconnaître les objets, qu'ils soient des personnes ou des voitures par exemples.
Le site officiel est https://github.com/ZoneMinder/zmeventnotification on y récupère les sources qu'on décompresse en tapant
tar xvfz zmeventnotification-6.1.29.tar.gz
cela donne le répertoire zmeventnotification-6.1.29.
On pourra choisir également d'installer la version en développement en
tapant
git clone https://github.com/ZoneMinder/zmeventnotification
On installera d'abord les packages perl-YAML-LibYAML, perl-Crypt-MySQL, perl-Module-Build-Tiny et perl-CPAN-DistnameInfo. Puis avec CPAN
perl -MCPAN -e "install Crypt::Eksblowfish::Bcrypt"
perl -MCPAN -e "install Protocol::WebSocket"
perl -MCPAN -e "install Net::WebSocket::Server"
perl -MCPAN -e "install Net::MQTT::Simple"
voilà une partie du résultat
which: no apt-get in
(/root/perl5:/usr/local/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/usr/local/mysql/bin:/usr/lib64/qt5/bin:/usr/lib64/qt6/bin)
which: no yum in
(/root/perl5:/usr/local/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/usr/local/mysql/bin:/usr/lib64/qt5/bin:/usr/lib64/qt6/bin)
----------- Configured Values ----------------------------
Your distro seems to be ubuntu
Your webserver user seems to be apache
Your webserver group seems to be apache
wget is /usr/bin/wget
installer software is
Install Event Server: prompt
Install Event Server config: prompt
Install Hooks: prompt
Install Hooks config: prompt
Upgrade Hooks config (if applicable): yes
Download and install models (if needed): yes
The Event Server will be installed to /usr/bin
The Event Server config will be installed to /etc/zm
Hooks will be installed to /var/lib/zmeventnotification
sub-folders
Hook config files will be installed to /etc/zm
Models that will be checked/installed:
(Note, if you have already downloaded a model, it will not be
deleted)
Yolo V3 (INSTALL_YOLOV3): yes
TinyYolo V3 (INSTALL_TINYYOLOV3): yes
Yolo V4 (INSTALL_YOLOV4): yes
Tiny Yolo V4 (INSTALL_TINYYOLOV4): yes
Google Coral Edge TPU (INSTALL_CORAL_EDGETPU): no
If any of this looks wrong, please hit Ctrl+C and edit the
variables in this script...
Install Event Server Config [y/N]:y
Replacing ES config & rules file
Success:config copied
Replacing ES rules file
Success:rules copied
====> Remember to fill in the right values in the config
files, or your system won't work! <=============
Install Hook [y/N]:y
Installing pip...
install: opérande de fichier cible manquant après 'pip'
Saisissez « install --help » pour plus d'informations.
Installing python3-opencv...
install: opérande de fichier cible manquant après
'python3-opencv'
Saisissez « install --help » pour plus d'informations.
*** Installing Hooks ***
Checking for YoloV3 data files....
yolov3.cfg exists, no need to download
coco.names exists, no need to download
yolov3.weights exists, no need to download
Checking for TinyYOLOV3 data files...
yolov3-tiny.cfg exists, no need to download
coco.names exists, no need to download
yolov3-tiny.weights exists, no need to download
Checking for TinyYOLOV4 data files...
yolov4-tiny.cfg exists, no need to download
coco.names exists, no need to download
yolov4-tiny.weights exists, no need to download
Checking for YOLOV4 data files...
WARNING:Note, you need OpenCV 4.4+ for Yolov4 to work
yolov4.cfg exists, no need to download
coco.names exists, no need to download
yolov4.weights exists, no need to download
*** Installing push api plugins ***
*** Installing detection scripts ***
*** Installing user contributions ***
Copying over contrib/example.py...
Copying over contrib/ftp_selective_upload.py...
Removing old version of zmes_hook_helpers, if any
Installing new version of hooks
sudo -H pip3 -v install hook/
Using pip 23.0.1 from /usr/lib/python3.10/site-packages/pip
(python 3.10)
Processing ./hook
(...)
Installing package deps...
Installing gifsicle, if needed...
install : option invalide -- 'q'
Saisissez « install --help » pour plus d'informations.
Skipping Hook install
Install Hook Config [y/N]:y
Replacing Hook config file
Success:config copied
====> Remember to fill in the right values in the config
files, or your system won't work! <=============
====> If you changed /etc/zm remember to fix
/var/lib/zmeventnotification/bin/zm_event_start.sh! <========
Creating a migrated objectconfig if required
Current version of file is 1.2
Nothing to migrate
*** Please remember to start the Event Server after this update
***
Il faudra modifier ou créer des fichiers sous /etc/zm tout
d'abord secrets.ini qui contiendra
[secrets]
# l'URL pour accéder à zoneminder https://ultra.kervao.fr/zm est à
adapter, l'utilisateur et le mot de passe de connexion sont définis
dans la page de configuration système
ZMES_PICTURE_URL=https://ultra.kervao.fr/zm/index.php?view=image&eid=EVENTID&fid=objdetect&width=600
ZM_USER=zm-user
ZM_PASSWORD=password
ZM_PORTAL=https://ultra.kervao.fr/zm
ZM_API_PORTAL=https://ultra.kervao.fr/zm/api
# certificat et clé pour une connexion ssl, j'ai réutilisé celles de
mon serveur apache
ES_CERT_FILE=/etc/ssl/public/apache.crt
ES_KEY_FILE=/etc/ssl/apache/apache.key
#clé pour la reconnaissance des plaques d'immatriculation, il faudra
créer un compte sur ce site https://platerecognizer.com/
PLATEREC_ALPR_KEY=cb5ece0dhkhg1bea8dfd08408ec6cb8370d6c3b5c
On modifiera maintenant le fichier /etc/zm/objectconfig.ini qui contiendra (extraits)
(...)
secrets = /etc/zm/secrets.ini
# portal/user/password are needed if you plan on using ZM's legacy
# auth mechanism to get images
# ne rien modifier il va chercher dans le fichier secrets.ini
portal=!ZM_PORTAL
user=!ZM_USER
password=!ZM_PASSWORD
# api portal is needed if you plan to use tokens to get
images
# requires ZM 1.33 or above
api_portal=!ZM_API_PORTAL
# ce paramètre doit être mis à yes en cas de connexion chiffrée avec
certificat auto signé
allow_self_signed=yes
(...)
# If you need basic auth to access ZM
#si le répertoire est protégé par mot de passe avec un .htaccess on
indiquera le mot de passe ici
basic_user=login-apache
basic_password=password-apache
(...)
# API/password for remote gateway
ml_user=!ML_USER
ml_password=!ML_PASSWORD
(...)
# la clé pour la reconnaissance des plaques, idem au fichier
secrets.ini
alpr_key=cb5ece0dhkhg1bea8dfd08408ec6cb8370d6c3b5c
On modifier maintenant /etc/zm/zmeventnotification.ini
[ssl]
# Enable SSL (default: yes)
enable = yes
#idem clé dans le fichier secrets.ini
cert = /etc/ssl/public/apache.crt
key = /etc/ssl/apache/apache.key
Maintenant dans les options et configuration système on cochera les cases OPT_USE_API et OPT_USE_EVENTNOTIFICATION
On relance zoneminder et on lance ZMES en tapant
sudo -u apache /usr/bin/zmeventnotification.pl
voilà le résultat
Use of uninitialized value $first_arg in string eq at
./zmeventnotification.pl line 62.
27/10/2024 17:31:03.690121 zmeventnotification[163691].INF [main:330]
[Running on WebSocket library version:0.004]
27/10/2024 17:31:07.018532 zmeventnotification[163691].INF [main:1010]
[PARENT: using config file: /etc/zm/zmeventnotification.ini]
27/10/2024 17:31:07.833499 zmeventnotification[163691].INF [main:1010]
[PARENT: using secrets file: /etc/zm/secrets.ini]
Use of uninitialized value $es_debug_level in numeric ge (>=) at
./zmeventnotification.pl line 999.
Use of uninitialized value $es_debug_level in numeric ge (>=) at
./zmeventnotification.pl line 999.
Use of uninitialized value $skip_monitors in split at
./zmeventnotification.pl line 543.
Use of uninitialized value $es_debug_level in numeric ge (>=) at
./zmeventnotification.pl line 999.
Use of uninitialized value $hook_skip_monitors in split at
./zmeventnotification.pl line 732.
avec un évènement
27/10/2024 17:31:26.558583 zmeventnotification[163691].INF
[main:1010] [PARENT: Push enabled via FCM]
27/10/2024 17:31:26.558734 zmeventnotification[163691].INF [main:1010]
[PARENT: MQTT Disabled]
27/10/2024 17:31:26.558814 zmeventnotification[163691].INF [main:1010]
[PARENT: |------- Starting ES version: 6.1.29 ---------|]
Can't ignore signal CHLD, forcing to default.
27/10/2024 17:31:49.322211 zmeventnotification[163691].INF [main:1010]
[PARENT: Event Notification daemon v 6.1.29 starting]
27/10/2024 17:31:50.349988 zmeventnotification[163691].INF [main:1010]
[PARENT: Re-loading monitors]
Use of uninitialized value in concatenation (.) or string at
./zmeventnotification.pl line 1453.
27/10/2024 17:31:54.071086 zmeventnotification[163691].INF [main:1010]
[PARENT: New event 380 reported for Monitor:4 (Name:Camera-4)
Motion[last processed eid:]]
27/10/2024 17:31:56.427281 zmeventnotification[163691].INF [main:1010]
[PARENT: Secure WS(WSS) is enabled...]
27/10/2024 17:31:56.427365 zmeventnotification[163691].INF [main:1010]
[PARENT: Web Socket Event Server listening on port 9000]
pour l'activer en tant que service systemd, on va créer le fichier /usr/lib/systemd/system/zmes.service qui contiendra
[Unit]
Description=ZMES
After=zoneminder.service
Requires=zoneminder.service httpd.service
[Service]
User=apache
Type=simple
ExecStart=/usr/bin/zmeventnotification.pl
Restart=on-failure
[Install]
WantedBy=multi-user.target
on l'activera en tapant
systemclt enable zmes
on le lance en tapant
systemctl start zmes
voici son statut en tapant
systemctl status zmes
● zmes.service - ZMES
Loaded: loaded
(/usr/lib/systemd/system/zmes.service; disabled; preset: disabled)
Active: active (running) since Thu 2024-10-31
10:43:42 CET; 36s ago
Main PID: 243499 (zmeventnotifica)
Tasks: 1 (limit: 9239)
Memory: 46.3M
CPU: 784ms
CGroup: /system.slice/zmes.service
└─243499 /usr/bin/perl -T /usr/bin/zmeventnotification.pl
oct. 31 10:43:42 ultra.kervao.fr systemd[1]: Started zmes.service.
oct. 31 10:43:42 ultra.kervao.fr zmeventnotification.pl[243499]: Use
of uninitialized value $first_arg in string eq at
/usr/bin/zmeventnotification.pl line 61.
oct. 31 10:43:43 ultra.kervao.fr zmeventnotification.pl[243499]: Use
of uninitialized value $es_debug_level in numeric ge (>=) at
/usr/bin/zmeventnotification.pl line 998.
oct. 31 10:43:43 ultra.kervao.fr zmeventnotification.pl[243499]: Use
of uninitialized value $es_debug_level in numeric ge (>=) at
/usr/bin/zmeventnotification.pl line 998.
oct. 31 10:43:43 ultra.kervao.fr zmeventnotification.pl[243499]: Use
of uninitialized value $skip_monitors in split at
/usr/bin/zmeventnotification.pl line 542.
oct. 31 10:43:43 ultra.kervao.fr zmeventnotification.pl[243499]: Use
of uninitialized value $es_debug_level in numeric ge (>=) at
/usr/bin/zmeventnotification.pl line 998.
oct. 31 10:43:43 ultra.kervao.fr zmeventnotification.pl[243499]: Use
of uninitialized value $hook_skip_monitors in split at
/usr/bin/zmeventnotification.pl line 731.
oct. 31 10:43:44 ultra.kervao.fr zmeventnotification.pl[243505]: Can't
ignore signal CHLD, forcing to default.
Et voilà ce que ça va donner au niveau de l'interface, on voit qu'il a identifié des personnes et un véhicule (truck).



En cas de mise à jour de zoneminder, la base de donnée ne sera pas forcément dans le bon format et au lancement vous pourriez avoir un message comme celui-ci
Version mismatch, system is version 1.36.35, database is 1.36.33,
please run zmupdate.pl to update
Dans ce cas avec un serveur MariaDB j'ai d'abord créé les
liens suivants
ln -s /usr/local/mysql/bin/mariadb-dump /usr/local/bin/mysqldump
ln -s /usr/local/mysql/bin/mariadb /usr/local/bin/mysql
ensuite on tape
/usr/bin/zmupdate.pl
voilà le résultat
Initiating database upgrade to version 1.36.35 from version
1.36.33
Do you wish to take a backup of your database prior to upgrading?
This may result in a large file in /var/tmp/zm if you have a lot of
events.
Press 'y' for a backup or 'n' to continue : y
Creating backup to /var/tmp/zm/zm-1.36.33.dump. This may take
several minutes.
mysqldump: Deprecated program name. It will be removed in a future
release, use '/usr/local/mysql/bin/mariadb-dump' instead
Database successfully backed up to /var/tmp/zm/zm-1.36.33.dump,
proceeding to upgrade.
Upgrading database to version 1.36.35
Upgrading DB to 1.36.34 from 1.36.33
mysql: Deprecated program name. It will be removed in a future
release, use '/usr/local/mysql/bin/mariadb' instead
Database successfully upgraded to version 1.36.34.
Database upgrade to version 1.36.35 successful.
C'est bon c'est terminé, on peut à nouveau lancer et utiliser zoneminder.
Il est possible d’accéder à zoneminder à partir d’un mobile dès lors que vous avez activé votre serveur LAMP pour être visible sur internet comme indiqué ici et si possible avec une connexion chiffrée comme expliquée par là.
L’affichage sur le mobile n’est pas formidable et pas très convivial comme on peut le voir ci-dessous:
![]() |
![]() |
Il se trouve qu’il existe une application adhoc qui s’appelle zmNinja. Alors certes cela coûte la modique somme de 4,69€ mais ça vaut le coup d’investir pour si peu pour avoir une visualisation confortable sur mobile.
Tout d’abord sous zoneminder j’ai procédé à quelques configurations pour sécuriser l’accès. J’ai d’abord créé des utilisateurs, un compte admin classique et un compte limité utilisateur.
Ensuite dans les paramètres au niveau de système j'ai activé l'authentification de zoneminder en cochant les cases ci-dessous.
Ensuite tout se passe sur le mobile, où on commence à indiquer l’URL et les mots de passe.
Pour activer la clé Google Coral avec ZoneMinder, on
relancer l'installation de zmes en spécifiant qu'on l'utilise en
tapant en tant que root
cd zmeventnotification-6.1.29
INSTALL_CORAL_EDGETPU=yes ./install.sh
voilà le résultat
which: no apt-get in
(/root/perl5:/usr/local/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/usr/local/mysql/bin:/usr/lib64/qt5/bin:/usr/lib64/qt6/bin)
which: no yum in
(/root/perl5:/usr/local/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/usr/local/mysql/bin:/usr/lib64/qt5/bin:/usr/lib64/qt6/bin)
----------- Configured Values ----------------------------
Your distro seems to be ubuntu
Your webserver user seems to be apache
Your webserver group seems to be apache
wget is /usr/bin/wget
installer software is
Install Event Server: prompt
Install Event Server config: prompt
Install Hooks: prompt
Install Hooks config: prompt
Upgrade Hooks config (if applicable): yes
Download and install models (if needed): yes
The Event Server will be installed to /usr/bin
The Event Server config will be installed to /etc/zm
Hooks will be installed to /var/lib/zmeventnotification
sub-folders
Hook config files will be installed to /etc/zm
Models that will be checked/installed:
(Note, if you have already downloaded a model, it will not be
deleted)
Yolo V3 (INSTALL_YOLOV3): yes
TinyYolo V3 (INSTALL_TINYYOLOV3): yes
Yolo V4 (INSTALL_YOLOV4): yes
Tiny Yolo V4 (INSTALL_TINYYOLOV4): yes
Google Coral Edge TPU (INSTALL_CORAL_EDGETPU): no
If any of this looks wrong, please hit Ctrl+C and edit the
variables in this script...
Install Event Server [y/N]:y
*** Installing ES Dependencies ***
install libconfig-inifiles-perl libcrypt-mysql-perl
libcrypt-eksblowfish-perl libmodule-build-perl libyaml-perl
libjson-per liblwp-protocol-https-perl libgeos-devl
install: cible 'libyaml-perl': Aucun fichier ou dossier de ce type
./install.sh: ligne 208: apt-cache : commande introuvable
You will have to install Net::WebSocket::Server using cpan.
*** Installing ES ***
Success:Completed, but you will still have to install ES
dependencies as per
https://zmeventnotification.readthedocs.io/en/latest/guides/install.html#install-dependencies
Install Event Server Config [y/N]:y
Replacing ES config & rules file
Success:config copied
Replacing ES rules file
Success:rules copied
====> Remember to fill in the right values in the config files,
or your system won't work! <=============
Install Hook [y/N]:y
Installing pip...
(...)
[object]
# Updated note: Don't use use_sequence=no. No longer supported
reliably
# If you are using legacy format (use_sequence=no) then these
parameters will
# be used during ML inferencing
object_detection_pattern=(person|car|motorbike|bus|truck|boat)
object_min_confidence=0.3
object_framework=coral_edgetpu
object_processor=tpu
object_weights={{base_data_path}}/models/coral_edgetpu/ssd_mobilenet_v2_coco_quant_postprocess_edgetpu.tflite
object_labels={{base_data_path}}/models/coral_edgetpu/coco_indexed.names
# Google Coral
# The mobiledet model came out in Nov 2020 and is supposed to
be faster and more accurate but YMMV
tpu_object_weights_mobiledet={{base_data_path}}/models/coral_edgetpu/ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite
tpu_object_weights_mobilenet={{base_data_path}}/models/coral_edgetpu/ssd_mobilenet_v2_coco_quant_postprocess_edgetpu.tflite
tpu_object_labels={{base_data_path}}/models/coral_edgetpu/coco_indexed.names
tpu_object_framework=coral_edgetpu
tpu_object_processor=tpu
tpu_min_confidence=0.6