zmeventnotification.pl: connect: Connection refused

Discussion topics related to mobile applications and ZoneMinder Event Server (including machine learning)
Post Reply
Kilonga
Posts: 4
Joined: Tue Jun 23, 2020 2:21 pm

zmeventnotification.pl: connect: Connection refused

Post by Kilonga »

Hi,

I have zoneminder working propertly and wanted to use zmNinja with it with notifications. I followed the instructions to install and configure zmeventnotification and when running it I get the following error and cannot find what is causing it:

Code: Select all

06/23/2020 10:24:57.032589 zmeventnotification[11503].INF [main:881] [PARENT: using config file: /etc/zm/zmeventnotification.ini]
06/23/2020 10:24:57.049419 zmeventnotification[11503].INF [main:881] [PARENT: using secrets file: /etc/zm/secrets.ini]
06/23/2020 10:24:57.187602 zmeventnotification[11503].INF [main:881] [PARENT: Push enabled via FCM]
06/23/2020 10:24:57.218382 zmeventnotification[11503].INF [main:881] [PARENT: MQTT Enabled]
06/23/2020 10:24:57.275316 zmeventnotification[11503].INF [main:881] [PARENT: |------- Starting ES version: 5.13 ---------|]
Can't ignore signal CHLD, forcing to default.
06/23/2020 10:24:57.406541 zmeventnotification[11503].INF [main:881] [PARENT: Event Notification daemon v 5.13 starting]
06/23/2020 10:24:57.417083 zmeventnotification[11503].INF [main:881] [PARENT: Initializing MQTT connection...]
06/23/2020 10:24:57.454017 zmeventnotification[11503].INF [main:881] [PARENT: Re-loading monitors]
06/23/2020 10:24:57.492540 zmeventnotification[11503].INF [main:881] [PARENT: Secure WS(WSS) is enabled...]
06/23/2020 10:24:57.527984 zmeventnotification[11503].INF [main:881] [PARENT: Web Socket Event Server listening on port 9000]
/usr/bin/zmeventnotification.pl: connect: Connection refused
This is the output of "--check-config"

Code: Select all

06/23/2020 10:27:25.420532 zmeventnotification[11667].INF [main:881] [PARENT: using config file: /etc/zm/zmeventnotification.ini]
06/23/2020 10:27:25.437743 zmeventnotification[11667].INF [main:881] [PARENT: using secrets file: /etc/zm/secrets.ini]

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

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

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

Port ................................. 9000
Address .............................. 0.0.0.0 
Event check interval ................. 5
Monitor reload interval .............. 300
Skipped monitors...................... (undefined)

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

Use API Push.......................... no
API Push Script....................... (undefined)

Use FCM .............................. yes
FCM Date Format....................... %I:%M %p, %d-%b
FCM API key .......................... (defined)
Token file ........................... /var/lib/zmeventnotification/push/tokens.txt

Use MQTT ............................. yes
MQTT Server .......................... 127.0.0.1
MQTT Username ........................ mqtt_zm
MQTT Password ........................ (defined)
MQTT Retain .......................... no
MQTT Tick Interval ................... 15

SSL enabled .......................... yes
SSL cert file ........................ /etc/letsencrypt/rsa-live/kilonga.net/cert.pem
SSL key file ......................... /etc/letsencrypt/rsa-live/kilonga.net/privkey.pem

Verbose .............................. no
ES Debug level.........................2
Read alarm cause ..................... yes
Tag alarm event id ................... yes
Use custom notification sound ........ no
Send event end notification............yes

Use Hooks............................. yes
Hook Script on Event Start ........... '/var/lib/zmeventnotification/bin/zm_event_start.sh'
Hook Script on Event End.............. '/var/lib/zmeventnotification/bin/zm_event_end.sh'
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 .......................... https://kilonga.net/zm/index.php?view=image&eid=EVENTID&fid=objdetect&width=600
Include picture....................... yes
Picture username ..................... admin	
Picture password ..................... (defined)
I would appreciate any help you can provide.

Thanks!
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmeventnotification.pl: connect: Connection refused

Post by asker »

1. make sure multiple instances of the server are not running
2. To start with, don't run it as a daemon, run it manually
3. Enable debug logs for the ES so I get to see debug logs of what is happening when you run it (also make sure you are running it with -u www-data)
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
Kilonga
Posts: 4
Joined: Tue Jun 23, 2020 2:21 pm

Re: zmeventnotification.pl: connect: Connection refused

Post by Kilonga »

I made sure no other processes are running. No longer running it as daemon. I am still getting the same error. I ran it with -u www-data and logs enabled and this is what I get:

Code: Select all

# sudo -u www-data /usr/bin/zmeventnotification.pl 
06/23/2020 22:35:52.614206 zmeventnotification[57773].INF [main:881] [PARENT: using config file: /etc/zm/zmeventnotification.ini]
06/23/2020 22:35:52.656851 zmeventnotification[57773].INF [main:881] [PARENT: using secrets file: /etc/zm/secrets.ini]
CONSOLE DBG-2:2020-06-23,22:35:52 PARENT: Got secret token !ZMES_PICTURE_URL
CONSOLE DBG-2:2020-06-23,22:35:52 PARENT: Got secret token !ZM_USER
CONSOLE DBG-2:2020-06-23,22:35:52 PARENT: Got secret token !ZM_PASSWORD
CONSOLE DBG-3:2020-06-23,22:35:52 PARENT: config string substitution: {{base_data_path}} is '/var/lib/zmeventnotification'
CONSOLE DBG-3:2020-06-23,22:35:52 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)............... (undefined)

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

Port ................................. 9000
Address .............................. 0.0.0.0 
Event check interval ................. 5
Monitor reload interval .............. 300
Skipped monitors...................... (undefined)

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

Use API Push.......................... no
API Push Script....................... (undefined)

Use FCM .............................. yes
FCM Date Format....................... %I:%M %p, %d-%b
FCM API key .......................... (defined)
Token file ........................... /var/lib/zmeventnotification/push/tokens.txt

Use MQTT ............................. yes
MQTT Server .......................... 127.0.0.1
MQTT Username ........................ mqtt_zm
MQTT Password ........................ (defined)
MQTT Retain .......................... no
MQTT Tick Interval ................... 15

SSL enabled .......................... yes
SSL cert file ........................ /etc/letsencrypt/rsa-live/kilonga.net/cert.pem
SSL key file ......................... /etc/letsencrypt/rsa-live/kilonga.net/privkey.pem

Verbose .............................. yes
ES Debug level.........................5 
Read alarm cause ..................... yes
Tag alarm event id ................... yes
Use custom notification sound ........ no
Send event end notification............yes

Use Hooks............................. yes
Hook Script on Event Start ........... '/var/lib/zmeventnotification/bin/zm_event_start.sh'
Hook Script on Event End.............. '/var/lib/zmeventnotification/bin/zm_event_end.sh'
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 .......................... https://kilonga.net/zm/index.php?view=image&eid=EVENTID&fid=objdetect&width=600
Include picture....................... yes
Picture username ..................... admin	
Picture password ..................... (defined)

CONSOLE INF:2020-06-23,22:35:52 PARENT: Push enabled via FCM
06/23/2020 22:35:52.833220 zmeventnotification[57773].INF [main:881] [PARENT: Push enabled via FCM]
CONSOLE INF:2020-06-23,22:35:52 PARENT: MQTT Enabled
06/23/2020 22:35:52.849251 zmeventnotification[57773].INF [main:881] [PARENT: MQTT Enabled]
CONSOLE INF:2020-06-23,22:35:52 PARENT: |------- Starting ES version: 5.13 ---------|
06/23/2020 22:35:52.874248 zmeventnotification[57773].INF [main:881] [PARENT: |------- Starting ES version: 5.13 ---------|]
CONSOLE DBG-1:2020-06-23,22:35:52 PARENT: Started with: perl:/usr/bin/perl and command:/usr/bin/zmeventnotification.pl
Can't ignore signal CHLD, forcing to default.
CONSOLE DBG-1:2020-06-23,22:35:53 PARENT: ES invoked manually. Will handle restarts ourselves
CONSOLE DBG-2:2020-06-23,22:35:53 PARENT: Parent<--Child pipe ready
CONSOLE INF:2020-06-23,22:35:53 PARENT: Event Notification daemon v 5.13 starting

06/23/2020 22:35:53.024811 zmeventnotification[57773].INF [main:881] [PARENT: Event Notification daemon v 5.13 starting]
CONSOLE DBG-1:2020-06-23,22:35:53 PARENT: Initializing FCM tokens...
CONSOLE INF:2020-06-23,22:35:53 PARENT: Initializing MQTT connection...
06/23/2020 22:35:53.045610 zmeventnotification[57773].INF [main:881] [PARENT: Initializing MQTT connection...]
CONSOLE DBG-1:2020-06-23,22:35:53 PARENT: Intialized MQTT with auth
CONSOLE DBG-1:2020-06-23,22:35:53 PARENT: Total event client connections: 1

CONSOLE DBG-1:2020-06-23,22:35:53 PARENT: -->checkNewEvents: Connection 1: ID-> IP->(none) Token->:... Plat: Push:
CONSOLE INF:2020-06-23,22:35:53 PARENT: Re-loading monitors
06/23/2020 22:35:53.072532 zmeventnotification[57773].INF [main:881] [PARENT: Re-loading monitors]
CONSOLE DBG-1:2020-06-23,22:35:53 PARENT: Loading Driveway
CONSOLE DBG-1:2020-06-23,22:35:53 PARENT: Loading Kitchen
CONSOLE DBG-1:2020-06-23,22:35:53 PARENT: ESCONTROL_INTERFACE: Saving admin interfaces to /var/lib/zmeventnotification/misc/escontrol_interface.dat
CONSOLE DBG-2:2020-06-23,22:35:53 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-06-23,22:35:53 PARENT: About to start listening to socket
CONSOLE INF:2020-06-23,22:35:53 PARENT: Secure WS(WSS) is enabled...
06/23/2020 22:35:53.116799 zmeventnotification[57773].INF [main:881] [PARENT: Secure WS(WSS) is enabled...]
CONSOLE INF:2020-06-23,22:35:53 PARENT: Web Socket Event Server listening on port 9000
06/23/2020 22:35:53.134928 zmeventnotification[57773].INF [main:881] [PARENT: Web Socket Event Server listening on port 9000]
CONSOLE DBG-2:2020-06-23,22:35:58 PARENT: ---------->Tick START<--------------
CONSOLE DBG-3:2020-06-23,22:35:58 PARENT: After tick: TOTAL: 1,  ES_CONTROL: 1, FCM+WEB: 0, FCM: 0, WEB: 0, MQTT:1, invalid WEB: 0, PENDING: 0
CONSOLE DBG-2:2020-06-23,22:35:58 PARENT: There are 0 active child forks...
CONSOLE DBG-2:2020-06-23,22:35:58 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-06-23,22:35:58 PARENT: There are 0 new Events to process
CONSOLE DBG-2:2020-06-23,22:35:58 PARENT: ---------->Tick END<--------------
CONSOLE DBG-2:2020-06-23,22:36:03 PARENT: ---------->Tick START<--------------
CONSOLE DBG-3:2020-06-23,22:36:03 PARENT: After tick: TOTAL: 1,  ES_CONTROL: 1, FCM+WEB: 0, FCM: 0, WEB: 0, MQTT:1, invalid WEB: 0, PENDING: 0
CONSOLE DBG-2:2020-06-23,22:36:03 PARENT: There are 0 active child forks...
CONSOLE DBG-2:2020-06-23,22:36:03 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-06-23,22:36:03 PARENT: There are 0 new Events to process
CONSOLE DBG-2:2020-06-23,22:36:03 PARENT: ---------->Tick END<--------------
CONSOLE DBG-2:2020-06-23,22:36:08 PARENT: ---------->Tick START<--------------
CONSOLE DBG-2:2020-06-23,22:36:08 PARENT: MQTT tick interval (15 sec) elapsed.
/usr/bin/zmeventnotification.pl: connect: Connection refused
CONSOLE DBG-3:2020-06-23,22:36:08 PARENT: After tick: TOTAL: 1,  ES_CONTROL: 1, FCM+WEB: 0, FCM: 0, WEB: 0, MQTT:1, invalid WEB: 0, PENDING: 0
CONSOLE DBG-2:2020-06-23,22:36:08 PARENT: There are 0 active child forks...
CONSOLE DBG-2:2020-06-23,22:36:08 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-06-23,22:36:08 PARENT: There are 0 new Events to process
CONSOLE DBG-2:2020-06-23,22:36:08 PARENT: ---------->Tick END<--------------
CONSOLE DBG-2:2020-06-23,22:36:13 PARENT: ---------->Tick START<--------------
CONSOLE DBG-3:2020-06-23,22:36:13 PARENT: After tick: TOTAL: 1,  ES_CONTROL: 1, FCM+WEB: 0, FCM: 0, WEB: 0, MQTT:1, invalid WEB: 0, PENDING: 0
CONSOLE DBG-2:2020-06-23,22:36:13 PARENT: There are 0 active child forks...
CONSOLE DBG-2:2020-06-23,22:36:13 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-06-23,22:36:13 PARENT: There are 0 new Events to process
CONSOLE DBG-2:2020-06-23,22:36:13 PARENT: ---------->Tick END<--------------
Kilonga
Posts: 4
Joined: Tue Jun 23, 2020 2:21 pm

Re: zmeventnotification.pl: connect: Connection refused

Post by Kilonga »

It seems mosquitto had crashed and it couldn't connect. I restarted it and it now seems to work (at least I don't get any more errors). How do I do a quick test to prove it is working?
Kilonga
Posts: 4
Joined: Tue Jun 23, 2020 2:21 pm

Re: zmeventnotification.pl: connect: Connection refused

Post by Kilonga »

Got it to work. It was missing a few python modules. So far I love ZoneMinder and zmNinja.
Post Reply