Page 1 of 1

hosts with active connections

Posted: Tue Apr 11, 2017 5:24 am
by Indigo
for home automation purposes (presence detection of devices) i'm looking for a commandline command to write all local hosts with active connections into a textfile which i can parse in my home automation system.
just like the hosts are displayed at the "Status-->Connected Hosts" page in gargoyle router
i plan to setup a cronjob to write the file and send it to a remote machine

can anyone help me with that?

Re: hosts with active connections

Posted: Tue Apr 11, 2017 7:01 am
by Lantis
Will these clients always be wireless?
https://wiki.openwrt.org/doc/faq/faq.wi ... ed_clients

Re: hosts with active connections

Posted: Tue Apr 11, 2017 9:01 am
by Indigo
in fact not, all devices are wired connections (connected through different other wlan APs)

Re: hosts with active connections

Posted: Wed Apr 12, 2017 4:35 am
by Lantis
Unless I'm missing something, there doesn't seem to be a simple way to do this.

Things that come to mind:
Parse the current dhcp leases file
Ping each address to check if it is still alive
Output list somewhere for processing/sending

Re: hosts with active connections

Posted: Thu Apr 13, 2017 2:20 am
by Indigo
dhcp leases came to my mind as well, but is not practicable for short term notification as minimum leasetime is 1h (or do i have the possibility to set minimum dhcp leasetime to 5-15min?) that would be the easiest way.
ping test is a problem since mobile phones shut down wireless after some time of inactivity (sleep) and do no response to ping anymore

Re: hosts with active connections

Posted: Thu May 11, 2017 8:36 am
by Indigo
any comments on that? is ther a way to set dhcp leasetimes less than an hour?

Re: hosts with active connections

Posted: Thu May 11, 2017 4:50 pm
by Lantis
I don't have any better ideas.
Lease times can be set to minutes by putting an "m" after the number.
You probably need to adjust this at the command line as Gargoyle defaults to hours "h"

Re: hosts with active connections

Posted: Fri May 12, 2017 2:52 am
by Indigo
yeah: that did the trick - had to set it manually in console as webinterface would not let me...

now i can use /tmp/dhcp.leases to check for presence :)