mirror of
https://github.com/pothi/mikrotik-scripts.git
synced 2025-07-12 15:44:28 +02:00
Script to alert upon unknown device
This commit is contained in:
parent
c4914960f2
commit
c40db98513
1 changed files with 22 additions and 0 deletions
22
scripts/unknown-device.rsc
Normal file
22
scripts/unknown-device.rsc
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Modified from https://forum.mikrotik.com/viewtopic.php?t=181433
|
||||
|
||||
:global adminEmail
|
||||
|
||||
# :log info "Success"
|
||||
|
||||
/ip dhcp-server lease
|
||||
:if (($leaseBound=1) && ([find where dynamic mac-address=$leaseActMAC]!="")) do {
|
||||
:local leaseHostName $"lease-hostname"
|
||||
:do {
|
||||
:tool e-mail send \
|
||||
to=$adminEmail \
|
||||
subject="Unknown Device Alert [MAC: $leaseActMAC]" \
|
||||
body="The following unknown device received a dynamic IP address:
|
||||
Mac: $leaseActMAC
|
||||
Ip: $leaseActIP,
|
||||
Host: $leaseHostName,
|
||||
Bound: $leaseBound"
|
||||
:log info "Unknown Device: $leaseActMAC, $leaseActIP, $leaseHostName"
|
||||
} on-error={:log error "Failed to send alert email upon unknown device."}
|
||||
}}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue