Page 1 of 1

zmninja eventserver : how to exclude a monitor

Posted: Mon May 22, 2017 6:35 pm
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)

Re: zmninja eventserver : how to exclude a monitor

Posted: Mon May 22, 2017 8:56 pm
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)

Re: zmninja eventserver : how to exclude a monitor

Posted: Tue May 23, 2017 1:15 pm
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]

Re: zmninja eventserver : how to exclude a monitor

Posted: Tue May 23, 2017 2:23 pm
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

Re: zmninja eventserver : how to exclude a monitor

Posted: Thu Sep 14, 2017 6:13 pm
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.

Re: zmninja eventserver : how to exclude a monitor

Posted: Thu Sep 14, 2017 8:27 pm
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)

Re: zmninja eventserver : how to exclude a monitor

Posted: Thu Sep 14, 2017 8:38 pm
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 ;)

Re: zmninja eventserver : how to exclude a monitor

Posted: Fri Sep 15, 2017 10:43 am
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.

Re: zmninja eventserver : how to exclude a monitor

Posted: Fri Sep 15, 2017 11:15 am
by marianh
Ok, I'll check it after the weekend.

Re: zmninja eventserver : how to exclude a monitor

Posted: Fri Sep 15, 2017 6:08 pm
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).