diff options
author | Christian Hesse <mail@eworm.de> | 2019-11-25 17:07:45 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2019-11-25 17:07:45 +0100 |
commit | a8a0523d33a2760f61d24a42fc057c5c24a596ae (patch) | |
tree | 1b71d72ab71141910d10d6eef2ff5725548f7663 | |
parent | 15a6fb325ee25d48c585d2a9c29763ae2c516f39 (diff) |
collect-wireless-mac: add the dns name
-rw-r--r-- | collect-wireless-mac.capsman | 6 | ||||
-rw-r--r-- | collect-wireless-mac.local | 6 | ||||
-rw-r--r-- | collect-wireless-mac.template | 6 |
3 files changed, 18 insertions, 0 deletions
diff --git a/collect-wireless-mac.capsman b/collect-wireless-mac.capsman index 0768a23..0b87bf7 100644 --- a/collect-wireless-mac.capsman +++ b/collect-wireless-mac.capsman @@ -25,6 +25,7 @@ $ScriptLock "collect-wireless-mac.capsman"; :local AccessList ([ / caps-man access-list find where mac-address=$Mac ]->0); :if ([ :len $AccessList ] = 0) do={ :local Address "no dhcp lease"; + :local DnsName "no dhcp lease"; :local HostName "no dhcp lease"; :local Lease [ / ip dhcp-server lease find where mac-address=$Mac ]; :if ([ :len $Lease ] > 0) do={ @@ -33,6 +34,10 @@ $ScriptLock "collect-wireless-mac.capsman"; :if ([ :len $HostName ] = 0) do={ :set HostName "no hostname"; } + :set DnsName [ / ip dns static get ([ find where address=$Address ]->0) name ]; + :if ([ :len $DnsName ] = 0) do={ + :set DnsName "no dns name"; + } } :local RegEntry [ / caps-man registration-table find where mac-address=$Mac ]; :local Interface [ / caps-man registration-table get $RegEntry interface ]; @@ -52,6 +57,7 @@ $ScriptLock "collect-wireless-mac.capsman"; "Vendor: " . $Vendor . "\n" . \ "Hostname: " . $HostName . "\n" . \ "Address: " . $Address . "\n" . \ + "DNS name: " . $DnsName . "\n" . \ "Date: " . $DateTime); } else={ :local Comment [ / caps-man access-list get $AccessList comment ]; diff --git a/collect-wireless-mac.local b/collect-wireless-mac.local index 4e60159..52e8629 100644 --- a/collect-wireless-mac.local +++ b/collect-wireless-mac.local @@ -25,6 +25,7 @@ $ScriptLock "collect-wireless-mac.local"; :local AccessList ([ / interface wireless access-list find where mac-address=$Mac ]->0); :if ([ :len $AccessList ] = 0) do={ :local Address "no dhcp lease"; + :local DnsName "no dhcp lease"; :local HostName "no dhcp lease"; :local Lease [ / ip dhcp-server lease find where mac-address=$Mac ]; :if ([ :len $Lease ] > 0) do={ @@ -33,6 +34,10 @@ $ScriptLock "collect-wireless-mac.local"; :if ([ :len $HostName ] = 0) do={ :set HostName "no hostname"; } + :set DnsName [ / ip dns static get ([ find where address=$Address ]->0) name ]; + :if ([ :len $DnsName ] = 0) do={ + :set DnsName "no dns name"; + } } :local RegEntry [ / interface wireless registration-table find where mac-address=$Mac ]; :local Interface [ / interface wireless registration-table get $RegEntry interface ]; @@ -52,6 +57,7 @@ $ScriptLock "collect-wireless-mac.local"; "Vendor: " . $Vendor . "\n" . \ "Hostname: " . $HostName . "\n" . \ "Address: " . $Address . "\n" . \ + "DNS name: " . $DnsName . "\n" . \ "Date: " . $DateTime); } else={ :local Comment [ / interface wireless access-list get $AccessList comment ]; diff --git a/collect-wireless-mac.template b/collect-wireless-mac.template index c7a2e54..71af0dc 100644 --- a/collect-wireless-mac.template +++ b/collect-wireless-mac.template @@ -26,6 +26,7 @@ $ScriptLock "collect-wireless-mac%TEMPL%"; :local AccessList ([ / %PATH% access-list find where mac-address=$Mac ]->0); :if ([ :len $AccessList ] = 0) do={ :local Address "no dhcp lease"; + :local DnsName "no dhcp lease"; :local HostName "no dhcp lease"; :local Lease [ / ip dhcp-server lease find where mac-address=$Mac ]; :if ([ :len $Lease ] > 0) do={ @@ -34,6 +35,10 @@ $ScriptLock "collect-wireless-mac%TEMPL%"; :if ([ :len $HostName ] = 0) do={ :set HostName "no hostname"; } + :set DnsName [ / ip dns static get ([ find where address=$Address ]->0) name ]; + :if ([ :len $DnsName ] = 0) do={ + :set DnsName "no dns name"; + } } :local RegEntry [ / %PATH% registration-table find where mac-address=$Mac ]; :local Interface [ / %PATH% registration-table get $RegEntry interface ]; @@ -54,6 +59,7 @@ $ScriptLock "collect-wireless-mac%TEMPL%"; "Vendor: " . $Vendor . "\n" . \ "Hostname: " . $HostName . "\n" . \ "Address: " . $Address . "\n" . \ + "DNS name: " . $DnsName . "\n" . \ "Date: " . $DateTime); } else={ :local Comment [ / %PATH% access-list get $AccessList comment ]; |