Page 1 of 1

Changing the default events and images folders

Posted: Thu Jul 14, 2011 3:48 pm
by bfigueiredo
hi,

I have a working zoneminder.
Now i'm adding a new hard-disk to store the events.
When i change the paths to the new hard-disk in the options menu, the images and the events stop working. The image in the zones configuration disappear...

Have this happened to anyone else?!
Anyone with a solution?!

Thanks in advance!

Re: Changing the default events and images folders

Posted: Thu Jul 14, 2011 4:04 pm
by PacoLM
Hi,

Here is how I have added a hard disk to store the events, follow the steps and change the device as appropriate:

Code: Select all

# create a directory for the symlink
mkdir /zmdisk
# mount the device, mine is /dev/sdc1
ntfs-3g /dev/sdc1 /zmdisk
mkdir /zmdisk/events
mkdir /zmdisk/images
mkdir /zmdisk/temp
rm -rf /usr/share/zoneminder/events
rm -rf /usr/share/zoneminder/images
rm -rf /usr/share/zoneminder/temp
ln -s /zmdisk/events /usr/share/zoneminder/events
ln -s /zmdisk/images /usr/share/zoneminder/images
ln -s /zmdisk/temp /usr/share/zoneminder/temp
Hope it helps,

PacoLM

Re: Changing the default events and images folders

Posted: Mon Jul 18, 2011 3:45 pm
by bfigueiredo
Thanks!!!

Problem solved!

Re: Changing the default events and images folders

Posted: Sun Jul 31, 2011 2:43 am
by aussie_1968
hi,

what were the default path settings?

i have changed the path values to point to a second drive and now i cannot view my events any more.
when trying to revert back to the defaults, was it just "events"?
then zm does not start the camera's any more because of a bind problem.

Would be great if someone could tell me what the default paths were set to, so that i can apply the above fix for my problem.

Re: Changing the default events and images folders

Posted: Mon Aug 01, 2011 5:37 pm
by mastertheknife
aussie_1968 wrote:hi,

what were the default path settings?

i have changed the path values to point to a second drive and now i cannot view my events any more.
when trying to revert back to the defaults, was it just "events"?
then zm does not start the camera's any more because of a bind problem.

Would be great if someone could tell me what the default paths were set to, so that i can apply the above fix for my problem.
Yes, its "events". Current ZM has problems when using an absolute path for events, but relative path (e.g. ../../../mnt/bigdrive/events) should work. This is fixed in a patch of mine that will hopefully make it into ZM 1.25.1. For now use relative paths only.

About the bind problem, this is fixed in ZM 1.24.4 but there is a small change you can do that doesn't require re-compiling to fix it on older versions of ZM.

mastertheknife

Re: Changing the default events and images folders

Posted: Tue Aug 02, 2011 6:20 am
by aussie_1968
mastertheknife wrote:
aussie_1968 wrote:hi,

what were the default path settings?

i have changed the path values to point to a second drive and now i cannot view my events any more.
when trying to revert back to the defaults, was it just "events"?
then zm does not start the camera's any more because of a bind problem.

Would be great if someone could tell me what the default paths were set to, so that i can apply the above fix for my problem.
Yes, its "events". Current ZM has problems when using an absolute path for events, but relative path (e.g. ../../../mnt/bigdrive/events) should work. This is fixed in a patch of mine that will hopefully make it into ZM 1.25.1. For now use relative paths only.

About the bind problem, this is fixed in ZM 1.24.4 but there is a small change you can do that doesn't require re-compiling to fix it on older versions of ZM.

mastertheknife
thanks,

for some reason i have tried using "events" again just then, restarted zoneminder and now all is well.
do not know what that was.

Re: Changing the default events and images folders

Posted: Tue Aug 02, 2011 2:23 pm
by jbmia
Looks like you guys have figured this out... I've tried to follow the directions closely, but it seems with different distro's and installs the folder paths vary and maybe I'm getting confused..

When I attempt to symlink to a new events folder I'm experiencing the same symptoms describe... events logged, but no data, no ability to view them in the console. I'm also getting:

Code: Select all

Aug  2 09:53:47 9745 zmaudit[25519]: INF [Filesystem monitor link 'events' does not point to valid monitor directory]
Here's what I've got.. Let's just talk about "events" for now:
1. Console: Left as "events"
2. "/var/www/zm/events": In a functional state this is a directory with sub-folders and data.
3. "/var/lib/zoneminder/events": In a functional state this is a symlink to "/var/www/zm/events"

Here's where I'd like to be:
1. "events" physically stored in "/home/default/zm/events"

Here's what I've tried.. to no avail:
1. Move "events folder, sub-folders, and data" to "/home/default/zm/events", changed owner & group to "apache". Created symlink from "/var/www/zm/events" to "/home/default/zm/events". Left "/var/lib/zoneminder/events" alone. ERROR.
2.. Move "events folder, sub-folders, and data" to "/home/john/zm/events", changed owner & group to "apache". Created symlink from "/var/lib/zoneminder/events" to "/home/default/zm/events". Created symlink from "/var/www/zm/events" to "/var/lib/zoneminder/events". ERROR

For the record, when I say created symlink, as in that last example, I'm performing the following:

Code: Select all

ln -s /var/www/zm/events /var/lib/zoneminder/events
Per another thread I verified this in httpd.conf:

Code: Select all

<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
I'm really in testing mode right now as I just got this up and running last week... I first had it on an old laptop and then decided I was going to put it into production on my Amahi server which has a Phenom x4, 4 gb's of ram, and 8Tb's in a storage pool. I've got plenty of cpu bandwidth and memory on this machine for my needs and should have NO PROBLEM with storage at 8Tb's... Now my system partition is 20gb's and I just can't get "events" off it and on to one of these other partitions... Interesting situtation...

Am I missing another "events" folder somewhere? Many thanks for some enlightenment!

jbmia

Re: Changing the default events and images folders

Posted: Tue Aug 02, 2011 2:30 pm
by mastertheknife
Hi jbmia,

In the other thread you said you are using my patch. And if you do, you should have no problems changing the events path in ZM settings to an absolute path, e.g. /mnt/blah/zmdisk/events
This way you don't need all these hacky workarounds (symlinks, etc)
The only problem about this is that video generation can fail when using an absolute path for events, but see here for a fix:
http://www.zoneminder.com/forums/viewto ... 883#p70883

mastertheknife.

Re: Changing the default events and images folders

Posted: Tue Aug 02, 2011 3:33 pm
by jbmia
Doh! I guess I should have read a bit more about your patch...

Quick question.. what is the command to apply the patch?
Also, Can I just stop the service and apply or do I need to re: configure/make/make install?

jbmia

Re: Changing the default events and images folders

Posted: Tue Aug 02, 2011 3:37 pm
by mastertheknife
jbmia wrote:Doh! I guess I should have read a bit more about your patch...

Quick question.. what is the command to apply the patch?
Also, Can I just stop the service and apply or do I need to re: configure/make/make install?

jbmia
Its all in the thread :D
By the way, its also possible to use different path for events folder in stock ZM, but you will have to use a relative path. e.g. ../../../../mnt/zmdisk

mastertheknife

Re: Changing the default events and images folders

Posted: Tue Aug 02, 2011 4:18 pm
by jbmia
Hmmm... I read through the whole thread in the link and didn't see a command or instructions to apply the patch.. Is it the same as the original patch, just substituting the new name I give this patch? Do I need to re-install ZM?

Apologies, I'm a bit new and doing the best I can... (Not programmer.. just know enough to get in trouble and eventually get out..)

udpate: I also did a bit of reading on absolute & relative paths.. (just to make sure I understand what I'm doing here).. I changed the path in console from "events" to "../default/zm/events" and all my monitors go yellow. I changed to "../zm/events" and they all go green, but they tie back to "/var/www/zm/events".. :roll:

another update: httpd log in /var/log/http says: "../default/zm/events': No such file or directory"

jbmia

Re: Changing the default events and images folders

Posted: Thu Aug 04, 2011 6:35 pm
by jbmia
Hoping someone can assist me a bit further with this...

I was able to apply the patch to General.pm.. here's what the section of General.pm looks like now:

Code: Select all

}

sub getEventPath( $ )
{
    my $event = shift;

    my $event_path = "";
    if ( ZM_USE_DEEP_STORAGE )
    {
     	if ( index(ZM_DIR_EVENTS,'/') == 0 ) {
            $event_path = ZM_DIR_EVENTS.'/'.$event->{MonitorId}.'/'.strftime( "%y/%m/%d/%H/%M/%S", localtime($event->{Time}) );
        } else {
            $event_path = ZM_PATH_WEB.'/'.ZM_DIR_EVENTS.'/'.$event->{MonitorId}.'/'.strftime( "%y/%m/%d/%H/%M/%S", localtime($event->{Time}) );
        }
    }
    else
    {
        if ( index(ZM_DIR_EVENTS,'/') == 0 ) {
            $event_path = ZM_DIR_EVENTS.'/'.$event->{MonitorId}.'/'.$event->{Id};
        } else {
            $event_path = ZM_PATH_WEB.'/'.ZM_DIR_EVENTS.'/'.$event->{MonitorId}.'/'.$event->{Id};
        }
     }
    return( $event_path );
}
Yet, when I change zm_dir_events to : "/home/default/zm/events" and I generate an event, the events come up, but with no data, all zero's where there would be # frames, # seconds, etc... I turned up debug level to 8 and that didn't provide any information, but every time I generate and event, my zmdc.log shoots this out:

Code: Select all

08/04/2011 14:21:04.211432 zmdc[18329].INF ['zma -m 8' starting at 11/08/04 14:21:04, pid = 31746]
08/04/2011 14:21:05.168422 zmdc[18329].ERR ['zma -m 8' exited abnormally, exit status 255]
08/04/2011 14:21:10.084923 zmdc[18329].INF [Starting pending process, zma -m 8]
08/04/2011 14:21:10.087171 zmdc[18329].INF ['zma -m 8' starting at 11/08/04 14:21:10, pid = 32388]
I'm basically waving my hand in front of the camera with modect on and terminal on tail -f zm*.log and I can gen these errors like clockwork... So, somethings definitely going on... I obviously restarted the server in between everything. I gave "apache" ownership of the new events path and changed permissions to 777 (recursively) as well... so it's not a permissions issue.. I even deleted the monitor and re-created it. I then gen'd an event and went to look in both the new directory and the old directory and the system is not creating a folder at the "monitor" level.. (e.g., /home/default/zm/events/"monitor id"), in either path...

So, I'm stumped at this point.. I'd like to get the events path off my system partition... Any assistance would be greatly appreciated..

edit:
Also get this in /var/log/messages...

Code: Select all

Aug  4 13:50:57 9745 zma_m6[32719]: FAT [Can't symlink /home/default/zm/events/6/11/08/04/.129 -> /home/default/zm/events/6/11/08/04/13/50/56: Permission denied]
Aug  4 13:51:12 9745 zma_m6[8012]: INF [Debug Level = 0, Debug Log = <none>]
Aug  4 13:51:12 9745 zma_m6[8012]: ERR [fopen() for /var/log/zm/debug.log, error = Permission denied]
So, that brings up a few questions... Do I still need to do the symlink from /var/www/zm/events/ over to /home/default/zm/events?? Why would I be getting that a permissions error if I updated that events to apache owner/group and 777 permissions recursively? Looks like the system is trying to do it's own symlink... what's that .129 there?? Why is it trying to create it's own symlink... (or am I misunderstanding this)

And, regarding the debug.log permission denied, I hadn't touched permissions on that... but, I just revised those to ensure that won't happen again..

jbmia

Re: Changing the default events and images folders

Posted: Sun Aug 07, 2011 3:57 pm
by jbmia
Well... For those that run into this looking for an answer, I'm still really perplexed as to why I'm having trouble with the solution described above, but ran into a completely different solution.

That solution is documented here in the wiki http://www.zoneminder.com/wiki/index.ph ... Hard_Drive. It is solved from a completely different perspective.

Basically, bypassing ZM settings altogether and mounting a new "partition" or "drive" for "events", "images", etc. So, instead of telling ZM where to put this content, we just end up changing the destination. Doh! That's pretty simple, how come I didn't think of that before.. Wow.. it's amazing what you find in the Wiki.

jbmia