ZoneMinder 1.25.x doesn't upload to FTP server or send email

Forum for questions and support relating to the 1.25.x releases only.
Post Reply
Cubytus
Posts: 32
Joined: Sun Oct 14, 2012 6:30 pm

ZoneMinder 1.25.x doesn't upload to FTP server or send email

Post by Cubytus » Wed Oct 24, 2012 10:47 pm

Hello all,

I managed to get ZM to start and run, but when it detects an even, it does't upload anything to the FTP server, or send an email, although I properly filled in the required fields, which renders the recording mostly useless.

It doesn't seem to output any error or warning when turned on.

How do I get it to send an alert email when something is detected and more importantly so, upload the captured files to the server ASAP?

PacoLM
Posts: 970
Joined: Wed Dec 02, 2009 9:55 pm
Location: Spain

Re: ZoneMinder 1.25.x doesn't upload to FTP server or send e

Post by PacoLM » Thu Oct 25, 2012 9:24 am

In order to send a mail you will need to install a mail packages such postfix, check if you already have it installed and properly configured.

mini-ITX system (4 IPCams - Ubuntu20.04 - ZM1.34.15)
TelegramBot

Cubytus
Posts: 32
Joined: Sun Oct 14, 2012 6:30 pm

Re: ZoneMinder 1.25.x doesn't upload to FTP server or send e

Post by Cubytus » Thu Oct 25, 2012 12:40 pm

According to the documentation, there should already be a Perl module able to do that.

But more importantly, what about the FTP upload?

B F
Posts: 29
Joined: Sat May 05, 2012 5:06 pm

Re: ZoneMinder 1.25.x doesn't upload to FTP server or send e

Post by B F » Thu Oct 25, 2012 8:44 pm

The following might help based on a working configuration.
Attachments
filter-email.jpg
This is an example of a "Filters" for 'emailing'. For 'uploading' there is a similar filter.
filter-email.jpg (23.92 KiB) Viewed 5704 times
options-ftp.jpg
This is the settings for "Options -> Upload" FTP.
options-ftp.jpg (76.23 KiB) Viewed 5704 times
options-email.jpg
Settings for "Options -> Email".
options-email.jpg (85.81 KiB) Viewed 5704 times

Cubytus
Posts: 32
Joined: Sun Oct 14, 2012 6:30 pm

Re: ZoneMinder 1.25.x doesn't upload to FTP server or send e

Post by Cubytus » Mon Oct 29, 2012 5:27 am

Hello community,

I would have gladly tested this config, but still have an issue. After a crash due to a disk filling up due to a wrong camera setting on my part (output only green-dominant parasites), I manually deleted the faulty files since I couldn't reconnect to the ZM's web interface, and proceeded on reinstalling https, mysqld and zoneminder. I didn't set up a "erase on delete" task yet since I expected that a non-working camera wouldn't get recorded, or at the very least, stop before the computer becomes unusable. Seems ZM is dumber than this as my reference Windows-based BlueIris had this built-in.

However, it seems that ZoneMinder still doesn't want to start, with yet another error:

Code: Select all

Oct 27 11:01:56 Leblanc zoneminder[4933]: Démarrage de ZoneMinder*: Bareword "ZM_PATH_LOGS" not allowed while "strict subs" in use at /usr/share/perl5/vendor_perl/ZoneMinder/Logger.pm line 153.
Oct 27 11:01:56 Leblanc zoneminder[4933]: BEGIN not safe after errors--compilation aborted at /usr/share/perl5/vendor_perl/ZoneMinder/Logger.pm line 168.
Oct 27 11:01:56 Leblanc zoneminder[4933]: Compilation failed in require at /usr/share/perl5/vendor_perl/ZoneMinder.pm line 34.
Oct 27 11:01:56 Leblanc zoneminder[4933]: BEGIN failed--compilation aborted at /usr/share/perl5/vendor_perl/ZoneMinder.pm line 34.
Oct 27 11:01:56 Leblanc zoneminder[4933]: Compilation failed in require at /usr/bin/zmpkg.pl line 37.
Oct 27 11:01:56 Leblanc zoneminder[4933]: BEGIN failed--compilation aborted at /usr/bin/zmpkg.pl line 37.
Oct 27 11:01:56 Leblanc zoneminder[4933]: [ÉCHOUÉ]
Oct 27 11:01:56 Leblanc systemd[1]: zoneminder.service: control process exited, code=exited status=2
Oct 27 11:01:56 Leblanc systemd[1]: Unit zoneminder.service entered failed state.
I have yet to find what this means exactly, from Google.
What is the source of this one, and what should I do to solve it? SELinux hasn't been touched, and is still disabled.

B F
Posts: 29
Joined: Sat May 05, 2012 5:06 pm

Re: ZoneMinder 1.25.x doesn't upload to FTP server or send e

Post by B F » Mon Oct 29, 2012 11:08 am

Had a quick poke around on Google & found this page which might help http://francisfisher.me.uk/problem/2012 ... bs-in-use/ Someone seems to think that:
I had a similar issue, and it took me a while to realize what was causing it. It seems that the original zm_create.sql doesn't have a "DROP IF EXISTS" line before table 'Logs'. Adding it allowed me to dump zm_create.sql to the database and everything seems to be working now.
To stop ZonemMinder filling up your disk have a look at this http://www.zoneminder.com/wiki/index.ph ... my_disk.3F

Cubytus
Posts: 32
Joined: Sun Oct 14, 2012 6:30 pm

Re: ZoneMinder 1.25.x doesn't upload to FTP server or send e

Post by Cubytus » Tue Oct 30, 2012 5:15 am

Thanks. I managed to get it started by adding the missing line where you stated it.

I used the same settings, just adapted to use mine, as you shown, then I proceeded on testing it while moving casually in front of the camera. The logs reported the email has been sent with alarm report, as well as uploaded to the server. however, after checking every part including the spam box, It seems I haven't received any email yet. I set it to use a known (and authorized) originating email address to let the SMTP server accept it, and receive it on another, external mailbox. I also set it to use FTP instead of SFTP. This is obviously very dangerous as an attacker would have access to the local recording as well as getting the login for remote backup, but i want to get it working first.

Worse, nothing is on the FTP server. The log doesn't appear to report the error. Am I looking at it wrong?

Code: Select all

Oct 30 01:08:58 Leblanc zma_m1[2317]: INF [Monitor-1: 926 - Opening new event 153, alarm start]
Oct 30 01:09:03 Leblanc zma_m1[2317]: INF [Monitor-1: 964 - Gone into alert state]
Oct 30 01:09:03 Leblanc zma_m1[2317]: INF [Monitor-1: 968 - Gone back into alarm state]
Oct 30 01:09:04 Leblanc zma_m1[2317]: INF [Monitor-1: 971 - Gone into alert state]
Oct 30 01:09:04 Leblanc zma_m1[2317]: INF [Monitor-1: 972 - Gone back into alarm state]
Oct 30 01:09:06 Leblanc zma_m1[2317]: INF [Monitor-1: 990 - Gone into alert state]
Oct 30 01:09:07 Leblanc zma_m1[2317]: INF [Monitor-1: 1000 - Processing at 8.06 fps]
Oct 30 01:09:07 Leblanc zma_m1[2317]: INF [Monitor-1: 1000 - Left alarm state (153) - 84(59) images]
Oct 30 01:09:07 Leblanc zma_m1[2317]: INF [Monitor-1: 1000 - Closing event 153, alarm end]
Oct 30 01:09:17 Leblanc kernel: [ 1502.220149] sd 6:0:0:0: [sdb] Test WP failed, assume Write Enabled
Oct 30 01:09:17 Leblanc kernel: [ 1502.223224] sd 6:0:0:0: [sdb] Asking for cache data failed
Oct 30 01:09:17 Leblanc kernel: [ 1502.223231] sd 6:0:0:0: [sdb] Assuming drive cache: write through
Oct 30 01:09:24 Leblanc zma_m1[2317]: INF [Monitor-1: 1132 - Gone into alarm state]
Oct 30 01:09:24 Leblanc zma_m1[2317]: INF [Monitor-1: 1132 - Opening new event 154, alarm start]
Oct 30 01:09:24 Leblanc zma_m1[2317]: INF [Monitor-1: 1137 - Gone into alert state]
Oct 30 01:09:26 Leblanc zma_m1[2317]: INF [Monitor-1: 1147 - Left alarm state (154) - 25(5) images]
Oct 30 01:09:26 Leblanc zma_m1[2317]: INF [Monitor-1: 1147 - Closing event 154, alarm end]
Oct 30 01:09:27 Leblanc zmfilter[2083]: INF [Notification email sent]
Oct 30 01:09:32 Leblanc zmc_dvideo0[2046]: INF [Monitor-1: 8000 - Capturing at 8.00 fps]

B F
Posts: 29
Joined: Sat May 05, 2012 5:06 pm

Re: ZoneMinder 1.25.x doesn't upload to FTP server or send e

Post by B F » Tue Oct 30, 2012 4:34 pm

If it were me debugging this I'd start off by su'ing to the user that ZM does most of its work as, in Ubuntu I think that's the 'www-data' user. Then I'd try out a manual telnet SMTP email test, refer to something like http://www.yuki-onna.co.uk/email/smtp.html if you're unsure how to do that. Equally I'd try a manual FTP session as that user both in active and passive mode.

You could also check that the user has the rights to create files in the Options -> Upload 'UPLOAD_LOC_DIR' "The local directory in which to create upload files" location. You might also want to try switching from passive to active FTP 'UPLOAD_FTP_PASSIVE' "Use passive ftp when uploading".

You can also increase the level of debugging in Options -> Logging, hopefully that might provide further clues.

If you can check the mail and FTP logs on the destination server.

Cubytus
Posts: 32
Joined: Sun Oct 14, 2012 6:30 pm

Re: ZoneMinder 1.25.x doesn't upload to FTP server or send e

Post by Cubytus » Wed Oct 31, 2012 3:24 am

Hi,

not sure if I understood well, but here is the result of these advice.

Trying to connect to the SMTP by telnet, and use pre-approved domain names for it:

Code: Select all

[usager@Leblanc etc]$ telnet mail.ftp83plus.net 465
Trying 91.221.118.92...
Connected to mail.q-x.ch.
Escape character is '^]'.
HELO www.umontreal.ca
Connection closed by foreign host.
Connection is denied on port 25.

Tried to switch users to www-data: seems it is not used on Fedora:

Code: Select all

[usager@Leblanc etc]$ su www-data
su: l'utilisateur www-data n'existe pas
From owner of zm.conf and /var/lib/zoneminder, inferred a likely candidate account to be apache:
Changed its password in root since I couldn't find the default, internal password for apache, and tried to switch to it to open a FTP session:

Code: Select all

[usager@Leblanc etc]$ su - apache
Mot de passe : 
This account is currently not available.
Another clue to identifying why it couldn't simply work "out of the box":

Code: Select all

Oct 30 22:59:56 Leblanc zmc_dvideo1[6547]: INF [Starting Capture]
Oct 30 22:59:56 Leblanc zmc_dvideo1[6547]: FAT [Failed to stat video device /dev/video1: No such file or directory]
Oct 30 22:59:56 Leblanc zmdc[6490]: ERR ['zmc -d /dev/video1' exited abnormally, exit status 255]
Oct 30 22:59:56 Leblanc zmdc[6490]: INF ['zma -m 2' starting at 12/10/30 22:59:56, pid = 6555]
Oct 30 22:59:56 Leblanc zmdc[6555]: INF ['zma -m 2' started at 12/10/30 22:59:56]
Oct 30 22:59:57 Leblanc zma_m2[6555]: WAR [Waiting for capture daemon]
Oct 30 22:59:57 Leblanc zmdc[6490]: INF ['zmfilter.pl' starting at 12/10/30 22:59:57, pid = 6566]
Oct 30 22:59:57 Leblanc zmdc[6566]: INF ['zmfilter.pl' started at 12/10/30 22:59:57]
Oct 30 22:59:57 Leblanc zma_m1[6528]: WAR [Waiting for capture daemon]
Oct 30 22:59:57 Leblanc zmdc[6490]: INF ['zmaudit.pl -c' starting at 12/10/30 22:59:57, pid = 6576]
Oct 30 22:59:57 Leblanc zmdc[6576]: INF ['zmaudit.pl -c' started at 12/10/30 22:59:57]
Oct 30 22:59:57 Leblanc zmdc[6490]: INF ['zmwatch.pl' starting at 12/10/30 22:59:57, pid = 6586]
Oct 30 22:59:57 Leblanc zmdc[6586]: INF ['zmwatch.pl' started at 12/10/30 22:59:57]
Oct 30 22:59:58 Leblanc zma_m2[6555]: WAR [Waiting for capture daemon]
Oct 30 22:59:58 Leblanc zmdc[6490]: INF ['zmupdate.pl -c' starting at 12/10/30 22:59:58, pid = 6597]
Oct 30 22:59:58 Leblanc zmdc[6597]: INF ['zmupdate.pl -c' started at 12/10/30 22:59:58]
Oct 30 22:59:58 Leblanc zoneminder[6440]: [  OK  ]
Oct 30 22:59:58 Leblanc zma_m1[6528]: INF [In mode 3/1, warming up]
Oct 30 22:59:58 Leblanc zmwatch[6586]: INF [Watchdog starting]
Oct 30 22:59:58 Leblanc zmwatch[6586]: INF [Watchdog pausing for 30 seconds]
Oct 30 22:59:58 Leblanc zmfilter[6566]: INF [Scanning for events]
Oct 30 22:59:59 Leblanc zma_m2[6555]: WAR [Waiting for capture daemon]
Oct 30 23:00:00 Leblanc zma_m2[6555]: WAR [Waiting for capture daemon]
Oct 30 23:00:01 Leblanc zma_m2[6555]: WAR [Waiting for capture daemon]
Oct 30 23:00:01 Leblanc zmdc[6490]: INF [Starting pending process, zmc -d /dev/video1]
Oct 30 23:00:01 Leblanc zmdc[6490]: INF ['zmc -d /dev/video1' starting at 12/10/30 23:00:01, pid = 6611]
Oct 30 23:00:01 Leblanc zmdc[6611]: INF ['zmc -d /dev/video1' started at 12/10/30 23:00:01]
Oct 30 23:00:01 Leblanc zmc_dvideo1[6611]: INF [Starting Capture]
Oct 30 23:00:01 Leblanc zmc_dvideo1[6611]: FAT [Failed to stat video device /dev/video1: No such file or directory]
Oct 30 23:00:01 Leblanc zmdc[6490]: ERR ['zmc -d /dev/video1' exited abnormally, exit status 255]
Oct 30 23:00:02 Leblanc zma_m2[6555]: WAR [Waiting for capture daemon]
Oct 30 23:00:03 Leblanc zma_m2[6555]: WAR [Waiting for capture daemon]
Oct 30 23:00:03 Leblanc zmfilter[6566]: INF [Creating upload file '/var/lib/zoneminder/temp/Monitor-1-155.tar', 95 files]
Oct 30 23:00:03 Leblanc zmfilter[6566]: INF [Uploading to ftp.ftp83plus.net using FTP]
Oct 30 23:00:04 Leblanc zma_m2[6555]: WAR [Waiting for capture daemon]
Oct 30 23:00:05 Leblanc zma_m2[6555]: WAR [Waiting for capture daemon]
Oct 30 23:00:06 Leblanc zma_m2[6555]: WAR [Waiting for capture daemon]
Oct 30 23:00:06 Leblanc zmfilter[6566]: ERR [FTP - Can't upload '/var/lib/zoneminder/temp/Monitor-1-155.tar']
Just says: "can't upload", but doesn't give a precise answer as to why it wouldn't.(dev/video1 is a webcam that wasn't plugged in at the time of this test.)

Just to make sure, I stopped ZoneMinder, httpd and mysqld services, then restarted them one by one, mysqld, httpd, and finally ZoneMinder.

Reopening the ZM console in Firefox I was greeted with this warning:

Code: Select all

Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/share/zoneminder/www/includes/functions.php on line 1427
Why can't it restart properly?
Plus, F 17 seems unable to activate its screensaver for some reason when ZM is running. Are ZM guys really developping on Fedora? Seems they don't test it there.

B F
Posts: 29
Joined: Sat May 05, 2012 5:06 pm

Re: ZoneMinder 1.25.x doesn't upload to FTP server or send e

Post by B F » Wed Oct 31, 2012 3:00 pm

Apache might not have a login shell, maybe something like 'su - apache -s /bin/bash' will get you where you need to be http://wiki.networksecuritytoolkit.org/ ... ced_Topics

Email - I might be wrong but I think ZM expects the SMTP server to use port 25. To configure ZM to use a different port is something I have no experience of. You could try 'ftp.ftp83plus.net:465' under "The host address of your SMTP mail server" but I'd guess that won't work.

FTP - As any user on your server try FTP'ing a file to 'ftp.ftp83plus.net' to make sure something can get there. If it can then perhaps it's a local permissions problem? Maybe the local account ZM uses to FTP cannot read the tar file within '/var/lib/zoneminder/temp/'?

strtotime - Maybe this is as a result of adding a filter to stop ZM filling up your disk? There appears to be a solution here http://www.zoneminder.com/forums/viewto ... ime#p77689

Cubytus
Posts: 32
Joined: Sun Oct 14, 2012 6:30 pm

Re: ZoneMinder 1.25.x doesn't upload to FTP server or send e

Post by Cubytus » Wed Oct 31, 2012 7:27 pm

The email server doesn't accept telnet connections on port 25, and closed it sooner or later before I could perform the test. However, I have experienced it to be working when I was using BlueIris (Windows),which has an option to send alerts by email, SMS, as well as upload to FTP (No SFTP, though). So probably not an email server issue. In fact, each time I had to debug something communicating with my distant server, each time it was a local issue, not a server issue. I can praise its stability.

About the FTP itself, I asked for the logs, and the provider pasted a part of it as indeed, my IP opened a connection at said time, but didn't upload anything, and then closed the connection. There's no clue in the distant logs to know why this (probably small) TAR file wasn't uploaded. This FTP server doesn't allow for anonymous connections; however, login-g using parameters indicated in ZM options does work fine from the command line, so I'm unsure as to how the local user ZM has may be relevant to the FTP connection in any way.
*****
It seems that the TAR files were finally uploaded late last night. However... Yet another issue: all their sizes are 0. On the server, the files have the FTP user login set as owner, with rights set as 644 (same as in /var/lib/zoneminder/temp, owner being apache, there). I chose TAR because I think there is less performance penalty for Fedora to make a TAR instead of a ZIP (both uncompressed).

Maybe because I was forced to change apache's password? But as I couldn't find the default one and that passwd forbids blank passwords...What to do now?

Why empty files?

B F
Posts: 29
Joined: Sat May 05, 2012 5:06 pm

Re: ZoneMinder 1.25.x doesn't upload to FTP server or send e

Post by B F » Wed Oct 31, 2012 8:52 pm

I've seen this before with FTP creating files of size zero on the server, I'm convinced it's a local permissions problem. The account handling the FTP upload does not have permission to access the file and upload it, all it does is create the filename on the server but that's as far as it gets.

It's also worth checking you don't have any firewall rules enabled on your ZM box that might affect things.

Cubytus
Posts: 32
Joined: Sun Oct 14, 2012 6:30 pm

Re: ZoneMinder 1.25.x doesn't upload to FTP server or send e

Post by Cubytus » Wed Oct 31, 2012 9:56 pm

The account used to upload these files may be apache from ZM... and there's no way to change it I believe. Is there a way to set the permissions as "777", then? Because the user handover seem to be properly done. How is this problem solved? From what you state I'm unsure of how to tackle it.

As for the firewall... Usually this work to block outside menace from entering the local computer, not the other way around. There's no particular setting except what's stock in Fedora 17. And I set it up to upload using active mode, as I read here to try.

Cubytus
Posts: 32
Joined: Sun Oct 14, 2012 6:30 pm

Re: ZoneMinder 1.25.x doesn't upload to FTP server or send e

Post by Cubytus » Sun Dec 30, 2012 12:38 am

Rinstalled from scratch on a different distro. Same result: can't upload. Means useless DVR.

TAR or ZIP files aren't created.
How do I solve this?

whammy
Posts: 3
Joined: Mon Jan 07, 2013 3:26 am

Re: ZoneMinder 1.25.x doesn't upload to FTP server or send e

Post by whammy » Mon Jan 07, 2013 3:49 am

Perhaps a missing perl library? I encountered this bug attempting to use SFTP:

Google: missing sftp zoneminder 1006890

or sudo apt-get install libnet-sftp-foreign-perl

After I resolved the dependency issue, it worked flawlessly.

I tried about ten different ways to post an obfuscated link to the bug report... apparently I'm too much of a n00b to post...

P.S.: to forum mods... perhaps turn down the link police a notch? Sheesh.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests