live veiw YES on localhost, NO on others

Forum for questions and support relating to the 1.30.x releases only.
Locked
User avatar
zd59
Posts: 102
Joined: Wed Jan 18, 2017 1:39 pm
Location: EU - Slovenia

live veiw YES on localhost, NO on others

Post by zd59 »

Hello!

My config:
Zoneminder-1.30 on Debian stretch ( 4.8.0-2-amd64 #1 SMP Debian 4.8.11-1 (2016-12-02) x86_64 GNU/Linux)
Apache/2.4.25

The problem:
All works on localhost, whrere all is installed. I can watch live video and events video in Firefox, none in Konquerror.
The problem is, that live video can not play on other computers on LAN, but events video plays OK. Tried Firefox on Linux (slackware) and Firefox & internet Explorer on Windows. Internet Explorer give me a Java app security approval window, and after click to run I get "Java.net.UnknownHostException:HOSTNAME" error in the place of a video window. The same case is on my Android phone (live or event video not working).

I Cambozolla.jar is at right place with right permissions (0755)
PATH_ZMS = /zm/cgi-bin/nph-zms which is in zoneminder.conf:
-----------------------------------------------------------------------
# Remember to enable cgi mod (i.e. "a2enmod cgi").
ScriptAlias /zm/cgi-bin "/usr/lib/zoneminder/cgi-bin"
<Directory "/usr/lib/zoneminder/cgi-bin">
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
AllowOverride All
Require all granted
</Directory>

Alias /zm /usr/share/zoneminder/www
<Directory /usr/share/zoneminder/www>
Options Indexes FollowSymLinks
<IfModule mod_dir.c>
DirectoryIndex index.php
</IfModule>
</Directory>

<Directory /usr/share/zoneminder/www/api>
AllowOverride All
</Directory>
-----------------------------------------------------------------------
MPEG_LIVE_FORMAT = tested mpg mpeg wmv asf avi mov swf 3gp mp4
WEB_H_CAN_STREAM = tested Auto, yes, none
WEB_H_STREAM_METHOD = tested mpeg, jpeg

Loglevels:
LOG_LEVEL_SYSLOG, LOG_LEVEL_DATABASE = info, others none

log window in zoneminder gui console & logs in /var/log/apache2 show no signs of errors.

Must point out, that none of the browsers (Firefox or IE) warns about any missing plugins.
Any idea, what to try?

regards to Zoneminder developers & comunity, incredible work done!
rockedge
Posts: 1174
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: live veiw YES on localhost, NO on others

Post by rockedge »

Check the Apache /etc/apache2/sites-enabled directory that you have a correct virtual host configuration to allow Apache to serve the ZM streams by setting the right permissions for the /cgi-bin when accessed via LAN or Internet and not just localhost.
User avatar
zd59
Posts: 102
Joined: Wed Jan 18, 2017 1:39 pm
Location: EU - Slovenia

Re: live veiw YES on localhost, NO on others

Post by zd59 »

Thank's for a tip.
Regarding configuration files & permissions are below.

/etc/apache2/sites-enabled 000-default.conf -> ../sites-available/000-default.conf -rw-r--r-- root root
the not commented contents of above file
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

/etc/apache2/conf-enabled/ zoneminder.conf -> ../conf-available/zoneminder.conf -rw-r--r-- 1 root root
# Remember to enable cgi mod (i.e. "a2enmod cgi").
ScriptAlias /zm/cgi-bin "/usr/lib/zoneminder/cgi-bin"
<Directory "/usr/lib/zoneminder/cgi-bin">
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
AllowOverride All
Require all granted
</Directory>

Alias /zm /usr/share/zoneminder/www
<Directory /usr/share/zoneminder/www>
Options Indexes FollowSymLinks
<IfModule mod_dir.c>
DirectoryIndex index.php
</IfModule>
</Directory>

<Directory /usr/share/zoneminder/www/api>
AllowOverride All
</Directory>

/etc/apache2/conf-enabled/serve-cgi-bin.conf serve-cgi-bin.conf -> ../conf-available/serve-cgi-bin.conf -rw-r--r-- 1 root root
<IfModule mod_alias.c>
<IfModule mod_cgi.c>
Define ENABLE_USR_LIB_CGI_BIN
</IfModule>

<IfModule mod_cgid.c>
Define ENABLE_USR_LIB_CGI_BIN
</IfModule>

<IfDefine ENABLE_USR_LIB_CGI_BIN>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
</Directory>
</IfDefine>
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

permissions of files:

/usr/lib/zoneminder/cgi-bin
lrwxrwxrwx 1 root root 3 Dec 10 03:20 nph-zms -> zms
-rwxr-xr-x 1 root root 1269024 Dec 10 03:20 zms

/usr/lib/cgi-bin/
-rwxr-xr-x 1 root root 122432 Aug 4 07:05 htsearch
-rwxr-xr-x 1 root root 56216 Aug 4 07:05 qtest

Also checked again: no lines regarding video stream error/warning in apache2 error.log access.log or zoneminder log screen.
The only sign of video watch request was in /var/log/apache2/access.log:
10.200.200.10 - - [19/Jan/2017:09:48:51 +0100] "GET /zm/index.php?view=watch&mid=2 HTTP/1.1" 200 2532 "http://10.200.200.20/zm/index.php" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0"

The apache2 LogLevel warn
The system log (/var/log/system) also logs (LOG_LEVEL_SYSLOG = INFO) and there is no sign of any warning or error. Just Capturing and Analysing lines.

What bothers me the most is the fact, that I can watch events video and NOT live video. What is the difference between both, if I set the same settings in options -> images in Zoneminder console settings?

Regards!
bbunge
Posts: 2935
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: live veiw YES on localhost, NO on others

Post by bbunge »

I think you are "stretching" things a bit trying to get a development version to work. However, I am in process of loading up Stretch to see what I can come up with. Stay tuned...
rockedge
Posts: 1174
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: live veiw YES on localhost, NO on others

Post by rockedge »

try using this in /etc/apache2/sites-enabled 000-default.conf -> ../sites-available/000-default.conf

Code: Select all

DocumentRoot /var/www/html
AddHandler cgi-script .cgi .pl
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Since it works with localhost it could be that /cgi-bin is not configured to be accessible via network.
Or in your PATHS config in ZM Options is not set to the correct /cgi-bin
It could be that it is using the wrong alias /cgi-bin..... you have two.

Code: Select all

ScriptAlias /zm/cgi-bin "/usr/lib/zoneminder/cgi-bin"
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
bbunge
Posts: 2935
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: live veiw YES on localhost, NO on others

Post by bbunge »

Well, my test install works just fine. I did not set up a desktop version and did the bulk of the Zoneminder install from Putty on a Windows PC. I suspect you used a desktop install which may contain a firewall that is causing your issues.

Here are the basic steps I used:
Debian 9 LAMP Zoneminder

net install CD install only web server, SSH server and standard system utilities from tasksel


Login and become root

Install additional LAMP components

apt install apache2 php mysql-server php-mysql

Install Zoneminder

apt-get install zoneminder


Create Zoneminder database in MySQL (Note: this also creates the default Zoneminder user and permissions in MySQL)

mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql

mysql -uroot -p -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';"

mysqladmin -uroot -p reload

Set permissions of /etc/zm/zm.conf to root:www-data 740

chmod 740 /etc/zm/zm.conf

chown root:www-data /etc/zm/zm.conf

Enable Zoneminder service to start at boot

systemctl enable zoneminder.service

Add www-data to the sudo group (to enable use of local video devices)

adduser www-data video

Start Zoneminder

systemctl start zoneminder.service

Check to see that Zoneminder is running

systemctl status zoneminder.service

Enable CGI and Zoneminder configuration in Apache.

a2enmod cgi

a2enmod rewrite

a2enconf zoneminder
Add timezone to PHP

nano /etc/php/7.0/apache2/php.ini

Search for [Date] (Ctrl + w then type Date and press Enter) and make changes as follows for your time zone

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = America/New_York

Ctrl+o Enter to save

CTRL+x to exit

Restart Apache

service apache2 restart
bbunge
Posts: 2935
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: live veiw YES on localhost, NO on others

Post by bbunge »

Had to make an addition to my procedure to get the API to work. See:

https://wiki.zoneminder.com/Debian_9_64 ... e_Easy_Way
User avatar
zd59
Posts: 102
Joined: Wed Jan 18, 2017 1:39 pm
Location: EU - Slovenia

Re: live veiw YES on localhost, NO on others

Post by zd59 »

rockedge wrote:try using this in /etc/apache2/sites-enabled 000-default.conf -> ../sites-available/000-default.conf

Code: Select all

DocumentRoot /var/www/html
AddHandler cgi-script .cgi .pl
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Since it works with localhost it could be that /cgi-bin is not configured to be accessible via network.
Or in your PATHS config in ZM Options is not set to the correct /cgi-bin
It could be that it is using the wrong alias /cgi-bin..... you have two.

Code: Select all

ScriptAlias /zm/cgi-bin "/usr/lib/zoneminder/cgi-bin"
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
Thank you rockedge for the tips.
Changes you suggested did not helped.
I do not have any firewall on the server nor on client - home LAN clean, firewall on the WAN router only.
After applying your suggestions and restarting apache2 & zoneminder, I found some errors in zoneminder log regarding streaming.
Maybe this is the key.
ZM LOG:
2017-01-20 11:51:43.554220 zma_m2 28672 INF Vhod: 3000 - Analysing at 10.00 fps zm_monitor.cpp 1287
2017-01-20 11:51:38.532865 zmc_m2 28639 INF Vhod: 3000 - Capturing at 10.00 fps zm_monitor.cpp 3116
2017-01-20 11:50:14.442883 zms 28709 ERR Unable to send stream frame: Broken pipe zm_event.cpp 1348
2017-01-20 11:50:14.253378 zms 28709 INF Got signal 15 (Terminated), exiting zm_signal.cpp 40
2017-01-20 11:48:23.273902 zma_m2 28672 INF Vhod: 1000 - Analysing at 10.00 fps zm_monitor.cpp 1287
2017-01-20 11:48:18.545776 zmc_m2 28639 INF Vhod: 1000 - Capturing at 10.00 fps zm_monitor.cpp 3116
2017-01-20 11:46:43.233928 zma_m2 28672 INF Analysis fps (20.00) is lower than capturing fps (25.52), disabling adaptive skip feature zm_monitor.cpp 880
2017-01-20 11:46:43.213564 zma_m2 28672 INF In mode 3/1, warming up zma.cpp 142
2017-01-20 11:46:43.059540 zmdc 28672 INF 'zma -m 2' started at 17/01/20 11:46:43 zmdc.pl
2017-01-20 11:46:43.059530 zmdc 28609 INF 'zma -m 2' starting at 17/01/20 11:46:43, pid = 28672 zmdc.pl
2017-01-20 11:46:43.015420 zmdc 28609 INF Starting pending process, zma -m 2 zmdc.pl
2017-01-20 11:46:38.664370 zmwatch 28660 INF Watchdog pausing for 30 seconds zmwatch.pl
2017-01-20 11:46:38.602740 zmwatch 28660 INF Watchdog starting zmwatch.pl
2017-01-20 11:46:38.425830 zmdc 28660 INF 'zmwatch.pl' started at 17/01/20 11:46:38 zmdc.pl
2017-01-20 11:46:38.425820 zmdc 28609 INF 'zmwatch.pl' starting at 17/01/20 11:46:38, pid = 28660 zmdc.pl
2017-01-20 11:46:38.296210 zmfilter 28649 INF Scanning for events zmfilter.pl
2017-01-20 11:46:38.248970 zmdc 28654 INF 'zmaudit.pl -c' started at 17/01/20 11:46:38 zmdc.pl
2017-01-20 11:46:38.248970 zmdc 28609 INF 'zmaudit.pl -c' starting at 17/01/20 11:46:38, pid = 28654 zmdc.pl
2017-01-20 11:46:38.220327 zmc_m2 28639 INF Priming capture from rtsp://admin:only4ZD59@10.200.200.111/2?tcp zm_ffmpeg_camera.cpp 104
2017-01-20 11:46:38.188984 zmc_m2 28639 INF Starting Capture version 1.30.0 zmc.cpp 250
2017-01-20 11:46:38.097310 zmdc 28609 ERR 'zma -m 2' exited abnormally, exit status 255 zmdc.pl
2017-01-20 11:46:38.068823 zma_m2 28648 ERR Shared data not initialised by capture daemon for monitor Vhod zm_monitor.cpp 442
2017-01-20 11:46:38.045910 zmdc 28609 INF 'zmfilter.pl' starting at 17/01/20 11:46:38, pid = 28649 zmdc.pl
2017-01-20 11:46:38.045910 zmdc 28649 INF 'zmfilter.pl' started at 17/01/20 11:46:38 zmdc.pl
2017-01-20 11:46:38.020490 zmdc 28648 INF 'zma -m 2' started at 17/01/20 11:46:38 zmdc.pl
2017-01-20 11:46:38.020440 zmdc 28609 INF 'zma -m 2' starting at 17/01/20 11:46:38, pid = 28648 zmdc.pl
2017-01-20 11:46:37.993770 zmdc 28609 INF Starting pending process, zma -m 2 zmdc.pl
2017-01-20 11:46:37.953740 zmdc 28609 ERR 'zma -m 2' exited abnormally, exit status 255 zmdc.pl
2017-01-20 11:46:37.926059 zma_m2 28641 ERR Shared data not initialised by capture daemon for monitor Vhod zm_monitor.cpp 442
2017-01-20 11:46:37.868420 zmdc 28609 INF 'zma -m 2' starting at 17/01/20 11:46:37, pid = 28641 zmdc.pl
2017-01-20 11:46:37.868420 zmdc 28641 INF 'zma -m 2' started at 17/01/20 11:46:37 zmdc.pl
2017-01-20 11:46:37.785900 zmdc 28639 INF 'zmc -m 2' started at 17/01/20 11:46:37 zmdc.pl
2017-01-20 11:46:37.785890 zmdc 28609 INF 'zmc -m 2' starting at 17/01/20 11:46:37, pid = 28639 zmdc.pl
2017-01-20 11:46:37.758870 zmdc 28609 INF Starting pending process, zmc -m 2 zmdc.pl
2017-01-20 11:46:37.737990 zmdc 28609 ERR 'zmc -m 2' exited abnormally, exit status 255 zmdc.pl
2017-01-20 11:46:37.594150 zmdc 28635 INF 'zmc -m 2' started at 17/01/20 11:46:37 zmdc.pl
2017-01-20 11:46:37.594120 zmdc 28609 INF 'zmc -m 2' starting at 17/01/20 11:46:37, pid = 28635 zmdc.pl
2017-01-20 11:46:37.395750 zmpkg 28595 INF Single server configuration detected. Starting up services. zmpkg.pl
2017-01-20 11:46:34.390310 zmdc 28609 INF Server starting at 17/01/20 11:46:34 zmdc.pl
2017-01-20 11:46:33.989470 zmpkg 28595 INF Command: start zmpkg.pl
2017-01-20 11:46:33.951250 zmpkg 28595 INF Sanity checking States table... zmpkg.pl
2017-01-20 11:46:33.691490 zmsystemctl 28591 INF Redirecting command through systemctl zmsystemctl.pl
2017-01-20 11:46:33.505000 zmpkg 28585 INF Command: start zmpkg.pl

PATH_MAP=PATH_SWAP=/dev/shm
Filesystem Size Used Avail Use% Mounted on
udev 4.1G 0 4.1G 0% /dev
tmpfs 807M 86M 721M 11% /run
/dev/sda1 152G 14G 131G 10% /
tmpfs 4.1G 958M 3.1G 24% /dev/shm
tmpfs 5.3M 4.1k 5.3M 1% /run/lock
tmpfs 4.1G 0 4.1G 0% /sys/fs/cgroup
tmpfs 807M 13k 807M 1% /run/user/1001

root@video-nadzor:/etc/apache2/conf-available# ls -la /dev/shm
total 934624
drwxrwxrwt 2 root root 20060 Jan 20 11:46 .
drwxr-xr-x 20 root root 3360 Jan 13 18:25 ..
-rw------- 1 www-data www-data 737281760 Jan 20 11:46 zm.mmap.2
-rw-r--r-- 1 www-data www-data 209852 Jan 18 19:00 zmswap-i00000.jpg
-rw-r--r-- 1 www-data www-data 210813 Jan 18 19:00 zmswap-i00001.jpg
and many more swap files. I think, they were created on sucessfull live view on localhost only. Today I checked, were not created on remote access.

Thank you for your time.
Regarding above, have you any new advice?

Regrads!
bbunge
Posts: 2935
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: live veiw YES on localhost, NO on others

Post by bbunge »

reinstall Debian and use the new instructions on the WIKI for Debian 9
User avatar
zd59
Posts: 102
Joined: Wed Jan 18, 2017 1:39 pm
Location: EU - Slovenia

Re: live veiw YES on localhost, NO on others

Post by zd59 »

Hello again!

Discovered very strange behaviour, and so a partial solution to the problem described at my first post.
The member of this post "Basketcase" on Tue Oct 18, 2016 8:41 am posted:
viewtopic.php?f=36&t=25382&p=97008&hili ... eam#p97008
Between the lines I found out, that CGI script, that is responsible for a streaming a live video works coorectly only when in the browser the URL for the zoneminder is its name. When you write IP instead of a name, there is no live video stream.
As I do not have a DNS at home, I had always written IP (http://10.200.200.200/zm).
As the problem is mentioned in the post above, I set a line in a host file (10.200.200.200 video-surveillance) on remote computer, then in Firefox http://video-surveillance/zm, and miraculously now I can watch live video from camera.
In the servers option in zoneminder there must be a line with a server name, in my case "video-surveillance", and user authentication in zoneminder must be OFF.

Hope that one of the developers will read this post, to correct this misbehavior. At this point I can not watch live video on Android, as host file is not accesible.

Greetings to all.
User avatar
zd59
Posts: 102
Joined: Wed Jan 18, 2017 1:39 pm
Location: EU - Slovenia

Re: live veiw YES on localhost, NO on others

Post by zd59 »

Hi!

Developers: no answers for the above?
Simple question: why no live video, if Zoneminder is addressed by IP instead of its name in web browser?
No home DNS, so if hosts file "resolve" IP to name, then live video works in browser. This can not be done on Android without rooting it. So no solution for Android.

Regards.
rockedge
Posts: 1174
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: live veiw YES on localhost, NO on others

Post by rockedge »

I still think you need to configure the web server correctly. The line you wrote
I set a line in a host file (10.200.200.200 video-surveillance) on remote computer
leads me to believe you configured the virtual users block incorrectly. Or you are using the multi-server options? Because it is confusing as to what is going wrong as you describe it.
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: live veiw YES on localhost, NO on others

Post by SteveGilvarry »

Zd59 I will try and replicate, to confirm http://localhost works but http://xxx.xxx.xxx.xxx doesn't? I normally only use the IP and don't have a localhost GUI. On my phone at the moment but I assume all your apache conf is above, if not can you add it.
Thanks
Steve
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
User avatar
zd59
Posts: 102
Joined: Wed Jan 18, 2017 1:39 pm
Location: EU - Slovenia

Re: live veiw YES on localhost, NO on others

Post by zd59 »

Hello!

I attached apache2.conf - the same as installed by corresponding Debian 8 package and (if) changed by zoneminder 1.30 installation/configuration.
Rem: .txt at the end as forum do not accept attacments ending ".conf"
The below are untached files as installed and configured by corresponding packages installed and configured by ZM.

root@video-nadzor:/etc# ls -la apache2/conf-enabled
total 8
drwxr-xr-x 2 root root 4096 Jan 6 23:38 .
drwxr-xr-x 8 root root 4096 Jan 29 12:55 ..
lrwxrwxrwx 1 root root 30 Jan 6 23:26 adminer.conf -> ../conf-available/adminer.conf
lrwxrwxrwx 1 root root 30 Jan 6 17:49 charset.conf -> ../conf-available/charset.conf
lrwxrwxrwx 1 root root 44 Jan 6 17:49 localized-error-pages.conf -> ../conf-available/localized-error-pages.conf
lrwxrwxrwx 1 root root 46 Jan 6 17:49 other-vhosts-access-log.conf -> ../conf-available/other-vhosts-access-log.conf
lrwxrwxrwx 1 root root 33 Jan 6 23:38 phpmyadmin.conf -> ../conf-available/phpmyadmin.conf
lrwxrwxrwx 1 root root 31 Jan 6 17:49 security.conf -> ../conf-available/security.conf
lrwxrwxrwx 1 root root 36 Jan 6 17:49 serve-cgi-bin.conf -> ../conf-available/serve-cgi-bin.conf
lrwxrwxrwx 1 root root 33 Jan 6 18:46 zoneminder.conf -> ../conf-available/zoneminder.conf

Pointing out, that this machine is dedicated to ZM and no other packages were installed to spoil Apache or else.

Regards!
Attachments
apache2.conf.txt
(7.22 KiB) Downloaded 186 times
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: live veiw YES on localhost, NO on others

Post by SteveGilvarry »

Unless you have multiple servers it should be blank. I am concerned you have turned all the knobs and dials now so getting you back to a default configuration, which with Firefox should work fine. I don't promise anything works on IE. Might be an idea to start over and don't change anything not in BBunge's wiki guide.
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
Locked