hosts with active connections

General discussion about Gargoyle, OpenWrt or anything else even remotely related to the project

Moderator: Moderators

Post Reply
Indigo
Posts: 23
Joined: Fri May 08, 2015 1:00 am

hosts with active connections

Post 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?

Lantis
Moderator
Posts: 7063
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: hosts with active connections

Post by Lantis »

Will these clients always be wireless?
https://wiki.openwrt.org/doc/faq/faq.wi ... ed_clients
https://lantisproject.com/downloads/gargoylebuilds for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

Indigo
Posts: 23
Joined: Fri May 08, 2015 1:00 am

Re: hosts with active connections

Post by Indigo »

in fact not, all devices are wired connections (connected through different other wlan APs)

Lantis
Moderator
Posts: 7063
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: hosts with active connections

Post 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
https://lantisproject.com/downloads/gargoylebuilds for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

Indigo
Posts: 23
Joined: Fri May 08, 2015 1:00 am

Re: hosts with active connections

Post 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

Indigo
Posts: 23
Joined: Fri May 08, 2015 1:00 am

Re: hosts with active connections

Post by Indigo »

any comments on that? is ther a way to set dhcp leasetimes less than an hour?

Lantis
Moderator
Posts: 7063
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: hosts with active connections

Post 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"
https://lantisproject.com/downloads/gargoylebuilds for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

Indigo
Posts: 23
Joined: Fri May 08, 2015 1:00 am

Re: hosts with active connections

Post 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 :)

Post Reply