This go around, I went looking for something with x86 hardware. It needed to be relatively cheap, but the cpu needed to be strong enough to run three 1080p cameras. I settled on the HP Slimline 450. This machine has 8GB of ram, an Intel J2900 cpu, and 1TB traditional hard drive.
PROS: | CONS: |
|
|
|
|
|
|
| |
|
Either during the installation or after, you will want to partition your hard drive to allow a large partition dedicated solely to ZoneMinder's event storage. This is how I partitioned the 1TB drive included with the HP Slimline:
sda1 256MB fat16 /boot/efi
sda2 30.0GB ext4 /
sda3 1023MB linux-swap
sda4 969GB ext4 /var/lib/zoneminder/events
A desktop gui is not needed for a ZoneMinder server to operate. It's up to you if you want to run one, but I usually turn it off with the following command:
sudo systemctl set-default multi-user.targetGet all your updates:
sudo dnf updateNow head on over to zmrepo and follow the instructions there to install ZoneMinder:
wget http://zmrepo.zoneminder.com/f/25/i386/zmrepo-25-1.fc25.noarch.rpmNext, open the ZoneMinder readme with your favorite text editor: /usr/share/doc/zoneminder/README.Fedora. Follow all the instructions in the readme, precisely. The steps are written such that, if you want to just go with the defaults, you can simply copy and paste the commands from the readme directly into the command line. Stop when you reach the point which states to start ZoneMinder. We need to setup the event folder before we start ZoneMinder. Let's do that now.
sudo dnf install --nogpgcheck zmrepo-25-1.fc25.noarch.rpm
sudo dnf install zoneminder
In my case, sda4 will be the mount point for the events folder. First, we need to find the uuid of the partition. One way to determine that is to look in the following folder:
$ ls -l /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 10 Mar 21 12:26 71575691-6216-4a97-89e8-07ee4737bae8 -> ../../sda2
lrwxrwxrwx 1 root root 10 Mar 21 12:26 a534fdca-53d2-4cfe-bc5f-101c51e83230 -> ../../sda4
lrwxrwxrwx 1 root root 10 Mar 21 12:26 B5F4-E54A -> ../../sda1
lrwxrwxrwx 1 root root 10 Mar 21 12:26 f0483f2b-01e6-4b56-94c8-723e0187a03a -> ../../sda3
I have highlighted my uuid in red. Naturally, yours will be different. Now that we know the uuid, create the file /etc/systemd/system/var-lib-zoneminder-events.mount and add the following to it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # systemd mount unit for ZoneMinder event storage [Unit] Description=systemd mount unit for ZoneMinder event storage Before=zoneminder [Mount] What=/dev/disk/by-uuid/put_the_uuid_of_sda4_here Where=/var/lib/zoneminder/events Type=ext4 Options=defaults,noatime,commit=120,data=writeback [Install] WantedBy=multi-user.target |
Enable and start the mount unit
sudo systemctl enable var-lib-zoneminder-events.mountAssuming the mount unit started successfully, set the proper folder permissions so ZoneMinder can write to the events folder:
sudo systemctl start var-lib-zoneminder-events.mount
sudo chown -R apache:apache /var/lib/zoneminder/eventsSince the events partition is on the same disk as the boot partition, the following step is not necessary, but lets go through the motions anyway. I'll explain why afterwards.
Copy the zoneminder systemd service file to /etc/systemd/system
sudo cp /usr/lib/systemd/system/zoneminder.service /etc/systemd/system/Using your favorite editor, add the following line under the [Unit] block, inside the zoneminder service file:
Requires=var-lib-zoneminder-events.mountSave the file, then reload for good measure:
sudo systemctl daemon-reloadWhy did we do this? What this does is prevent ZoneMinder from starting, should the event partition fail to mount for some reason. Since this partition is on the same physical disk as the boot volume, realistically this change is not all that helpful. However, this is much more useful if your event partition is on another disk, volume, or network share.
That's it. You should be good to go. Start ZoneMinder, and then begin adding your cameras from the web console:
sudo systemctl start zoneminder
Performance
Here is a summary using sysbench:- cpu - 40.9765s
- event storage drive - 1.5833Mb/sec
- database - 927.08 transactions per sec
Cameras
As you can see from the table below, the results were better than expected. Neither memory consumption nor cpu use were a concern. I did not have a 720p camera available at the time so I don't have data for that row.camera | format | resolution | fps | ring buffer (frames) | mmap (MB) | Max swap buffer (MB) | Zmc (%) | Zma (%) | Zms (%) |
Airlink777W | mjpeg | VGA | 5 | 35 | 42 | 24 | 5 | 5 | 10 |
raspicam | h264 | 720p | 5 | 35 | 124 | 74 | -- | -- | -- |
USGLBH245S400 | h264 | 1080P | 5 | 35 | 277 | 176 | 25 | 10 | 25 |
For a quad core machine, the system load should be kept under 3. This allows necessary wiggle room for ordinary operating system tasks. Taking that and the data from the table into account, the theoretical maximum number of 1080p cameras @5fps on this machine is 8. However, this is untested. With that many HD cameras, other factors, such as disk i/o, may require that fewer cameras be used.
Conclusion
There is a certain cool-factor when it comes to projects on single board arm computers, but that comes with the additional requirement of having to manage the machine's limited resources. The sysadmin must carefully design the system and monitor it much more closely than if using traditional Intel x86 hardware.
While not nearly as small, nor as cool, as a single board arm computer, the HP Slimline 450 is an excellent choice for a small surveillance system requiring just a handful of HD IP cameras. One does not have to worry about using up all the ram or blowing up the cpu.