Import of monitors fails
Import of monitors fails
I have a 1.36 ZM on Ubuntu server 22.04.2 inside a VMware VM. Runs great... but I way over estimated RAM and storage needs. I built a new VM to fit better and used phpmyadmin web to export the Monitors to a SQL file. When I try to import the Monitors file on the new ZM (all same versions) it fails and then messes up the database so I can't even add monitors manually. Is there a easy way to do this? It is probably something simple that I'm missing but I am not a database person at all so I don't really know what is wrong here. I have 135 cameras on here I don't want to add the manually.
Re: Import of monitors fails
Completely different question for my own curiosity, Why did you build a new VM?
When I refresh my ZM test server I backup the DB and restore. I do not have access at the moment to the command I use, but I do not backup the events. This moves the config to the test server. I found the command in one to the wiki pages if I remember correctly.
When I refresh my ZM test server I backup the DB and restore. I do not have access at the moment to the command I use, but I do not backup the events. This moves the config to the test server. I found the command in one to the wiki pages if I remember correctly.
Andy
o||||o
Ubuntu 22.04
ZM 1.36.33
E5-1650-v4 Xeon
16 GB RAM
6 cameras -> 54 FPS modect
o||||o
Ubuntu 22.04
ZM 1.36.33
E5-1650-v4 Xeon
16 GB RAM
6 cameras -> 54 FPS modect
Re: Import of monitors fails
I needed less RAM and didn't want to mess with the some of the config that ubuntu does depending on how much RAM is installed. Just thought it would be cleaner.... but I guess I could just mount a new RDM disk to the VM, format it, and start recording events there. I don't know if I can keep the old disk attached and events available for viewing though and start recording to the new disk. Haven't thought about it much - I just wanted a new clean build.
Re: Import of monitors fails
Ubuntu is so smart. It auto configures stuff based on the amount of RAM at install. It then doesn't seem to notice that you've added more RAM and revisit that ... not so smart, is it?
I got caught on this when it auto-sized my swap (partition?) on install based on the pitiful test-RAM installed in the machine at first install.
Then, once all was seen to be working, I added the proper RAM. Now, I have more RAM than there is swap-space. So, no suspend-to-disk possible. Oh yeah, and it surrounded my swap partition with "everything else" just to make it harder expanding the partition to fix this.
Nice one
-
- Posts: 1322
- Joined: Sat Aug 31, 2019 7:35 am
- Location: San Diego
Re: Import of monitors fails
Maybe that's why it's a swap file now?
Re: Import of monitors fails
Probably. There used to be an issue (chicken and egg, horse and cart) with using a swap *file* that lives in an encrypted file system, which meant you couldn't access the swap *file* early enough in the boot to restore from it. And by the time you could access it (encryption key provided etc) it was too far into a "new boot up" to go back and use the image to restore.
I guess someone sorted out the dependencies, as it does seem to work in 22.04 (combining swap FILE with full disk encryption).
Re: Import of monitors fails
Thanks for the responses... I just came back to check and sounds like that is what I should do rather than build a new system. I think if I just add another storage disk and format it, then it should show up in ZM right? I can just switch each camera to the new storage? What will happen with the old events will they continue to work and go to the old storage? I can then remove it after the retention policy (filter I setup to delete events older than x days) has cleared out all the video.
This is the dedicated storage I have for it... so I presume if I just add another disk, format it, and mount it with the same path it will show up in here? Can I give it the same path? There would be two different mounts for two different UUID's.
This is the dedicated storage I have for it... so I presume if I just add another disk, format it, and mount it with the same path it will show up in here? Can I give it the same path? There would be two different mounts for two different UUID's.
-
- Posts: 1322
- Joined: Sat Aug 31, 2019 7:35 am
- Location: San Diego
Re: Import of monitors fails
I'm not sure zm would understand that.
I know you can mount at /var/cache/zoneminder/events? where ? is a number or anything you want.
But it won't "show up" there - you need to specify the path to the new storage. You can do that either before or after you mount the device.
I know you can mount at /var/cache/zoneminder/events? where ? is a number or anything you want.
But it won't "show up" there - you need to specify the path to the new storage. You can do that either before or after you mount the device.
Re: Import of monitors fails
If you mount the new disk at the same point as the old disk the old events will become inaccessible or Linux will not allow the mount because the directory is not empty. If you change the path to the old events ZM will no longer know where they are located and they will show as inaccessible.
Perhaps you could start a more flexible arrangement?
I mount my disks at /zm/store1, /zm/store2, etc. This allows me to add new disks as needed and re-arrange where the cameras write as I desire.
As long as events are accessible ZM will remove them based on your filter settings.
Perhaps you could start a more flexible arrangement?
I mount my disks at /zm/store1, /zm/store2, etc. This allows me to add new disks as needed and re-arrange where the cameras write as I desire.
As long as events are accessible ZM will remove them based on your filter settings.
Andy
o||||o
Ubuntu 22.04
ZM 1.36.33
E5-1650-v4 Xeon
16 GB RAM
6 cameras -> 54 FPS modect
o||||o
Ubuntu 22.04
ZM 1.36.33
E5-1650-v4 Xeon
16 GB RAM
6 cameras -> 54 FPS modect
Re: Import of monitors fails
So I can't seem to get another hard drive added without ubuntu crashing on boot and going into intramfs. I have the correct UUID so I'm not sure what is going on, but when I exclude it from the fstab then it boots fine.
At this point I'm back to my original desire, to export the 133 cameras I have on my current DVR so I can import them into the new one I just built. Every time i've tried I can't figure out why it won't import.
Ideas?
At this point I'm back to my original desire, to export the 133 cameras I have on my current DVR so I can import them into the new one I just built. Every time i've tried I can't figure out why it won't import.
Ideas?
Re: Import of monitors fails
So I'd like to use phpMyAdmin to export and import the Monitors from one ZM server to another. They are both running 1.36.33
What custom settings should I do for the export and subsequent import?
What custom settings should I do for the export and subsequent import?
Re: Import of monitors fails
I'm trying to do the import avoiding phpMyAdmin. So I used the following command to export:
Then I used WinSCP to grab the file and uploaded it to my new ZM server in /var/tmp. I use the following command to import:
It comes back with error
This doesn't make sense to me. I checked the old server and that folder doesn't exist... so why is this happening? Ideas?
I thought, well maybe if I create a camera on the new ZM server there will be a table there and things created which might then allow the import. Nope... that didn't help either. I'm baffled.
I also tried using phpMyAdmin, exporting the Monitors table and then on the new server, dropping the table and trying to import. Here I get a different error:
So not exactly sure what to do with this...
Code: Select all
mysqldump -u root -p zm Monitors > /var/www/monitors.sql
Code: Select all
mysqlimport -u root -p zm Monitors /var/tmp/monitors.sql
Code: Select all
Error: 13, Can't get stat of '/var/lib/mysql/zm/Monitors' (OS errno 2 - No such file or director), when using table: Monitors
I thought, well maybe if I create a camera on the new ZM server there will be a table there and things created which might then allow the import. Nope... that didn't help either. I'm baffled.
I also tried using phpMyAdmin, exporting the Monitors table and then on the new server, dropping the table and trying to import. Here I get a different error:
Code: Select all
SQL query:
--
-- Database: `zm`
--
-- --------------------------------------------------------
--
-- Table structure for table `Monitors`
--
CREATE TABLE `Monitors` (
`Id` int UNSIGNED NOT NULL,
`Name` varchar(64) NOT NULL DEFAULT '',
`Notes` text,
`ServerId` int UNSIGNED DEFAULT NULL,
`StorageId` smallint UNSIGNED DEFAULT '0',
`Type` enum('Local','Remote','File','Ffmpeg','Libvlc','cURL','WebSite','NVSocket','VNC') NOT NULL DEFAULT 'Local',
`Function` enum('None','Monitor','Modect','Record','Mocord','Nodect') NOT NULL DEFAULT 'Monitor',
`Enabled` tinyint UNSIGNED NOT NULL DEFAULT '1',
`DecodingEnabled` tinyint UNSIGNED NOT NULL DEFAULT '1',
`LinkedMonitors` varchar(255) DEFAULT NULL,
`Triggers` set('X10') NOT NULL DEFAULT '',
`ONVIF_URL` varchar(255) NOT NULL DEFAULT '',
`ONVIF_Username` varchar(64) NOT NULL DEFAULT '',
`ONVIF_Password` varchar(64) NOT NULL DEFAULT '',
`ONVIF_Options` varchar(64) NOT NULL DEFAULT '',
`Device` tinytext NOT NULL,
`Channel` tinyi[...]
MySQL said: Documentation
#1822 - Failed to add the foreign key constraint. Missing index for constraint 'Groups_Monitors_ibfk_2' in the referenced table 'Monitors'
Re: Import of monitors fails
The mysql config only backup / restore script that works for most people is:
From: https://wiki.zoneminder.com/MySQL#Backup_config_only
Code: Select all
DATE="$(date +'%D'|sed 's/\//_/g')"
mysqldump -u root zm --ignore-table=zm.Events --ignore-table=zm.Frames --ignore-table=zm.Logs --ignore-table=zm.Stats --ignore-table=zm.Events_Day --ignore-table=zm.Events_Hour --ignore-table=zm.Events_Month --ignore-table=zm.Events_Week --ignore-table=zm.Event_Summaries > zmdb_configonly_$DATE.sql
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl
If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl
If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
Re: Import of monitors fails
Thanks, i'll try that!
Is there a way to reset the database to defaults? My import attempts screwed something up and now I can't even add cameras manually.
Is there a way to reset the database to defaults? My import attempts screwed something up and now I can't even add cameras manually.
Re: Import of monitors fails
It's there in the wiki.
https://wiki.zoneminder.com/MySQL#Backup_config_only
Just skip the fourth step where you import the backup.
https://wiki.zoneminder.com/MySQL#Backup_config_only
Code: Select all
mysql -u root -e "drop database zm;"
mysql -u root -e "create database zm;"
mysql -u root zm < /usr/share/zoneminder/db/zm_create.sql
mysql -u root zm < zmdb.sql
mysql -u root -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';"
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl
If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl
If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide