For clarity "ip dhcp server lease find where server = dhcp1"
I want all DHCP servers to be recognized so that I have the correct number of users and the appropriate DHCP server
Who can help me?
Code: Select all
:local i;
:local hostip;
:local hostname;
:local dhcplist "";
:local date [/system clock get date];
:local time [/system clock get time];
:local leasesall [ :len [ /ip dhcp-server lease find where server=dhcp1 ] ];
:local firmware [ /system routerboard get current-firmware ];
:local routeros [ /system package get number=0 value-name=version ];
:local macaddress;
/ip dhcp-server lease;
:foreach i in=[find where server=dhcp1 ] do={
:set hostname [get $i host-name];
:set hostip [get $i address];
:set macaddress [get $i active-mac-address];
:set dhcplist ($dhcplist . $hostname . " " . $hostip . " " . $macaddress . " " . $date . " " . $time . "\n");
};
/tool e-mail send to=youremail@gmail.com subject="Mail subject" body=( "Aantal DHCP leases: $leasesall\n\n" . $dhcplist );