Zoneminder



I GAVE UP TRYING TO GET THIS TO WORK RELIABLY!


Running

zoneminder runs as a systemd server, so can be stopped, started and restarted using systemctl.

Documentation

Documentation website

User guide

FAQ

Installation guide

Wiki

Installation

Installation was tricky. I had already installed ZoneMinder 1.32 several years ago, but it no longer worked (error 500 wen trying to view the home page).

I tried purging the installation and re-installing from the latest Ubuntu:

apt purge zoneminder
apt autoremove
apt update
apt install zoneminder

but this had the same (error 500) problem.

I tried installing from Isaac Connor's repository as recommended on the ZoneMinder download page:

add-apt-repository ppa:iconnor/zoneminder-1.36
apt update
apt install zoneminder

but the installation failed with dependency conflicts. So I removed the repository and various other files found using 'locate':

add-apt-repository -r ppa:iconnor/zoneminder-1.3
rm /etc/apt/trusted.gpg.d/iconnor-ubuntu-zoneminder-1_36.gpg
rm /etc/apt/trusted.gpg.d/iconnor-ubuntu-zoneminder-1_36.gpg~
rm -rf /var/cache/zoneminder/

The /var/cache directory dated from the original installation in 2019, so I suppose it may have caused problems with later attempts at installation.

I tried downloading the Ubuntu 22-04 package from the Zoneminder download page and installing that:

dpkg -i ~fog/Downloads/zoneminder_1.36.35~20241022.27-jammy_amd64.deb

This produced a long list of unmet dependencies, which I couldn't install because of dependency conflicts.

Attempted major cleanup:

apt --fix-broken install
apt purge zoneminder
apt autoremove
mysqladmin --defaults-file=/etc/mysql/debian.cnf -f drop zm
rm -rf /var/log/zm/
apt purge zoneminder-doc
rm -rf /usr/share/doc/zoneminder
rm /var/lib/doc-base/documents/zoneminder-doc
rm /var/lib/dpkg/info/zoneminder-doc.list
rm -rf /home/fog/.config/zmninjapro
rmdir /var/tmp/zm
rm -rf /www/zm

Tried installing the Ubuntu package again:

apt update
apt install zoneminder
a2enconf zoneminder
systemctl reload apache2

but still got error 500.

I decided to investigate the error 500 instead ot trying alternative installation sources. The PHP error log contained:

WARNING: ZoneMinder configuration file found but is not readable. Check file permissions on /etc/zm/zm.conf

The permissions were -rw-r----- and it was owned by 'root', so the web server couldn't read it. I changed the permissions to -rw-r--r-- and tried again. Now get:

ZoneMinder Error
Unable to connect to ZM db using dsn mysql:host=localhost;dbname=zm
SQLSTATE[HY000] [1049] Unknown database 'zm'

Found the following in the ZoneMinder forum:

mysql mysql < /usr/share/zoneminder/db/zm_create.sql
mysqladmin reload
mysql mysql
grant select,insert,update,delete on zm.* to 'zmuser'@localhost identified by 'zmpass';
\q

to create the zm database.

Success at last!

Configuration

Following guidance from ZoneMinder's Getting Started.

Timezone

Set Options->System->TIMEZONE to Europe:London.

Authentication

Probably don't need this since I'm not planning to expose sage's website to the internet, but set ut up anyway.

Enabled Options->System->OPT_USE_AUTH.

Set Options->System->AUTH_HASH_SECRET. Had to login as user admin password admin afterwards.

Used Options->Users->admin to change the admin password, set the language to en_gb.

Add Foscam C1 camera

Clicked ADD button, and setup as:

General:
    Name: Foscam
    Source type: Ffmpeg
    Function: Modect
Source:
    Source Path: rtsp://<user>:<password>@192.168.183.12:554/videoMain
    Capture Resolution: 1280x720 720p  (selected from drop-down list)
ONVIF (don't whether setting this actually did anything!)
    ONVIF_URL: 192.168.183.12:888
    Username: macsof
    Password: ********

Options->System

Enabled OPT_USE_EVENTNOTIFICATION to enable the Event Notification Server.

Disabled SYSTEM_SHUTDOWN - don't a ZM admin user to shut down sage.

Options->Email

Enabled OPT_EMAIL to get emails sent for events.

Entered MESSAGE_ADDRESS: zoneminder@tinhaze.co.uk

Entered EMAIL_HOST: granite.wingpath.co.uk

Entered FROM_EMAIL: zoneminder@sage.wingpath.co.uk

Entered URLhttps://sage.wingpath.co.uk/zm

Filters


Logging

Logging can be configured under Options->Logging.

Errors appear to be sent to /var/log/syslog.

Other logging goes to files in /var/log/zm/.

Bug fixes

Created file /etc/zm/conf.d/10-fog.conf'containing:

ZM_PATH_ZMS=/zm/cgi-bin/zms

to fix stupid setting of /zm/cgi-bin/zms in /etc/zm/conf.d/01-system-paths.conf.
Not surpisingly, zms hadn't been running!

Foscam C1 camera

I have downloaded the user manual.

I can't login to the Foscam web interface (I think it needs ActiveX, which isn't supported by browsers now).

However, it has a "cgi-bin" interface, which allows getting and setting of configuration options using URL parameters.
For example, the following gets the contrast, brightness, etc:

http://192.168.183.12:88/cgi-bin/CGIProxy.fcgi?usr=macsof&pwd=knarf1&cmd=getImageSetting

resulting in:

<CGI_Result>
    <result>0</result>
    <brightness>60</brightness>
    <contrast>48</contrast>
    <hue>50</hue>
    <saturation>56</saturation>
    <sharpness>48</sharpness>
    <denoiseLevel>50</denoiseLevel>
</CGI_Result>

Used getInfraLedConfig to check that IR LEDs are controlled automatically.

Used setPwrFreq&freq=0 to ensure that power frequency is set to 50Hz. I couldn't find a way to check the power frequency.