Scripting help about ping and send mail

Hello,

I am trying to ARP PING clients between 192.168.12.1 to 192.168.12.50 and if for example 12.5 DOWN , should send e-mail.
I wrote script about it but I don’t know where i did wrong, please help me to correct script below;


*:for e from 1 to 50 do={
:if ([/ping arp-ping=yes 192.168.12. . $e interface=Eth4-Hotspot count=5] = 0) do={
/tool e-mail send
to=mymail@mymail.com
subject=“Can’t ping 192.168.12. . $e”
}
}
*

Ok i changed script to


:for e from=1 to=50 do={
:if ([/ping arp-ping=yes (“192.168.12” . $e) interface=Eth4-Hotspot count=5] = 0) do={
/tool e-mail send to=mymail@mymail.com subject=“Can’t ping 192.168.12. $e”
}
}

But i get e-mails like
Cant ping 192.168.12.1
Cant ping 192.168.12.2
Cant ping 192.168.12.3

There is no unreachable IP address, why I am getting those messages ? I want to get email if IP address not reachable.

This works for me.

:for e from=1 to=5 do={
  :if ([/ping "192.168.2.$e" count=1] = 0) do={
    /tool e-mail send to=me@mydomain.com subject="Ping fail" body="Cant ping 192.168.2.$e"
  }
}

I stopped at 5. I did not want 48 emails in my inbox.

edit: Are these ips on a hotspot interface? I just noticed this:

interface=Eth4-Hotspot

If so, only ips of clients logged in or bypassed will be able to respond to a ping.

Thank you for reply, i made mistakes with “” changed to “192.168.12.$e” and its working right now.


:for e from=10 to=48 do={
  :if ([/ping arp-ping=yes "192.168.12.$e" interface=Eth4-Hotspot count=3]=0) do={
    /tool e-mail send to=my@mail.com subject="Cant Ping 192.168.12.$e"
    }
  }