Page 1 of 1

CAPsMAN Registration Table Device IP or Hostname

Posted: Fri Feb 17, 2017 3:05 am
by Jorbu
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!

Re: CAPsMAN Registration Table Device IP or Hostname

Posted: Mon Mar 13, 2017 6:40 am
by gramels
sorry, dont, but would love to see this as well...

Re: CAPsMAN Registration Table Device IP or Hostname

Posted: Fri Apr 19, 2019 10:08 pm
by Retral
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.

Re: CAPsMAN Registration Table Device IP or Hostname

Posted: Wed Aug 05, 2020 4:00 pm
by chriscolden
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")
}