I have everything working, except one small thing. I can't stream more than one camera at a time via the web interface, it'll show one and all others will not display. I can stream all my cameras on zmNinja at once (assuming because it's uses the API to do such). I've tried looking at the source code to see how the sockets are created in zms, but it's a little bit above me (don't want to invest a whole lot of time to figure out). I noticed the "zms-\n{6}w.sock" always shows up, but only one "zms-\n{6}s.sock" file will show up in /var/run/zm/. Anyone have any ideas? I'm guessing it's probably some mis-configuration with the usage of the fgci-wrapper. Thanks!
Zoneminder works with nginx now?
without ERR [socket_sendto( /var/run/zm/zms-693159s.sock ) failed: No such file or directory]" while reading response header from upstream ????
To avoid problems with feeds from multiple cameras "fcgiwrap" should be
configured to start at least as many processes as there are cameras.
It can be done by adjusting DAEMON_OPTS in "/etc/default/fcgiwrap".
Systemd users may be affected by the following bug:
All you need to do is set the appropriate amount of FCGI_CHILDREN.
/etc/init.d/fcgiwrap
#!/bin/sh
### BEGIN INIT INFO
# Provides: fcgiwrap
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: FastCGI wrapper
# Description: Simple server for running CGI applications over FastCGI
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
SPAWN_FCGI="/usr/bin/spawn-fcgi"
DAEMON="/usr/sbin/fcgiwrap"
NAME="fcgiwrap"
DESC="FastCGI wrapper"
PIDFILE="/var/run/$NAME.pid"
test -x $SPAWN_FCGI || exit 0
test -x $DAEMON || exit 0
# FCGI_APP Variables
FCGI_CHILDREN="10"
FCGI_SOCKET="/var/run/$NAME.socket"
FCGI_USER="www-data"
FCGI_GROUP="www-data"
# Socket owner/group (will default to FCGI_USER/FCGI_GROUP if not defined)
FCGI_SOCKET_OWNER="www-data"
FCGI_SOCKET_GROUP="www-data"
. /lib/lsb/init-functions
# Default options, these can be overriden by the information
# at /etc/default/$NAME
DAEMON_OPTS="-f" # By default we redirect STDERR output from executed
# CGI through FastCGI, to disable this behaviour set
# DAEMON_OPTS to an empty value in the default's file
ENV_VARS="PATH='$PATH'" # We reset the environ for spawn-fcgi, but we use the
# contents of this variable as a prefix when calling it
# to export some variables (currently just the PATH)
DIETIME=10 # Time to wait for the server to die, in seconds
# If this value is set too low you might not
# let some servers to die gracefully and
# 'restart' will not work
QDIETIME=0.5 # The same as DIETIME, but a lot shorter for the
# stop case.
#STARTTIME=2 # Time to wait for the server to start, in seconds
# If this value is set each time the server is
# started (on start or restart) the script will
# stall to try to determine if it is running
# If it is not set and the server takes time
# to setup a pid file the log message might
# be a false positive (says it did not start
# when it actually did)
# Include defaults if available
if [ -f /etc/default/$NAME ] ; then
. /etc/default/$NAME
fi
set -e
running_pid() {
# Check if a given process pid's cmdline matches a given name
pid=$1
name=$2
[ -z "$pid" ] && return 1
[ ! -d /proc/$pid ] && return 1
cmd="$(cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1)"
# Is this the expected server
[ "$cmd" != "$name" ] && return 1
return 0
}
running() {
# Check if the process is running looking at /proc
# (works for all users)
# No pidfile, probably no daemon present
[ ! -f "$PIDFILE" ] && return 1
PIDS="$(cat "$PIDFILE")"
for pid in $PIDS; do
if [ -n "$pid" ]; then
running_pid $pid $DAEMON && return 0 || true
fi
done
return 1
}
start_server() {
ARGS="-P $PIDFILE"
# Adjust NUMBER of processes
if [ -n "$FCGI_CHILDREN" ]; then
ARGS="$ARGS -F '$FCGI_CHILDREN'"
fi
# Adjust SOCKET or PORT and ADDR
if [ -n "$FCGI_SOCKET" ]; then
ARGS="$ARGS -s '$FCGI_SOCKET'"
elif [ -n "$FCGI_PORT" ]; then
if [ -n "$FCGI_ADDR" ]; then
ARGS="$ARGS -a '$FCGI_ADDR'"
fi
ARGS="$ARGS -p '$FCGI_PORT'"
fi
# Adjust user
if [ -n "$FCGI_USER" ]; then
ARGS="$ARGS -u '$FCGI_USER'"
if [ -n "$FCGI_SOCKET" ]; then
if [ -n "$FCGI_SOCKET_OWNER" ]; then
ARGS="$ARGS -U '$FCGI_SOCKET_OWNER'"
else
ARGS="$ARGS -U '$FCGI_USER'"
fi
fi
fi
# Adjust group
if [ -n "$FCGI_GROUP" ]; then
ARGS="$ARGS -g '$FCGI_GROUP'"
if [ -n "$FCGI_SOCKET" ]; then
if [ -n "$FCGI_SOCKET_GROUP" ]; then
ARGS="$ARGS -G '$FCGI_SOCKET_GROUP'"
else
ARGS="$ARGS -G '$FCGI_GROUP'"
fi
fi
fi
eval $(echo env -i $ENV_VARS $SPAWN_FCGI $ARGS -- $DAEMON $DAEMON_OPTS) \
> /dev/null
errcode="$?"
return $errcode
}
stop_server() {
# Force the process to die killing it manually
[ ! -e "$PIDFILE" ] && return
PIDS="$(cat "$PIDFILE")"
for pid in $PIDS; do
if running_pid $pid $DAEMON; then
kill -15 $pid
# Is it really dead?
sleep "$QDIETIME"s
if running_pid $pid $DAEMON; then
kill -9 $pid
sleep "$QDIETIME"s
if running_pid $pid $DAEMON; then
echo "Cannot kill $NAME (pid=$pid)!"
exit 1
fi
fi
fi
done
rm -f "$PIDFILE"
if [ -n "$FCGI_SOCKET" ]; then
rm -f "$FCGI_SOCKET"
fi
}
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
# Check if it's running first
if running ; then
log_progress_msg "apparently already running"
log_end_msg 0
exit 0
fi
if start_server ; then
# NOTE: Some servers might die some time after they start,
# this code will detect this issue if STARTTIME is set
# to a reasonable value
[ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
if running ; then
# It's ok, the server started and is running
log_end_msg 0
else
# It is not running after we did start
log_end_msg 1
fi
else
# Either we could not start it
log_end_msg 1
fi
;;
stop|force-stop)
log_daemon_msg "Stopping $DESC" "$NAME"
if running ; then
# Only stop the server if we see it running
errcode=0
stop_server || errcode=$?
log_end_msg $errcode
else
# If it's not running don't do anything
log_progress_msg "apparently not running"
log_end_msg 0
exit 0
fi
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
errcode=0
stop_server || errcode=$?
# Wait some sensible amount, some server need this
[ -n "$DIETIME" ] && sleep $DIETIME
start_server || errcode=$?
[ -n "$STARTTIME" ] && sleep $STARTTIME
running || errcode=$?
log_end_msg $errcode
;;
status)
log_daemon_msg "Checking status of $DESC" "$NAME"
if running ; then
log_progress_msg "running"
log_end_msg 0
else
log_progress_msg "apparently not running"
log_end_msg 1
exit 1
fi
;;
# Use this if the daemon cannot reload
reload)
log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon"
log_warning_msg "cannot re-read the config file (use restart)."
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0
Everything seems fine, the only issue I have is that I cant view all camera's on the montage link, I can view them all on the montage review link which seems weird.
Any suggestions?
error in log:
2017-04-17 12:17:27.580402 web_php 2460 ERR Socket does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en/lat ... window-etc for more information.
If you can view some, but not all cameras in montage, and the number of cameras you can see is always about 6, then that is a restriction in the web browser. See the faq to address it: http://zoneminder.readthedocs.io/en/lat ... in-firefox
Since you are running nginx, you should also check your php-fpm, fcgi, fcgi-wrap config files. There are parameters for each to set limits on the number of child processes/servers, which restricts the number of simultaneous connections you can have. I forget off hand exactly what the names of the parameters are, but you can find them described in the man page documentation and the comments for each config file.
That proposed solution might work for some, but it isn't something we can implement upstream because it doesn't work for everyone.
Those of us on the project team unanimously agree that none of the existing workarounds for the browser limitation are real solutions. The fact that it has workarounds have kept us focused on other issues which don't have a workaround. In time, a real fix will be implemented, but at the moment those of us active with the project are tied up with other priorities.
Details here helped me immensely, but for those that follow, the above FCGI_CHILDREN was not applicable on my Debian 9 system. For others who run into the problem with nginx and only being able to view 1 camera a time, on Debian 9 the solution for me was to create
on my debian stretch system, I needed to create missing "/etc/default/fcgiwrap" with 'DAEMON_OPTS="-c 10"' inside and restart with "systemctl restart fcgiwrap"
now I see 10 demons on "systemctl status fcgiwrap.service"