zmtrigger connection refused

Forum for questions and support relating to the 1.34.x releases only.
Post Reply
JimS
Posts: 60
Joined: Sun Feb 18, 2007 3:16 pm

zmtrigger connection refused

Post by JimS »

Ubuntu 20.04 with zoneminder that has been working fine with 5 cameras. Wanting to add external triggers.

Installed telnet:
sudo apt install telnetd telnet
Checked option OPT_TRIGGERS and restarted zoneminder. I can telnet to port 23. Verified zmtrigger is running. When I try to port 6802 I get connection refused. Disabled ufw and still get refused. Not sure what to do or look at next.
User avatar
burger
Posts: 434
Joined: Mon May 11, 2020 4:32 pm

Re: zmtrigger connection refused

Post by burger »

There is an example with telnet here:
https://wiki.zoneminder.com/ZMTrigger#O ... Video_Feed

If that doesn't work, it's maybe a firewall or networking issue. Are you sure the firewall is disabled? Can you access it on the same machine? Do you see zmtrigger.pl running in htop and on ss -ntulp or netstat -ntulp?

Remember UFW is just a frontend for either iptables or nft. Did you check that those rules are disabled?
iptables -L
or
nft list tables
nft list table <whatever table is named>
to remove rules:
iptables -F
nft flush ruleset
I assume that you are in a lan, and that the camera computer does not have an ip address on the internet.
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
JimS
Posts: 60
Joined: Sun Feb 18, 2007 3:16 pm

Re: zmtrigger connection refused

Post by JimS »

I did find that link but not much on what to do if it doesn't work. I don't know much about how the firewall works. I added telnet with:
sudo ufw allow telnet
which seemed to work for the regular port of 23. I tried to add port 6802 with:
sudo ufw allow 6802/tcp
and then on another box:
telnet 192.168.15.230 6802
which gives connection refused. Before I started this it just hung although it would have probably timed out if I had waited long enough. Will have to look some more at the firewall.
This shows the port open:
sudo ufw status
But this don't show port 6802
netstat -al | grep "LISTEN"
Not sure what to make of that...
mikb
Posts: 661
Joined: Mon Mar 25, 2013 12:34 pm

Re: zmtrigger connection refused

Post by mikb »

I believe "it just hung" before you adjusted the firewall was the firewall's fault -- you made a connection it didn't like and it threw the packet away.Thereby neither confirming nor denying that there is a service or a machine at that address/port. So called "stealth" mode :)

Having added a rule to allow tcp/telnet (which is port 23 by default) -- it wouldn't help your case, but would allow telnet as in connection to telnetd listening on port 23 to log into the machine.

Adding 6802/tcp as a rule has promoted you to "Connection refused" because now the firewall is no longer blocking, it passes the packet through but nothing is listening on that port at the server machine.

Your "netstat" seems to back that up. You have no server process on port 6802, so look to see what should be running and listening! Because it's not :)
JimS
Posts: 60
Joined: Sun Feb 18, 2007 3:16 pm

Re: zmtrigger connection refused

Post by JimS »

Thank you for the detailed explanation. Very helpful. I am thinking that zmtrigger should be listening on that port. It looks like it is running so I don't know why the connection is not made.
JimS
Posts: 60
Joined: Sun Feb 18, 2007 3:16 pm

Re: zmtrigger connection refused

Post by JimS »

I did a bit more poking around...

Code: Select all

jim@ZM-Myth:/var/log$ ps auxw | grep zmtrigger
jim      1260649  0.0  0.0   9040   656 pts/0    S+   19:03   0:00 grep --color=auto zmtrigger
which I think indicates zmtrigger is running. I tried running /usr/bin/zmtrigger.pl as my user (jim) and got a bunch of permissions errors. Ran it with sudo and it didn't throw any obvious errors. I was then able to connect from another machine. So it looks like an issue with permissions or the user running it. But not sure how to fix that.
JimS
Posts: 60
Joined: Sun Feb 18, 2007 3:16 pm

Re: zmtrigger connection refused

Post by JimS »

I thought ticking the box Opt_triggers and restarting zoneminder would take care of starting zmtrigger properly. Apparently that's not the case? Or at least it needs some tweaks?
mikb
Posts: 661
Joined: Mon Mar 25, 2013 12:34 pm

Re: zmtrigger connection refused

Post by mikb »

JimS wrote: Tue Aug 27, 2024 12:14 am I did a bit more poking around...

Code: Select all

jim@ZM-Myth:/var/log$ ps auxw | grep zmtrigger
jim      1260649  0.0  0.0   9040   656 pts/0    S+   19:03   0:00 grep --color=auto zmtrigger
which I think indicates zmtrigger is running. I tried running /usr/bin/zmtrigger.pl as my user (jim) and got a bunch of permissions errors. Ran it with sudo and it didn't throw any obvious errors. I was then able to connect from another machine. So it looks like an issue with permissions or the user running it. But not sure how to fix that.
Absolutely the opposite :D -- that shows that someone is "grepping" for the phrase zmtrigger. .... That's you! :D

I know exactly what you've done there, and I've done it myself (then kicked myself for it ...)

grepping the process table for anything will, almost always, return 1 hit of "You, looking for this thing" -- what you need is a 2nd hit saying that you, or someone, is running zmtrigger _as well_

Code: Select all

placer:~/arc/mag> ps uax | grep fnurblewomp
mjb      1178997  0.0  0.0   9084  2432 pts/3    S+   18:19   0:00 grep fnurblewomp

placer:~/arc/mag> ps uax | grep terminal
mjb         2769  0.0  0.9 1013920 36748 ?       Ssl  Aug05  29:56 /usr/libexec/gnome-terminal-server
mjb      1179001  0.0  0.0   9084  2432 pts/3    S+   18:19   0:00 grep terminal
Zmtrigger appears to be not running at the point where you looked. That's the next thing to chase. Either you looked as the wrong user (e.g. non-privilege user looking for another users processes and it being, correctly, hidden from you) or it's really not running until you manually start it.

You could test to see if it's running by doing the ps uax | grep .... as root, which would show you everything without any hiding!
JimS
Posts: 60
Joined: Sun Feb 18, 2007 3:16 pm

Re: zmtrigger connection refused

Post by JimS »

I found a post on zmtrigger not running from a couple years ago that said:
In the Servers section, the server itself needs to have the "Run Trigger Process" option set.

Update: This isn't just a tick box and doesn't appear to be needed. Just selecting Opt_trigger and going to the bottom of the page and saving seems to get this working.
Last edited by JimS on Wed Aug 28, 2024 11:41 am, edited 1 time in total.
User avatar
iconnor
Posts: 3197
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: zmtrigger connection refused

Post by iconnor »

Trying running it from command line and see if it prints out anything interesting.
sudo su -s/bin/bash zmtrigger.pl www-data
JimS
Posts: 60
Joined: Sun Feb 18, 2007 3:16 pm

Re: zmtrigger connection refused

Post by JimS »

Operator error! Looks like I failed to save the option Opt_trigger. When I went back to check it was checked it wasn't. Maybe the window was off the bottom of the screen so I couldn't see the save button. When I saved it the telnet connection worked. I will edit my post about also needing the server setting - it's doesn't seem to be needed.

Would be nice if the wiki had this info for the older version and not just what is needed for the latest version.
zmcab
Posts: 3
Joined: Wed Feb 07, 2024 10:12 pm

Re: zmtrigger connection refused

Post by zmcab »

Similar issues and solutions, but I'll also note that it didn't work for me until I restarted zoneminder after set 'OPT_TRIGGERS'. ps showed it wasn't running.

The document page doesn't show this. [[https://wiki.zoneminder.com/index.php/H ... on_with_ZM]]
User avatar
iconnor
Posts: 3197
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: zmtrigger connection refused

Post by iconnor »

I have updated the wiki to mention restarting ZM
Post Reply