Force an "event" when a camera disconnects.

Forum for questions and support relating to the 1.32.x releases only.
Post Reply
dws
Posts: 43
Joined: Mon Jan 15, 2018 2:05 pm

Force an "event" when a camera disconnects.

Post by dws »

In previous versions, when a camera lost connectivity, it was recorded as an event. This also had the unfortunate side-effect of pegging out the CPU until the camera re-connected.

I'm wondering if there's a way to force this behavior in 1.32 without the CPU going ballistic.

Currently, when a cam goes offline, ZM tries to reconnect, but this isn't recorded as an event. I'd like it to.

Any hints on how to do this? Google searches and the docs don't seem to yield any results, unless I've missed something.

Thanks in advance.
dws
Posts: 43
Joined: Mon Jan 15, 2018 2:05 pm

Re: Force an "event" when a camera disconnects.

Post by dws »

Anyone? How do I turn the "signal" events back on?
pavlo
Posts: 11
Joined: Wed Jan 09, 2019 11:46 pm

Re: Force an "event" when a camera disconnects.

Post by pavlo »

I just registered here to post about a similar problem. I just upgraded from 1.30.x to 1.32.3, which broke several things and I found the easiest way out was to simply wipe everything and start from scratch with 1.32.3 this time.

One of the things I noticed after the upgrade, and now still with a fresh installation, is that the blue screen has gone missing, and signal lost events don't show up anymore. Could I be experiencing the same problem as the OP?

I have tried this several times, on bare metal with Ubuntu server 16.04.5 LTS, in a VM with a fresh-that-day install of Ubuntu server 16.04.5 LTS, and another VM with a fresh install of Ubuntu server 18.04.1 LTS. Always installed according to the easy Ubuntu 16.04 guide (although with 18.04 the php directory is 7.2 instead of 7.0, that's the only difference, it had the same behaviour regardless).

The weird thing is everything else works fine (well, mostly, still tweaking stuff to adapt to various little changes since 1.30). Live monitor view works fine, event view works fine, it's just if a camera disconnects now instead of ZoneMinder noticing this and putting up a blue screen, it just shows nothing until the camera comes back. Same behaviour on all installations.

I've spent a lot of hours on this seemingly minor issue, but I really need to know when signal has been lost. I have various scripts that crawl around the events directory tree to do various things, I might add the function of noticing whether any of the cameras suddenly stop adding new frames as a workaround in the meantime (only good for cameras that record continuously of course, but all mine do).

I'm tried searching every error and warning in the log files, no sites come back that mention this problem. Not sure which log entries are relevant? Here's some from the 18.04 VM (this is while trying to view a monitor for a camera that's been disconnected and I get the blank screen instead of a blue screen + timestamp, when the camera is connected it all works fine):

Code: Select all

Jan 10 00:11:16 zoneminder-test zmc_m1[35631]: INF [zmc_m1] [Starting Capture version 1.32.3]
Jan 10 00:11:16 zoneminder-test zmc_m1[35631]: INF [zmc_m1] [Priming capture from rtsp://admin:[sillyme;-)]@192.168.127.81:554/Streaming/Channels/101?tcp]
Jan 10 00:11:25 zoneminder-test zmwatch[24510]: INF [Restarting capture daemon for Monitor-1, no image since startup. Startup time was 1547079076 - now 1547079085 > 5]
Jan 10 00:11:26 zoneminder-test zmdc[24463]: INF ['zma -m 1' sending stop to pid 35634 at 19/01/10 00:11:26]
Jan 10 00:11:26 zoneminder-test zmdc[24463]: INF ['zma -m 1' exited, signal 14]
Jan 10 00:11:26 zoneminder-test zmdc[24463]: INF ['zmc -m 1' sending stop to pid 35631 at 19/01/10 00:11:26]
Jan 10 00:11:26 zoneminder-test zmc_m1[35631]: INF [zmc_m1] [Got signal 15 (Terminated), exiting]
Jan 10 00:11:26 zoneminder-test zmc_m1[35631]: ERR [zmc_m1] [Unable to open input rtsp://admin:[sillyme;-)]@192.168.127.81:554/Streaming/Channels/101?tcp due to: Interrupted system call]
Jan 10 00:11:26 zoneminder-test zmc_m1[35631]: ERR [zmc_m1] [Failed to prime capture of initial monitor]
Jan 10 00:11:27 zoneminder-test zmdc[24463]: INF ['zma -m 1' starting at 19/01/10 00:11:27, pid = 35641]
Jan 10 00:11:27 zoneminder-test zmdc[35641]: INF ['zma -m 1' started at 19/01/10 00:11:27]
Jan 10 00:11:31 zoneminder-test zmfilter_1[24491]: INF [Checking filter PurgeWhenFull delete returned 0 events ]
Jan 10 00:11:32 zoneminder-test zmfilter_2[24497]: INF [Checking filter Update DiskSpace update disk space returned 0 events ]
Jan 10 00:11:36 zoneminder-test zmdc[24463]: INF ['zmc -m 1' exited normally]
Jan 10 00:11:37 zoneminder-test zmwatch[24510]: ERR [Memory map file '/dev/shm/zm.mmap.1' does not exist.  zmc might not be running.]
Jan 10 00:11:37 zoneminder-test zmwatch[24510]: INF [Restarting capture daemon for Monitor-1, shared data not valid]
Jan 10 00:11:37 zoneminder-test zma_m1[35641]: INF [zma_m1] [In mode 4/1, warming up]
Jan 10 00:11:37 zoneminder-test zma_m1[35641]: WAR [zma_m1] [Impossible situation.  No timestamp on captured image index was 0, image-buffer_count was (20)]
Jan 10 00:11:37 zoneminder-test zma_m1[35641]: WAR [zma_m1] [Impossible situation.  No timestamp on captured image index was 0, image-buffer_count was (20)]
Jan 10 00:11:37 zoneminder-test zmdc[24463]: INF [Starting pending process, zmc -m 1]
Jan 10 00:11:37 zoneminder-test zmdc[35645]: INF ['zmc -m 1' started at 19/01/10 00:11:37]
Jan 10 00:11:37 zoneminder-test zmdc[24463]: INF ['zmc -m 1' starting at 19/01/10 00:11:37, pid = 35645]
Jan 10 00:11:37 zoneminder-test zmdc[24463]: INF ['zma -m 1' exited normally]
Jan 10 00:11:37 zoneminder-test zmdc[24463]: INF [Command 'zma -m 1' removed from pending list at 19/01/10 00:11:37]
Jan 10 00:11:37 zoneminder-test zmc_m1[35645]: INF [zmc_m1] [Starting Capture version 1.32.3]
Jan 10 00:11:37 zoneminder-test zmc_m1[35645]: INF [zmc_m1] [Priming capture from rtsp://admin:[sillyme;-)]@192.168.127.81:554/Streaming/Channels/101?tcp]
Jan 10 00:11:37 zoneminder-test zmdc[24463]: INF ['zmc -m 1' sending stop to pid 35645 at 19/01/10 00:11:37]
Jan 10 00:11:37 zoneminder-test zmc_m1[35645]: INF [zmc_m1] [Got signal 15 (Terminated), exiting]
Jan 10 00:11:37 zoneminder-test zmc_m1[35645]: ERR [zmc_m1] [Unable to open input rtsp://admin:[sillyme;-)]@192.168.127.81:554/Streaming/Channels/101?tcp due to: Interrupted system call]
Jan 10 00:11:37 zoneminder-test zmc_m1[35645]: ERR [zmc_m1] [Failed to prime capture of initial monitor]
Jan 10 00:11:38 zoneminder-test zmdc[35651]: INF ['zma -m 1' started at 19/01/10 00:11:38]
Jan 10 00:11:38 zoneminder-test zmdc[24463]: INF ['zma -m 1' starting at 19/01/10 00:11:38, pid = 35651]
Jan 10 00:11:47 zoneminder-test zmdc[24463]: INF ['zmc -m 1' exited normally]
Jan 10 00:11:48 zoneminder-test zmwatch[24510]: ERR [Memory map file '/dev/shm/zm.mmap.1' does not exist.  zmc might not be running.]
Jan 10 00:11:48 zoneminder-test zmwatch[24510]: INF [Restarting capture daemon for Monitor-1, shared data not valid]
Jan 10 00:11:48 zoneminder-test zma_m1[35651]: INF [zma_m1] [In mode 4/1, warming up]
Jan 10 00:11:48 zoneminder-test zma_m1[35651]: WAR [zma_m1] [Impossible situation.  No timestamp on captured image index was 0, image-buffer_count was (20)]
Jan 10 00:11:48 zoneminder-test zma_m1[35651]: WAR [zma_m1] [Impossible situation.  No timestamp on captured image index was 0, image-buffer_count was (20)]
Jan 10 00:11:48 zoneminder-test zmdc[24463]: INF ['zma -m 1' exited normally]
Jan 10 00:11:48 zoneminder-test zmdc[24463]: INF [Command 'zma -m 1' removed from pending list at 19/01/10 00:11:48]
Jan 10 00:11:48 zoneminder-test zmdc[24463]: INF [Command 'zmc -m 1' removed from pending list at 19/01/10 00:11:48]
Jan 10 00:11:49 zoneminder-test zms_m1[35660]: ERR [zms_m1] [Got empty memory map file size 0, is the zmc process for this monitor running?]
Jan 10 00:11:49 zoneminder-test zmdc[24463]: INF ['zma -m 1' starting at 19/01/10 00:11:49, pid = 35662]
Jan 10 00:11:49 zoneminder-test zmdc[35662]: INF ['zma -m 1' started at 19/01/10 00:11:49]
Jan 10 00:11:49 zoneminder-test zms_m1[35660]: ERR [zms_m1] [Unable to connect to monitor id 1 for streaming]
Jan 10 00:11:49 zoneminder-test zms_m1[35660]: ERR [zms_m1] [Unable to connect to zmc process for monitor 1]
Jan 10 00:11:49 zoneminder-test zma_m1[35662]: ERR [zma_m1] [Got empty memory map file size 0, is the zmc process for this monitor running?]
Jan 10 00:11:49 zoneminder-test zmdc[24463]: ERR ['zma -m 1' exited abnormally, exit status 255]
Jan 10 00:11:50 zoneminder-test zmdc[24463]: INF [Starting pending process, zma -m 1]
Jan 10 00:11:50 zoneminder-test web_php[24606]: ERR [Socket /var/run/zm/zms-404651s.sock 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/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information.]
Jan 10 00:11:50 zoneminder-test zmdc[24463]: INF ['zma -m 1' starting at 19/01/10 00:11:50, pid = 35663]
Jan 10 00:11:50 zoneminder-test zmdc[35663]: INF ['zma -m 1' started at 19/01/10 00:11:50]
Jan 10 00:11:50 zoneminder-test web_php[24606]: ERR [getStreamCmdResponse stream error: Socket /var/run/zm/zms-404651s.sock 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/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information. - checkStreamForErrors()]
Jan 10 00:11:51 zoneminder-test zma_m1[35663]: ERR [zma_m1] [Got empty memory map file size 0, is the zmc process for this monitor running?]
Jan 10 00:11:51 zoneminder-test zmdc[24463]: ERR ['zma -m 1' exited abnormally, exit status 255]
Jan 10 00:11:51 zoneminder-test zms_m1[35667]: ERR [zms_m1] [Got empty memory map file size 0, is the zmc process for this monitor running?]
Jan 10 00:11:51 zoneminder-test zms_m1[35667]: ERR [zms_m1] [Unable to connect to monitor id 1 for streaming]
Jan 10 00:11:51 zoneminder-test zms_m1[35667]: ERR [zms_m1] [Unable to connect to zmc process for monitor 1]
Jan 10 00:11:52 zoneminder-test web_php[24606]: ERR [Socket /var/run/zm/zms-624162s.sock 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/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information.]
Jan 10 00:11:52 zoneminder-test web_php[24606]: ERR [getStreamCmdResponse stream error: Socket /var/run/zm/zms-624162s.sock 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/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information. - checkStreamForErrors()]
Jan 10 00:11:53 zoneminder-test zms_m1[35671]: ERR [zms_m1] [Got empty memory map file size 0, is the zmc process for this monitor running?]
Jan 10 00:11:53 zoneminder-test zms_m1[35671]: ERR [zms_m1] [Unable to connect to monitor id 1 for streaming]
Jan 10 00:11:53 zoneminder-test zms_m1[35671]: ERR [zms_m1] [Unable to connect to zmc process for monitor 1]
Jan 10 00:11:53 zoneminder-test web_php[24606]: ERR [Socket /var/run/zm/zms-853437s.sock 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/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information.]
Jan 10 00:11:53 zoneminder-test web_php[24606]: ERR [getStreamCmdResponse stream error: Socket /var/run/zm/zms-853437s.sock 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/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information. - checkStreamForErrors()]
Jan 10 00:11:54 zoneminder-test zms_m1[35675]: ERR [zms_m1] [Got empty memory map file size 0, is the zmc process for this monitor running?]
Jan 10 00:11:54 zoneminder-test zms_m1[35675]: ERR [zms_m1] [Unable to connect to monitor id 1 for streaming]
Jan 10 00:11:54 zoneminder-test zms_m1[35675]: ERR [zms_m1] [Unable to connect to zmc process for monitor 1]
Jan 10 00:11:56 zoneminder-test web_php[24606]: ERR [Socket /var/run/zm/zms-903095s.sock 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/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information.]
Jan 10 00:11:56 zoneminder-test zmdc[24463]: INF [Starting pending process, zma -m 1]
Jan 10 00:11:56 zoneminder-test zmdc[35678]: INF ['zma -m 1' started at 19/01/10 00:11:56]
Jan 10 00:11:56 zoneminder-test zmdc[24463]: INF ['zma -m 1' starting at 19/01/10 00:11:56, pid = 35678]
Jan 10 00:11:56 zoneminder-test web_php[24606]: ERR [getStreamCmdResponse stream error: Socket /var/run/zm/zms-903095s.sock 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/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information. - checkStreamForErrors()]
Jan 10 00:11:56 zoneminder-test zma_m1[35678]: ERR [zma_m1] [Got empty memory map file size 0, is the zmc process for this monitor running?]
Jan 10 00:11:56 zoneminder-test zmdc[24463]: ERR ['zma -m 1' exited abnormally, exit status 255]
Jan 10 00:11:57 zoneminder-test web_php[24606]: ERR [Socket /var/run/zm/zms-903095s.sock 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/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information.]
Last edited by pavlo on Thu Jan 10, 2019 12:23 am, edited 1 time in total.
pavlo
Posts: 11
Joined: Wed Jan 09, 2019 11:46 pm

Re: Force an "event" when a camera disconnects.

Post by pavlo »

dws wrote: Mon Jan 07, 2019 5:25 pm I'm wondering if there's a way to force this behavior in 1.32 without the CPU going ballistic.
I can also partially answer this question, in 1.30 if you set the maximum fps to a little higher than the camera's fps, you could limit how fast it tried to process that blue screen (otherwise it sends as many of those blue frames per second as your system can handle). I hope that 1.32 will regain the blue screen, once it does then limiting the fps should work the same way.
dws
Posts: 43
Joined: Mon Jan 15, 2018 2:05 pm

Re: Force an "event" when a camera disconnects.

Post by dws »

pavlo wrote: Thu Jan 10, 2019 12:18 am
dws wrote: Mon Jan 07, 2019 5:25 pm I'm wondering if there's a way to force this behavior in 1.32 without the CPU going ballistic.
I can also partially answer this question, in 1.30 if you set the maximum fps to a little higher than the camera's fps, you could limit how fast it tried to process that blue screen (otherwise it sends as many of those blue frames per second as your system can handle). I hope that 1.32 will regain the blue screen, once it does then limiting the fps should work the same way.
Pavlo:

That'll give us the blue screen showing up in the database, but no "signal" event in the events list. I'd like to be able to see if/when the signal was actually lost without having to dig through the PoE switch's (or ZM's, for that matter) logs on the log server.

A "signal" event, like what was present in 1.30 and before, is the easiest way from within ZM.
pavlo
Posts: 11
Joined: Wed Jan 09, 2019 11:46 pm

Re: Force an "event" when a camera disconnects.

Post by pavlo »

I believe the missing blue screen and missing signal event entries are the same issue, and when one comes back, they both will. Just waiting for someone who knows more to chime in as to why ZoneMinder doesn't notice those anymore, because I see people talking about 1.32 as if it still behaves like 1.30 which confuse me greatly...

Or have you or others seen blue screen still working but no signal events being entered? If so then I'm completely lost, could be totally separate issues.
dws
Posts: 43
Joined: Mon Jan 15, 2018 2:05 pm

Re: Force an "event" when a camera disconnects.

Post by dws »

I've seen no "blue screen" events at all... Increasing or decreasing sample framerate has zero effect on the appearance of blue screen events, and no "signal" events are ever generated.

I'd like to get the "signal" events back.
dws
Posts: 43
Joined: Mon Jan 15, 2018 2:05 pm

Re: Force an "event" when a camera disconnects.

Post by dws »

Bumping the thread, in case @iconnor or someone on the dev team hasn't seen it yet...

Please... could really use an answer to this one...
User avatar
iconnor
Posts: 2880
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Force an "event" when a camera disconnects.

Post by iconnor »

I should be able to get this fixed fairly easily. Just have to signal zma.. Used to be that zmc and zma would actually die. Now that doesn't happen so we need some new logic
User avatar
iconnor
Posts: 2880
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Force an "event" when a camera disconnects.

Post by iconnor »

Actually after looking at the code, any capture failure should trigger the end of an event. Will have to investigate further.
dws
Posts: 43
Joined: Mon Jan 15, 2018 2:05 pm

Re: Force an "event" when a camera disconnects.

Post by dws »

iconnor wrote: Wed Jan 16, 2019 8:20 pm Actually after looking at the code, any capture failure should trigger the end of an event. Will have to investigate further.
Agreed... But any time a camera reboots/is powered off/etc, I believe a signal event should be generated, so the timing can be inspected on the reviews. This way, if a cam is interfered with, other cams can be inspected to see who/what happened at that time (or just before) that made the cam fall off the network.

Failure of the cam will stop a motion capture because no further motion will be detected, but that's not all that needs to be recorded. It's difficult to determine from just the "events list" whether the event ended because motion stopped or because the camera went offline.
dws
Posts: 43
Joined: Mon Jan 15, 2018 2:05 pm

Re: Force an "event" when a camera disconnects.

Post by dws »

Bump
dws
Posts: 43
Joined: Mon Jan 15, 2018 2:05 pm

Re: Force an "event" when a camera disconnects.

Post by dws »

Any update on this issue?

-dws
dws
Posts: 43
Joined: Mon Jan 15, 2018 2:05 pm

Re: Force an "event" when a camera disconnects.

Post by dws »

Any further updates on this?
Post Reply