I've added the following to the wiki. Don't hate me for this - it works!
http://www.zoneminder.com/wiki/index.ph ... g_Monitors
Automatically Adding Monitors
I recently had cause to want to add monitors to Zoneminder automatically. This is how I did it. It's probably not the correct way - I got it working through trial and error (never the most compatible method) and I'm a somewhat cavalier coder, and others are welcome to edit this page and improve the procedure, but it does work.
DISCLAIMER! This could hose your database. If Zoneminder's schema changes in the future, it almost certainly will. Use at your own risk!
Reason: I manage over a 100 CCTV cameras across five sites via bespoke perl cgi software. This display and arrange direct mjepg feeds (described in IpCamMontage ), and I wanted to be able to control my various remote zoneminder servers using that. Managing this directly is time consuming, and should a server go down it's a right faff to set up again. This way would allow me to re-configure a server instantly. I could also use it to set various configurations.
Firstly, add a user to mysql with write permissions to the ZM database and if your software isn't local, allow them to connect from anywhere/your control server using a decent password.
Then simply issue a mysql INSERT such as;
INSERT INTO Monitors SET name = 'Camera_Name', type='Remote', Port='80', host='10.10.10.5', path = '/videostream.cgi?user=username&pwd=password', width='640', height='480', Function = 'Mocord', MaxFPS = '5.00', AlarmMaxFPS = '5.00', Protocol = 'http', Method = 'simple', Palette = '3'
The above is enough (with ZM 1.25) to add a new monitor to Zoneminder. In this case, for a Foscam-compatible camera at 10.10.10.5, using mjpeg with a camera user/pass of username/password in VGA colour - using Mocord at 5fps.
If you happen to have Zoneminder's console open, nothing will happen until it refreshes, or you force a refresh, then the new monitor will show. Zoneminder won't immediately activate it, but after a minute or so will notice this monitor and that it's not doing anything, and start it.
And of course, by directly manipulating the database, you can set statuses and delete monitors too. (I find the Zoneminder way of automatically setting statuses for day/night rather clunky and tiresome to keep up to date with changing monitors). By issuing db commands directly, you can of course control it as much as you like.
If you're a strict coder and the above fills you with horror, well, I do understand.
Add any particular hints or tricks you have found to help with your ZoneMinder experience.
1 post • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 2 guests