Saturday, February 5, 2011

Digital Camera Surveillance with ZoneMinder

Quick side-trip to explore a usable video surveillance system:
  • A video camera with reasonably clear video
  • A PC running software to collect the video
  • Motion detection, so you don't have to go through years and years of video to get to your one event,
  • Event logging, so you can track when that motion happened and find it easily
  • A good web interface so you don't need remote software to access the server
  • The ability to post alerts out via the internet, or even send images to a remote device, like a smartphone

http://www.zoneminder.com meets all these requirements handily.  Turns out there's a delicious little virtual machine available for trying out ZoneMinder, so that you don't have to build up a full-custom machine to try it out. I had VMware Player already installed - getting the VM up and running only took about 15 minutes, and that includes the time it took to search the web to fix the VM...

Get VMware Player

Download VMware Player for free from http://www.vmware.com. If you have VMware Player up and running, you can then host virtual machines, try stuff out, and leave your important, fundamental desktop system configuration untouched and pristine. Nice stuff.

Get the ZoneMinder Virtual Machine

You can find this VM at http://www.vmware.com/appliances/directory/86653. There's some good initial information at the VMware page, but to download it, VMware links you to: http://viktorpetersson.com/open-source/zoneminder-virtual-appliance/. The VM runs OK under VMware Player:



There's a problem with the file /etc/udev/rules.d/70-persistent-net.rules. It has a bug in it. It should read "eth0" at the end, not "eth1". (it is fixed already in this image) You can fix this two ways:

Easy: edit the file, change "eth1" to "eth0" at the end. Save the file, reboot the VM. 

Slightly More Manly, No Reboot:
/etc/udev/rules.d/70-persistent-net.rules contains the MAC address to eth device mappings. Delete the lines like below, noting the module name on the "# PCI device" line:

#PCI device 0x1022:0x2000 (pcnet32
SUBSYSTEM=="net", ACTION=="add"....NAME="eth1"

This removes the MAC to eth1 device mapping info - you want it to map to "eth0" so the network on the VM will start up when it boots. 

Restart udev to allow the change to take effect:

/etc/init.d/udev restart
Bounce the kernel module for the ethernet device. Use the module name from the 70-persistent-net.rules file noted above:

modprobe -r module
modprobe module

"ifconfig" should now show the eth0 interface as up and running.

A Good Webcam To Choose
 
The text in the notes of the ZoneMinder VM suggests trying it out with a network camera. I tried out the Linksys WVC80N. Most cool is that it's a NETWORK camera - you plug it into an ethernet and it serves up images across your network. Here's how to configure it in ZoneMinder:


The username: admin and password: admin are default for the WVC80N.  Here's what's needed to make it work:

Remote Host Name
Remote Host Path
Capture Width
Capture Height

Here's the camera control webpage under ZoneMinder:


The camera always comes up amber colored when it's in "monitor" mode. If you set it to "Modect", or motion detection, it will go green. You can see all the events I've already captured just in testing. "Modect" works great. Here's what the "event capture" web screen looks like:


To Learn More:

Getting ZoneMinder:
http://www.zoneminder.com

Some config tips for the Linksys camera. Outdated, but serves as a good pointer:
http://www.zoneminder.com/wiki/index.php/Linksys

Cisco's WVC80N FAQ
http://www6.nohold.net/Cisco2/ukp.aspx?pid=80&login=1&app=search&vw=1&articleid=20535

Download a VM to try out ZoneMinder:
http://viktorpetersson.com/open-source/zoneminder-virtual-appliance/

Fixing the broken VM so it will run:
http://ubuntuforums.org/showthread.php?t=255018

Using basic webcams with ZoneMinder:
http://www.linuxscrew.com/2007/11/05/howto-home-video-security-with-zoneminder-and-ubuntu/

Brian Klug did a great writeup on making his ZoneMinder installation work well:
http://www.brianklug.org/2010/01/zoneminder/

5 comments:

  1. Note to self: this article is obsolete. New version of zoneminder, 1.25.0. Big improvements! New versions of Ubuntu, and new version of the pre-built VM. The link to "linuxscrew" appears to no longer exist.

    I've built a new VM on CentOS 5.7 for ZM 1.25.0. works nicely. Will document this and an Ubuntu install after finishing the power monitoring system.

    ReplyDelete
  2. James do you still use zoneminder? I'm trying to set up a VM (Ubuntu based) and have had some snags... namely my 2 webcams (one old one new) and now a Trendnet Wireless IP Cam are all displaying in other apps on Ubuntu, but just not through ZM. I've messed with mjpeg-streamer some, but it also doesn't like ZM.

    I heard about VM's others were offering for download and wondered how far you'd gotten? Any tips appreciated!

    ReplyDelete
  3. Steve - my abject apologies for missing your posting! I just now got your email regarding ZM on an Ubuntu VM....

    ReplyDelete
  4. Hey Steve!

    I do use Zoneminder in an Ubuntu virtual machine - I have a few low-cost webcams I'm using for "less critical" surveillance (not security - we have ducks and rabbits - I use the ZM cameras to watch them to make sure they are OK)

    Some comments:

    1) I tried one of the prefab ubuntu VM's the very first time I tried Zoneminder. I got it to work, but geez it was a TON of work, and it didn't work very well - sometimes it would crash if I wasn't careful to clear out the captured video down to the last two weeks.

    2) I actually got way better results and it was no more difficult, to install Ubuntu myself into a virtual machine, install ZoneMinder, and configure ZM from the ZM Wiki notes on how to do it. I'm using a Linksys WVC80N IP cam and it works. I had to do what I consider a "lot" of websurfing to get the Secret Sauce, but it works and it's actually reasonably reliable. Not "quite as good" as the Logitech Alert cams I have, but that's because the Logitech Alert cameras are way, way, way better in quality than the cheapie little webcams I'm using with ZoneMinder.

    3) Side note: I have never gotten the Logitech Alert webcams to work with ZoneMinder. I use the Logitech cams with the Logitech Alert Commander. I depend on that system for security and don't want to monkey with it.

    So, to loft your system, I'm thinking:

    - install Ubuntu yourself into a Virtual Machine, don't worry so much about getting somethng preconfigured with ZoneMinder. (I NEVER got that to work reliably and gave up on a "pre-configured" VM for ZM.) I'm assuming you've already been successful at getting a VM server (ESXi or whatever) stood up - both hardware and software - right? If you've had any problems with that, talk to me. Tell me what you've got for a VM server. I'm using free ESXi 5 on plain PC hardware (I can tell you what the hardware is if you need.) and it works fine. I'm able to install an Ubuntu ISO onto an ESXi virtual machine no problems, piece of cake. I'm able to test that virtual machine has network access by web-surfing from it and pinging my other systems in the house.

    - Install and configure ZoneMinder. I would not call this a "trivial" task, but it's not impossible, and I'm glad to ride along with you while you do so.

    - The Secret Sauce in ZoneMinder is the little "camera config menus". Your TrendNet camera ought to work just fine, as I believe that TrendNet IP cam is one of the main ones talked about in the ZoneMinder wiki. I would take a shot at working with it first. Lord have mercy, you ought not have to worry with mjpeg-streamer to get your Trendnet to work.

    Talk to me, tell me if what I've said is useful. I'm glad to help if I can.

    JKB

    ReplyDelete
  5. I've also responded to Steve directly via email...

    ReplyDelete