zmninja eventserver : how to exclude a monitor

Discussion topics related to mobile applications and ZoneMinder Event Server (including machine learning)
Post Reply
aequoushumor
Posts: 2
Joined: Mon May 22, 2017 6:27 pm

zmninja eventserver : how to exclude a monitor

Post by aequoushumor »

Is it possible to exclude a monitor from the push notifications in zmninja ?

I have unchecked the "report events" option from the monitor, but notification are still coming in. Do I need to change the minimum value too ?

I'm running zmninja (version 1.2.41) on android (galaxy S6)
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmninja eventserver : how to exclude a monitor

Post by asker »

That code is actually a little buggy - I think there is a race condition somewhere.
Do this:

1. Uncheck that monitor and hit save a few times in zmNinja. Then kill and restart zmNinja
2. Check /etc/private/tokens.txt (or wherever you kept the token file) and make sure there aren't duplicate entries for the same app token. Check the list of monitors (comma separated) to make sure that monitor you removed (monitor ID) is not there
3. If you've made sure 1 and 2 are done and you still see the problem, restart zmeventserver (should not be needed)
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
aequoushumor
Posts: 2
Joined: Mon May 22, 2017 6:27 pm

Re: zmninja eventserver : how to exclude a monitor

Post by aequoushumor »

Looks like something is crashing the eventserver. I've added the some logging below.

In the tokens.txt file, there is only one token. No sign of a duplicate token. Can I safely remove the tokens.txt file?


May 23 15:07:21 ubuntu zmeventnotification[6418]: INF [got a websocket connection from 62.235.12.42 (1) active connections]
May 23 15:07:21 ubuntu zmeventnotification[6418]: INF [Websocket remotely disconnected from 62.235.12.42]
May 23 15:07:21 ubuntu zmeventnotification[6418]: INF [got a websocket connection from 62.235.12.42 (1) active connections]
May 23 15:07:21 ubuntu zmeventnotification[6418]: INF [Websockets: New Connection Handshake requested from 62.235.12.42:58030 state=pending auth]
May 23 15:07:21 ubuntu zmeventnotification[6418]: INF [Correct authentication provided by 62.235.12.42]
May 23 15:07:21 ubuntu zmeventnotification[6418]: INF [Duplicate token found, removing old data point]
May 23 15:07:21 ubuntu zmeventnotification[6418]: INF [Storing token ...14LdUdzLec,monlist:1,2,intlist:0,0,pushstate:enabled]
May 23 15:07:21 ubuntu zmeventnotification[6418]: INF [SaveTokens called with:monlist=1,2, intlist=0,0, platform=android, push=enabled]
May 23 15:07:21 ubuntu zmeventnotification[6418]: FAT [Cannot open for write /etc/private/tokens.txt]
May 23 15:07:21 ubuntu zmdc[6365]: ERR ['zmeventnotification.pl' exited abnormally, exit status 255]
May 23 15:07:21 ubuntu zmdc[6365]: INF [Starting pending process, zmeventnotification.pl]
May 23 15:07:21 ubuntu zmdc[6365]: INF ['zmeventnotification.pl' starting at 17/05/23 15:07:21, pid = 6501]
May 23 15:07:21 ubuntu zmdc[6501]: INF ['zmeventnotification.pl' started at 17/05/23 15:07:21]
May 23 15:07:22 ubuntu zmeventnotification[6501]: INF [Push enabled via PushProxy]
May 23 15:07:22 ubuntu zmeventnotification[6501]: INF [direct APNS disabled]
May 23 15:07:22 ubuntu zmeventnotification[6501]: INF [Event Notification daemon v 0.93 starting]
May 23 15:07:22 ubuntu zmeventnotification[6501]: INF [Total event client connections: 1]
May 23 15:07:22 ubuntu zmeventnotification[6501]: INF [Reloading Monitors...]
May 23 15:07:22 ubuntu zmeventnotification[6501]: INF [Loading monitors]
May 23 15:07:22 ubuntu zmeventnotification[6501]: INF [Checking https://185.124.74.36:8801 reachability...]
May 23 15:07:23 ubuntu zmeventnotification[6501]: INF [PushProxy https://185.124.74.36:8801 is reachable.]
May 23 15:07:23 ubuntu zmeventnotification[6501]: INF [About to start listening to socket]
May 23 15:07:23 ubuntu zmeventnotification[6501]: INF [Secure WS(WSS) is enabled...]
May 23 15:07:23 ubuntu zmeventnotification[6501]: INF [Web Socket Event Server listening on port 9000]
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmninja eventserver : how to exclude a monitor

Post by asker »

Try running the zmeventserver in manual (non daemon mode) first. the README of zmeventserver explains how to do this. Looks like it can't open the tokens file - permissions issue

https://github.com/pliablepixels/zmeven ... leshooting
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
marianh
Posts: 9
Joined: Thu Sep 14, 2017 5:38 pm

Re: zmninja eventserver : how to exclude a monitor

Post by marianh »

For me, even after following the instructions above, when the app is started, all monitors are re-included.
I had to limit the list of monitors by hardcoding it in .pl script, which is not the best solution.
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmninja eventserver : how to exclude a monitor

Post by asker »

This part of the code (event server in zmNinja) is buggy.

I don't think you need to hard code it. Instead, check /etc/private/tokens.txt - you likely have multiple entries, one with all monitors and one with restricted monitors. If so, stop event server, delete the extra line in tokens and save. Start event server again (before you do this, make sure zmNinja also has the selected monitors - otherwise it will overwrite)
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
marianh
Posts: 9
Joined: Thu Sep 14, 2017 5:38 pm

Re: zmninja eventserver : how to exclude a monitor

Post by marianh »

There's only one line:
*:3,5,6,7,8,9,10,11:0,0,0,0,0,0,0,0:android:enabled

Anyway, no big deal if other things will work fine.
Cameras change very seldom, it is not a big task to update the list in script if needed.
Maybe once you will fix it ;)
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmninja eventserver : how to exclude a monitor

Post by asker »

Ok, that seems odd.

If you are willing to debug, you should monitor the event server logs - it prints logs to syslog on decisions its making. If this is the only line:

Code: Select all

*:3,5,6,7,8,9,10,11:0,0,0,0,0,0,0,0:android:enabled
And 3,5,6,7,8,9,10 are a subset of monitor IDs then it should really only be sending out notifications for these. When you have an alarm for another monitor, check what the logs say at event server.
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
marianh
Posts: 9
Joined: Thu Sep 14, 2017 5:38 pm

Re: zmninja eventserver : how to exclude a monitor

Post by marianh »

Ok, I'll check it after the weekend.
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmninja eventserver : how to exclude a monitor

Post by asker »

I misread your post. You said:
when the app is started, all monitors are re-included.
Yup, that is where the problem is in the code - what you should do is revert the hard coded changes in the event server, restart the event server, and then in the app, load up the event server settings, uncheck desired monitors and hit save a few times (this is the buggy part).
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
Post Reply