Community discussions

MikroTik App
 
Jorbu
just joined
Topic Author
Posts: 23
Joined: Sun Apr 01, 2012 4:23 am

CAPsMAN Registration Table Device IP or Hostname

Fri Feb 17, 2017 3:05 am

Hi,

Has anyone built or seen a script that will pull all registered CAPsMAN devices, and tie them together (via MAC address) to the IP and "Active Host Name" from the DHCP server leases table? I find myself frequently checking both in order to identify what devices are hanging off certain APs within my networks. This would just make the job a bit quicker.

Thanks!
 
gramels
just joined
Posts: 17
Joined: Thu Aug 14, 2014 11:28 am

Re: CAPsMAN Registration Table Device IP or Hostname

Mon Mar 13, 2017 6:40 am

sorry, dont, but would love to see this as well...
 
Retral
newbie
Posts: 33
Joined: Wed Jul 25, 2018 9:10 pm

Re: CAPsMAN Registration Table Device IP or Hostname

Fri Apr 19, 2019 10:08 pm

I wanted this functionality myself so I took a half hour and cobbled together some dirty code myself. The code below will match entries from CapsMan then display the following:
Host Name, CapsMan Interface, IP Address, IP Address Expiry Time and the Mac Address of the Client.
[:foreach i in=[/caps-man registration-table find] do={([:local M [/caps-man registration-table get $i mac-address]]\
.[:put [/ip dhcp-server lease get [find where mac-address=$M] host-name]].\
[:put [/caps-man registration-table get $i interface]].\
[:put [/ip dhcp-server lease get [find where mac-address=$M] address]].\
[:put [/ip dhcp-server lease get [find where mac-address=$M] expires-after]].[:put $M].[:put ""])}]
Feel free to criticise (please do criticise it because I find my main weakness is in understanding syntax and I'd love to fix that) and or improve it. I'm sure it can be added to and condensed a lot,
however I'm not a very good at coding so this is what I can provide atm.
 
chriscolden
just joined
Posts: 12
Joined: Fri May 04, 2018 3:41 pm

Re: CAPsMAN Registration Table Device IP or Hostname

Wed Aug 05, 2020 4:00 pm

Just my take on it. not too different, but I try and make the output a bit easier to read and also pull the comment as not everything i have sets a hostname.
:foreach i in=[/caps-man registration-table find] do={
	:local varM [/caps-man registration-table get $i mac-address]
	:local varH [/ip dhcp-server lease get [find where mac-address=$varM] host-name]
	:local varI [/caps-man registration-table get $i interface]
	:local varIP [/ip dhcp-server lease get [find where mac-address=$varM] address]
	:local varC [/ip dhcp-server lease get [find where mac-address=$varM] comment]
	:put ("$varI\t$varM\t$varIP\t$varH\t$varC")
}
 
Bechs
just joined
Posts: 1
Joined: Fri Mar 17, 2023 4:49 pm

Re: CAPsMAN Registration Table Device IP or Hostname

Fri Mar 17, 2023 4:54 pm

Thanks @chriscolden for script. Useful on daily basis. Maybe You have any ideas how to get host name if CAPsMAN client in registration table is using static IP (it's not present in dhcp leases)?
 
jrssman
just joined
Posts: 7
Joined: Tue Mar 21, 2023 12:17 am

Re: CAPsMAN Registration Table Device IP or Hostname

Sun Oct 08, 2023 11:39 am

Thanks @chriscolden for script. Useful on daily basis. Maybe You have any ideas how to get host name if CAPsMAN client in registration table is using static IP (it's not present in dhcp leases)?
Arent static IP showing as well on DHCP leases?
 
erlinden
Forum Guru
Forum Guru
Posts: 1920
Joined: Wed Jun 12, 2013 1:59 pm
Location: Netherlands

Re: CAPsMAN Registration Table Device IP or Hostname

Sun Oct 08, 2023 12:11 pm

Arent static IP showing as well on DHCP leases?
I assume configured on the client, IP reservations are shown indeed.

Who is online

Users browsing this forum: honzam, ips, mkx and 27 guests