Event server -Pending Auth - ES not working on alarms

Discussion topics related to mobile applications and ZoneMinder Event Server (including machine learning)
Post Reply
cjd24
Posts: 14
Joined: Thu Dec 09, 2021 4:15 pm

Event server -Pending Auth - ES not working on alarms

Post by cjd24 »

I'm having real difficulty getting the object detection working. I have the ES running.
zmNinja still says Pending Auth and no object detection works when alarms are triggered.
If I push one manually to test that works.
No SSL - HTTP URLs only (all set in secrets also.

All modules installed.

OPT_USE_EVENTNOTIFICATION is enabled.

Just totally stuck on this for days. Not sure where to go from here.

Code: Select all

root@ZM:~# sudo -u www-data /usr/bin/zmeventnotification.pl --debug 
12/13/21 10:40:24.753918 zmeventnotification[918].INF [main:338] [Running on WebSocket library version:0.004]
INF:2021-12-13,10:40:24 PARENT: using config file: /etc/zm/zmeventnotification.ini
12/13/21 10:40:24.786324 zmeventnotification[918].INF [main:1048] [PARENT: using config file: /etc/zm/zmeventnotification.ini]
INF:2021-12-13,10:40:24 PARENT: using secrets file: /etc/zm/secrets.ini
12/13/21 10:40:24.795384 zmeventnotification[918].INF [main:1048] [PARENT: using secrets file: /etc/zm/secrets.ini]
DBG-2:2021-12-13,10:40:24 PARENT: Got secret token !ZMES_PICTURE_URL
DBG-2:2021-12-13,10:40:24 PARENT: Got secret token !ZM_USER
DBG-2:2021-12-13,10:40:24 PARENT: Got secret token !ZM_PASSWORD
DBG-2:2021-12-13,10:40:24 PARENT: config string substitution: {{base_data_path}} is '/var/lib/zmeventnotification'

Configuration (read /etc/zm/zmeventnotification.ini):

Secrets file.......................... /etc/zm/secrets.ini
Base data path........................ /var/lib/zmeventnotification
Restart interval (secs)............... 0

Use admin interface .................. no
Admin interface password.............. (undefined)
Admin interface persistence file ..... /var/lib/zmeventnotification/misc/escontrol_interface.dat

Port ................................. 9002
Address .............................. 192.168.1.245
Event check interval ................. 5
Monitor reload interval .............. 300
Skipped monitors...................... (undefined)

Auth enabled ......................... yes
Auth timeout ......................... 20

Use API Push.......................... yes
API Push Script....................... /var/lib/zmeventnotification/bin/pushapi_pushover.py

Use FCM .............................. yes
Use FCM V1 APIs....................... yes
FCM Date Format....................... %I:%M %p, %d-%b
Only show latest FCMv1 message........ no
Android FCM push priority............. high
Android FCM push ttl.................. (undefined)
Log FCM message ID.................... NONE
Log RAW FCM Messages...................no
FCM V1 URL............................ https://us-central1-ninja-1105.cloudfunctions.net/send_push
FCM V1 Key.............................default
 
Token file ........................... /var/lib/zmeventnotification/push/tokens.txt

Use MQTT ............................. yes
MQTT Server .......................... 192.168.1.163
MQTT Topic ........................... zoneminder
MQTT Username ........................ user
MQTT Password ........................ (defined)
MQTT Retain .......................... no
MQTT Tick Interval ................... 15
MQTT TLS CA ........................ (undefined)
MQTT TLS Cert ........................ (undefined)
MQTT TLS Key ........................ (undefined)
MQTT TLS Insecure ........................ no

SSL enabled .......................... no
SSL cert file ........................ /path/to/cert/file.pem
SSL key file ......................... /path/to/key/file.pem

Verbose .............................. yes
ES Debug level.........................4
Read alarm cause ..................... yes
Tag alarm event id ................... yes
Use custom notification sound ........ no
Send event start notification..........yes
Send event end notification............yes
Monitor rules JSON file................(undefined)

Use Hooks............................. yes
Max Parallel Hooks.................... 0
Hook Script on Event Start ........... '/var/lib/zmeventnotification/bin/zm_event_start.sh'
User Script on Event Start.............(undefined)
Hook Script on Event End.............. (undefined)
User Script on Event End...............(undefined)
Hook Skipped monitors................. (undefined)

Notify on Event Start (hook success).. all
Notify on Event Start (hook fail)..... none
Notify on Event End (hook success).... fcm,web,api
Notify on Event End (hook fail)....... none
Notify End only if Start success...... yes

Use Hook Description.................. yes
Keep frame match type................. yes
Store Frame in ZM......................yes

Picture URL .......................... http://192.168.1.245/zm/index.php?view=image&eid=EVENTID&fid=objdetect&width=600
Include picture....................... yes
Picture username ..................... user
Picture password ..................... (defined)
cjd24
Posts: 14
Joined: Thu Dec 09, 2021 4:15 pm

Re: Event server -Pending Auth - ES not working on alarms

Post by cjd24 »

Debug mode with forced alarm:


Code: Select all

12/13/21 10:53:18.765809 zmeventnotification[1038].INF [main:1048] [PARENT: |------- Starting ES version: 6.1.28 ---------|]
DBG-2:2021-12-13,10:53:18 PARENT: Started with: perl:/usr/bin/perl and command:/usr/bin/zmeventnotification.pl
Can't ignore signal CHLD, forcing to default.
DBG-1:2021-12-13,10:53:18 PARENT: ES invoked via ZMDC. Will exit when needed and have zmdc restart it
WAR:2021-12-13,10:53:18 PARENT: WARNING: SSL is disabled, which means all traffic will be unencrypted
12/13/21 10:53:18.891363 zmeventnotification[1038].WAR [main:1056] [PARENT: WARNING: SSL is disabled, which means all traffic will be unencrypted]
DBG-2:2021-12-13,10:53:18 PARENT: Parent<--Child pipe ready
INF:2021-12-13,10:53:18 PARENT: Event Notification daemon v 6.1.28 starting

12/13/21 10:53:18.894006 zmeventnotification[1038].INF [main:1048] [PARENT: Event Notification daemon v 6.1.28 starting]
DBG-1:2021-12-13,10:53:18 PARENT: Initializing FCM tokens...
INF:2021-12-13,10:53:18 PARENT: Initializing MQTT with auth connection...
12/13/21 10:53:18.895128 zmeventnotification[1038].INF [main:1048] [PARENT: Initializing MQTT with auth connection...]
DBG-1:2021-12-13,10:53:18 PARENT: Intialized MQTT with auth
DBG-1:2021-12-13,10:53:18 PARENT: Total event client connections: 1

DBG-1:2021-12-13,10:53:18 PARENT: -->checkNewEvents: Connection 1: ID-> IP->(none) Token->:... Plat: Push:
INF:2021-12-13,10:53:18 PARENT: Re-loading monitors
12/13/21 10:53:18.897183 zmeventnotification[1038].INF [main:1048] [PARENT: Re-loading monitors]
DBG-1:2021-12-13,10:53:18 PARENT: Loading Monitor-1
DBG-1:2021-12-13,10:53:18 PARENT: Loading Monitor-2
DBG-1:2021-12-13,10:53:18 PARENT: Loading Monitor-3
DBG-1:2021-12-13,10:53:18 PARENT: Loading Monitor-4
DBG-2:2021-12-13,10:53:18 PARENT: ESCONTROL_INTERFACE is disabled. Not saving control data
DBG-2:2021-12-13,10:53:18 PARENT: checkEvents() new events found=0
INF:2021-12-13,10:53:18 PARENT: Secure WS is disabled...
12/13/21 10:53:18.900556 zmeventnotification[1038].INF [main:1048] [PARENT: Secure WS is disabled...]
INF:2021-12-13,10:53:18 PARENT: Web Socket Event Server listening on port 9001
12/13/21 10:53:18.902141 zmeventnotification[1038].INF [main:1048] [PARENT: Web Socket Event Server listening on port 9001]
DBG-2:2021-12-13,10:53:23 PARENT: ----------> Tick START (active forks:0, total forks:0, active hooks: 0 running for:1 min)<--------------
DBG-2:2021-12-13,10:53:23 PARENT: After tick: TOTAL: 1,  ES_CONTROL: 1, FCM+WEB: 0, FCM: 0, WEB: 0, MQTT:1, invalid WEB: 0, PENDING: 0
DBG-2:2021-12-13,10:53:23 PARENT: There are 0 active child forks & 0 zm_detect processes running...
DBG-2:2021-12-13,10:53:23 PARENT: checkEvents() new events found=0
DBG-2:2021-12-13,10:53:23 PARENT: There are 0 new Events to process
DBG-2:2021-12-13,10:53:23 PARENT: ---------->Tick END (active forks:0, total forks:0, active hooks: 0)<--------------
DBG-2:2021-12-13,10:53:28 PARENT: ----------> Tick START (active forks:0, total forks:0, active hooks: 0 running for:1 min)<--------------
DBG-2:2021-12-13,10:53:28 PARENT: After tick: TOTAL: 1,  ES_CONTROL: 1, FCM+WEB: 0, FCM: 0, WEB: 0, MQTT:1, invalid WEB: 0, PENDING: 0
DBG-2:2021-12-13,10:53:28 PARENT: There are 0 active child forks & 0 zm_detect processes running...
INF:2021-12-13,10:53:28 PARENT: New event 139 reported for Monitor:1 (Name:Monitor-1) Forced Web[last processed eid:]
12/13/21 10:53:28.908001 zmeventnotification[1038].INF [main:1048] [PARENT: New event 139 reported for Monitor:1 (Name:Monitor-1) Forced Web[last processed eid:]]
DBG-2:2021-12-13,10:53:28 PARENT: checkEvents() new events found=1
DBG-2:2021-12-13,10:53:28 PARENT: There are 1 new Events to process
DBG-2:2021-12-13,10:53:28 PARENT: ---------->Tick END (active forks:1, total forks:1, active hooks: 0)<--------------
DBG-1:2021-12-13,10:53:28 PARENT: Forked process:1057 to handle alarm eid:139
DBG-2:2021-12-13,10:53:28 |----> FORK:Monitor-1 (1), eid:139 Adding event path:/var/cache/zoneminder/events/1/2021-12-13/139 to hook for image storage
DBG-1:2021-12-13,10:53:28 |----> FORK:Monitor-1 (1), eid:139 Invoking hook on event start:'/var/lib/zmeventnotification/bin/zm_event_start.sh' 139 1 "Monitor-1" "Forced Web" "/var/cache/zoneminder/events/1/2021-12-13/139"
DBG-2:2021-12-13,10:53:33 PARENT: ----------> Tick START (active forks:1, total forks:1, active hooks: 0 running for:1 min)<--------------
DBG-2:2021-12-13,10:53:33 PARENT: After tick: TOTAL: 1,  ES_CONTROL: 1, FCM+WEB: 0, FCM: 0, WEB: 0, MQTT:1, invalid WEB: 0, PENDING: 0
DBG-2:2021-12-13,10:53:33 PARENT: RAW TEXT-->update_parallel_hooks--TYPE--add
DBG-2:2021-12-13,10:53:33 PARENT: There are 1 active child forks & 1 zm_detect processes running...
DBG-2:2021-12-13,10:53:33 PARENT: We've already worked on Monitor:1, Event:139, not doing anything more
DBG-2:2021-12-13,10:53:33 PARENT: checkEvents() new events found=0
DBG-2:2021-12-13,10:53:33 PARENT: There are 0 new Events to process
DBG-2:2021-12-13,10:53:33 PARENT: ---------->Tick END (active forks:1, total forks:1, active hooks: 1)<--------------
DBG-2:2021-12-13,10:53:35 |----> FORK:Monitor-1 (1), eid:139 parse of hook: and []
DBG-1:2021-12-13,10:53:35 |----> FORK:Monitor-1 (1), eid:139 hook start returned with text: json:[] exit:1
DBG-2:2021-12-13,10:53:37 |----> FORK:Monitor-1 (1), eid:139 rules: Checking rules for alarm caused by eid:139, monitor:1, at: Mon Dec 13 10:53:37 2021 with cause:Forced Web
DBG-1:2021-12-13,10:53:37 |----> FORK:Monitor-1 (1), eid:139 rules: No rules found for Monitor, allowing:1
DBG-2:2021-12-13,10:53:37 |----> FORK:Monitor-1 (1), eid:139 isAllowedChannel: got type:event_start resCode:1
INF:2021-12-13,10:53:37 |----> FORK:Monitor-1 (1), eid:139 Not sending push over API as it is not allowed for event_start
12/13/21 10:53:37.378395 zmeventnotification[1057].INF [main:1048] [|----> FORK:Monitor-1 (1), eid:139 Not sending push over API as it is not allowed for event_start]
DBG-1:2021-12-13,10:53:37 |----> FORK:Monitor-1 (1), eid:139 Matching alarm to connection rules...
DBG-1:2021-12-13,10:53:37 |----> FORK:Monitor-1 (1), eid:139 Checking alarm conditions for MQTT 192.168.1.163
DBG-1:2021-12-13,10:53:37 |----> FORK:Monitor-1 (1), eid:139 Monitor 1 event: last time not found, so should send
DBG-1:2021-12-13,10:53:37 |----> FORK:Monitor-1 (1), eid:139 token is unique, shouldSendEventToConn returned true, so calling sendEvent
DBG-2:2021-12-13,10:53:37 |----> FORK:Monitor-1 (1), eid:139 isAllowedChannel: got type:event_start resCode:1
INF:2021-12-13,10:53:37 |----> FORK:Monitor-1 (1), eid:139 Not sending over MQTT as notify filters are on_success:all and on_fail:none
cjd24
Posts: 14
Joined: Thu Dec 09, 2021 4:15 pm

Re: Event server -Pending Auth - ES not working on alarms

Post by cjd24 »

Getting errors when running

sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.ini --eventid 142 --monitorid 3 --debug

Code: Select all

12/13/21 11:03:25 zmesdetect_m3[1327] DBG1 Media.py:343 [Error reading frame: 2 of max 5 contiguous errors]

12/13/21 11:03:25 zmesdetect_m3[1327] DBG1 Media.py:246 [Reached end of frame_set]

12/13/21 11:03:25 zmesdetect_m3[1327] DBG1 detect_sequence.py:650 [Ran out of frames to read]

12/13/21 11:03:25 zmesdetect_m3[1327] FAT zm_detect.py:561 [Unrecoverable error:'object' Traceback:Traceback (most recent call last):
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 556, in <module>
    main_handler()
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 426, in main_handler
    matched_data,all_data = m.detect_stream(stream=stream, options=stream_options)
  File "/usr/local/lib/python3.9/dist-packages/pyzm/ml/detect_sequence.py", line 812, in detect_stream
    for m in self.models[seq]:
KeyError: 'object'
]
cjd24
Posts: 14
Joined: Thu Dec 09, 2021 4:15 pm

Re: Event server -Pending Auth - ES not working on alarms

Post by cjd24 »

cjd24
Posts: 14
Joined: Thu Dec 09, 2021 4:15 pm

Re: Event server -Pending Auth - ES not working on alarms

Post by cjd24 »

Update:
Got the ES connected to the app now by changing to ws instead of wss.

But now the py errors on testing seem to be an issue.

Seems to hit this error:

Code: Select all

DBG1 Media.py:343 [Error reading frame: 2 of max 5 contiguous errors]
sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.ini --debug --eventid 146 --monitorid 3 --eventpath=/tmp

vs: v1.37.5
possibile incompatibility with the 3.9 python pyzm or zm_detect.py?

Code: Select all

12/13/21 13:55:31 zmesdetect_m3[1411] DBG1 Media.py:343 [Error reading frame: 2 of max 5 contiguous errors]

12/13/21 13:55:31 zmesdetect_m3[1411] DBG1 Media.py:246 [Reached end of frame_set]

12/13/21 13:55:31 zmesdetect_m3[1411] DBG1 detect_sequence.py:650 [Ran out of frames to read]

12/13/21 13:55:31 zmesdetect_m3[1411] FAT zm_detect.py:561 [Unrecoverable error:'object' Traceback:Traceback (most recent call last):
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 556, in <module>
    main_handler()
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 426, in main_handler
    matched_data,all_data = m.detect_stream(stream=stream, options=stream_options)
  File "/usr/local/lib/python3.9/dist-packages/pyzm/ml/detect_sequence.py", line 812, in detect_stream
    for m in self.models[seq]:
KeyError: 'object'
]
Post Reply