zmeventnotification giving error `Temporary failure in name resolution`

Forum for questions and support relating to the 1.34.x releases only.
Post Reply
holmes
Posts: 13
Joined: Sun Jan 12, 2020 2:22 pm

zmeventnotification giving error `Temporary failure in name resolution`

Post by holmes »

Hi,

I got ZM-1.34 working with nginx on Ubuntu 19.10, installed as described here https://wiki.zoneminder.com/Ubuntu_Serv ... der_1.34.x with `php7.3-fpm` and corresponding change at the end of `/etc/nginx/zoneminder.conf`. Now I've installed zmeventnotification server, but when trying to configure it atm i get stuck as soon as `Making sure everything is running (in manual mode)` with following error

Code: Select all

$ sudo -u www-data /var/lib/zmeventnotification/bin/zm_event_start.sh 3 2
Traceback (most recent call last):
  File "/usr/lib/python3.7/urllib/request.py", line 1317, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/lib/python3.7/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/usr/lib/python3.7/http/client.py", line 1414, in connect
    super().connect()
  File "/usr/lib/python3.7/http/client.py", line 938, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.7/socket.py", line 707, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.7/socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 177, in <module>
    filename1, filename2, filename1_bbox, filename2_bbox = utils.download_files(args)
  File "/usr/local/lib/python3.7/dist-packages/zmes_hook_helpers/utils.py", line 130, in download_files
    input_file = opener.open(url)
  File "/usr/lib/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/lib/python3.7/urllib/request.py", line 543, in _open
    '_open', req)
  File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 1360, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib/python3.7/urllib/request.py", line 1319, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
Config is following

Code: Select all

$ sudo /usr/bin/zmeventnotification.pl --check-config
27.01.2020 02:42:25.662765 zmeventnotification[4018].INF [main:767] [PARENT: using config file: /etc/zm/zmeventnotification.ini]
27.01.2020 02:42:25.683228 zmeventnotification[4018].INF [main:767] [PARENT: using secrets file: /etc/zm/secrets.ini]
27.01.2020 02:42:25.697145 zmeventnotification[4018].INF [main:767] [PARENT: ES will not be restarted as interval is specified as 0]

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

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

Port ................................. 9001
Address .............................. [::]
Event check interval ................. 5
Monitor reload interval .............. 300

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

Use FCM .............................. yes
FCM API key .......................... (defined)
Token file ........................... /var/lib/zmeventnotification/push/tokens.txt

Use MQTT ..............................no
MQTT Server ...........................127.0.0.1
MQTT Username .........................(undefined)
MQTT Password .........................(undefined)

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

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

Use Hooks............................. 1
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'

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

Notify End only if Start success......yes

Use Hook Description........... yes
Keep frame match type.......... yes
Skipped monitors............... (undefined)
Store Frame in ZM...............yes


Picture URL ................... https://portal/zm/index.php?view=image&eid=EVENTID&fid=objdetect&width=600
Include picture................ yes
Picture username .............. user
Picture password .............. (defined)
where I've changed port to 9001 as perl is listening on port 9000 for some reason.

This "manual" test seems to be working

Code: Select all

$ sudo -u www-data ./zmeventnotification.pl --config ./zmeventnotification.ini
27.01.2020 02:35:50.665265 zmeventnotification[3397].INF [main:767] [PARENT: using config file: ./zmeventnotification.ini]
27.01.2020 02:35:50.686586 zmeventnotification[3397].INF [main:767] [PARENT: using secrets file: /etc/zm/secrets.ini]
27.01.2020 02:35:50.702918 zmeventnotification[3397].INF [main:767] [PARENT: ES will not be restarted as interval is specified as 0]
27.01.2020 02:35:50.817873 zmeventnotification[3397].INF [main:767] [PARENT: Push enabled via FCM]
27.01.2020 02:35:50.832372 zmeventnotification[3397].INF [main:767] [PARENT: MQTT Disabled]
27.01.2020 02:35:50.851975 zmeventnotification[3397].INF [main:767] [PARENT: You are running version: 5.4]
Can't ignore signal CHLD, forcing to default.
27.01.2020 02:35:50.957428 zmeventnotification[3397].WAR [main:775] [PARENT: WARNING: SSL is disabled, which means all traffic will be unencrypted]
27.01.2020 02:35:50.971946 zmeventnotification[3397].INF [main:767] [PARENT: Event Notification daemon v 5.4 starting]
27.01.2020 02:35:50.985073 zmeventnotification[3397].INF [main:767] [PARENT: Initializing FCM tokens...]
27.01.2020 02:35:51.055021 zmeventnotification[3397].INF [main:767] [PARENT: Total event client connections: 0]
27.01.2020 02:35:51.074184 zmeventnotification[3397].INF [main:767] [PARENT: Reloading Monitors...]
27.01.2020 02:35:51.091665 zmeventnotification[3397].INF [main:767] [PARENT: Re-loading monitors, emptying needsReload() list]
27.01.2020 02:35:51.106770 zmeventnotification[3397].INF [main:767] [PARENT: Secure WS is disabled...]
27.01.2020 02:35:51.117974 zmeventnotification[3397].INF [main:767] [PARENT: Web Socket Event Server listening on port 9001]
27.01.2020 02:35:56.137052 zmeventnotification[3397].INF [main:767] [PARENT: There are 0 active child forks...]
27.01.2020 02:35:56.153564 zmeventnotification[3397].INF [main:767] [PARENT: There are 0 new Events to process]
27.01.2020 02:36:01.138044 zmeventnotification[3397].INF [main:767] [PARENT: There are 0 active child forks...]
27.01.2020 02:36:01.152721 zmeventnotification[3397].INF [main:767] [PARENT: There are 0 new Events to process]
27.01.2020 02:36:06.138113 zmeventnotification[3397].INF [main:767] [PARENT: There are 0 active child forks...]
27.01.2020 02:36:06.153406 zmeventnotification[3397].INF [main:767] [PARENT: There are 0 new Events to process]
27.01.2020 02:36:11.136973 zmeventnotification[3397].INF [main:767] [PARENT: There are 0 active child forks...]
27.01.2020 02:36:11.150978 zmeventnotification[3397].INF [main:767] [PARENT: There are 0 new Events to process]
Bizarrely enough, had the same problem on previous installation (ZM-1.33.16). There i even tried installing them self signed certificates with `Common name` either `localhost` or `$HOSTNAME`, and pointing to them. No joy, got exactly the same error.

Googling for the errors showed people having them from DNS resolving, but cameras are or my local network and ZM server is on the same machine as ZMeventServer.

The server has two Gb LAN ports, one in network with cameras with fixed addy and other (on different network) connected to Gateway by DHCP

At the server firewall is inactive for now.

This happens regardless if server network is started disconnected from the Internet gateway, so there is no way its DNS from (Gateway) DHCP server does something horrible. If i manually set DNS server i get same result. I do find this NetworkManager full of suprises sometimes, but tested it there to be sure it sets things as it should.

Obviously I'm doing something wrong systematically, did someone else encountered similar problems with EventServer?
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmeventnotification giving error `Temporary failure in name resolution`

Post by asker »

Are you sure you are using the right config?

In your post you said "manual mode" is working, where you did:

Code: Select all

$ sudo -u www-data ./zmeventnotification.pl --config ./zmeventnotification.ini
Note that you are using zmeventnotification in your working directory.

When you run as a daemon, it uses /etc/zm/zmeventnotification.ini

Make sure all the settings there are the same.
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
holmes
Posts: 13
Joined: Sun Jan 12, 2020 2:22 pm

Re: zmeventnotification giving error `Temporary failure in name resolution`

Post by holmes »

/etc/zm/zmeventnotification.ini is the same file as in zmeventnotification project dir.

The only thing i have not completely plain on this server is that i have one Gb LAN card attached to PCIe port. The installation is new and clean, and did not do anything more than installed NVIDIA drivers from Ubuntu restricted repo, ZN-1.34 and tried to install zmeventnotification. I did remove avahid, cupsd and cups-browsed.

I notice now that i did not do "manual test" correctly. My cams are in Modect, and when i give them motion

Code: Select all

28.01.2020 21:09:50.831271 zmeventnotification[6286].INF [main:767] [PARENT: New event 1483 reported for Monitor:2 (Name:TerasaHD) Motion All]
28.01.2020 21:09:50.862242 zmeventnotification[6286].INF [main:767] [PARENT: There are 1 new Events to process]
28.01.2020 21:09:50.897533 zmeventnotification[6311].INF [main:767] [PARENT: Forked process:6311 to handle alarm eid:1483]
28.01.2020 21:09:50.923176 zmeventnotification[6311].INF [main:767] [|----> FORK:TerasaHD (2), eid:1483 Invoking hook on event start:'/var/lib/zmeventnotification/bin/zm_event_start.sh' 1483 2 "TerasaHD" "Motion All" "/var/cache/zoneminder/events/2/2020-01-28/1483"]
Traceback (most recent call last):
  File "/usr/lib/python3.7/urllib/request.py", line 1317, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/lib/python3.7/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/usr/lib/python3.7/http/client.py", line 1414, in connect
    super().connect()
  File "/usr/lib/python3.7/http/client.py", line 938, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.7/socket.py", line 707, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.7/socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/lib/zmeventnotification/bin/zm_detect.py", line 177, in <module>
    filename1, filename2, filename1_bbox, filename2_bbox = utils.download_files(args)
  File "/usr/local/lib/python3.7/dist-packages/zmes_hook_helpers/utils.py", line 130, in download_files
    input_file = opener.open(url)
  File "/usr/lib/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/lib/python3.7/urllib/request.py", line 543, in _open
    '_open', req)
  File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.7/urllib/request.py", line 1360, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib/python3.7/urllib/request.py", line 1319, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
28.01.2020 21:09:51.753345 zmeventnotification[6311].INF [main:767] [|----> FORK:TerasaHD (2), eid:1483 hook start returned with text: exit:1]
28.01.2020 21:09:53.777470 zmeventnotification[6311].INF [main:767] [|----> FORK:TerasaHD (2), eid:1483 Matching alarm to connection rules...]
28.01.2020 21:09:55.816995 zmeventnotification[6286].INF [main:767] [PARENT: There are 1 active child forks...]
28.01.2020 21:09:55.827458 zmeventnotification[6286].INF [main:767] [PARENT: There are 0 new Events to process]
28.01.2020 21:09:59.793232 zmeventnotification[6311].INF [main:767] [|----> FORK:TerasaHD (2), eid:1483 Event 1483 for Monitor 2 has finished]
28.01.2020 21:10:00.820793 zmeventnotification[6286].INF [main:767] [PARENT: There are 1 active child forks...]
28.01.2020 21:10:00.836141 zmeventnotification[6286].INF [main:767] [PARENT: There are 0 new Events to process]
28.01.2020 21:10:01.813917 zmeventnotification[6311].INF [main:767] [|----> FORK:TerasaHD (2), eid:1483 Invoking hook on event end:'/var/lib/zmeventnotification/bin/zm_event_end.sh' 1483 2 "TerasaHD" "Motion: All" "/var/cache/zoneminder/events/2/2020-01-28/1483"]
28.01.2020 21:10:01.830773 zmeventnotification[6311].INF [main:767] [|----> FORK:TerasaHD (2), eid:1483 hook end returned with text: exit:0]
28.01.2020 21:10:03.848757 zmeventnotification[6311].INF [main:767] [|----> FORK:TerasaHD (2), eid:1483 Not sending event end alarm, as we did not send a start alarm for this, or start hook processing failed]
28.01.2020 21:10:05.817003 zmeventnotification[6286].INF [main:767] [PARENT: There are 1 active child forks...]
It does give me the same error.

What am i missing?
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmeventnotification giving error `Temporary failure in name resolution`

Post by asker »

Well then we should treat the error literally. It can’t resolve the host name. Did you try connecting to the host name you are using in objectconfig?
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
holmes
Posts: 13
Joined: Sun Jan 12, 2020 2:22 pm

Re: zmeventnotification giving error `Temporary failure in name resolution`

Post by holmes »

Of course, i misunderstood what `portal` means, when set to `portal=http://localhost/zm` it works :D
Thank you for the answer!
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmeventnotification giving error `Temporary failure in name resolution`

Post by asker »

I'd recommend using a proper hostname, not localhost. If you plan to use push notifications to your phone, you will never see the images along with the notification because the image URL will have "localhost" which will not work when your phone tries to display it.
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
holmes
Posts: 13
Joined: Sun Jan 12, 2020 2:22 pm

Re: zmeventnotification giving error `Temporary failure in name resolution`

Post by holmes »

I will, this is only until i figure out how these cool projects are intended to to be used :) Later, i will add SSL certificates and dynDNS, to access the server remotely from phone.

Atm, i'm stuck (again). I trained few faces and now whan i call

Code: Select all

sudo -u www-data /var/lib/zmeventnotification/bin/zm_event_start.sh 18 1
or

Code: Select all

sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.ini  --eventid 18 --monitorid 1
no error is reported, on stdout, but nothing seems to happen. No new images appear in `/var/cache/events/1/$DATE/18`, or at least none with current time stamp. I greped through `ini` and `conf` files but i'm not able to find where to set `image_path` variable. Only place it appears as a part of a variable is `zmeventnotification.ini` in `hook_pass_image_path = yes`.

And something off-topic.
While i'm trying to figure our how to use ZM with ES, i have plain ZM server capturing motion from my cams (an old machine which is my current production server). There i run https://github.com/cjdelisle/cjdns which, no having direct connection to Internet, if i put another machine (like this one on which i play with things) that is connected to Internet and has also cjdns running, i can connect to my quasi-offline (production) server. I've also tried zmNinja desktop app, it is beautiful! But id does not seem to support IPv6 addresses, when i give http://[$IPv6Addy] the zmNinja seem not to like them square brackets. But IPv6 address is supposed to be in them for browser to interpret is an IPv6 address. Also tried without them in zmNinja, didn't like that either. This cjdns method is not to convenient to use from phone typically, may be only for server machine with power supply from mains and with flat-rate Internet
Last edited by holmes on Wed Jan 29, 2020 6:25 pm, edited 2 times in total.
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: zmeventnotification giving error `Temporary failure in name resolution`

Post by asker »

holmes wrote: Wed Jan 29, 2020 6:18 pm no error is reported, on stdout, but nothing seems to happen. No new images appear in `/var/cache/events/1/$DATE/18`, or at least none with current time stamp. I greped through `ini` and `conf` files but i'm not able to find where to set `image_path` variable. Only place it appears as a part of a variable is `zmeventnotification.ini` in `hook_pass_image_path = yes`.
1. Set up debugging properly https://zmeventnotification.readthedocs ... ks-logging
2. Read debug logs.
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
holmes
Posts: 13
Joined: Sun Jan 12, 2020 2:22 pm

Re: zmeventnotification giving error `Temporary failure in name resolution`

Post by holmes »

asker wrote: Wed Jan 29, 2020 6:22 pm 1. Set up debugging properly https://zmeventnotification.readthedocs ... ks-logging
2. Read debug logs.
Thank you again! Found the error in `objectconfig.ini`, it's working now :D
I'll read the docs completely before i start asking questions again :oops:
Post Reply