:if ($leaseBound = "1") do={/tool netwatch add down-script=":local BotID \"6138687742:AAF4hF3MLu1wj2JEETJ-UZAoUlJtWthPpL8\ \";\r\ \n:local CHID \"241079730\";\r\ \n:local avgRtt;\r\ \n:local pin\r\ \n:local pout\r\ \n:local datetime \"\$[/system clock get date] \$[/system clock get time]\ \"\r\ \n:local hostname [[/ip dhcp-server lease get [find address=\$host] host-n\ ame]]\r\ \n:local mac [[/ip dhcp-server lease get [find address=\$host] mac-address\ ]]\r\ \n:local server [[/ip dhcp-server lease get [find address=\$host] active-s\ erver]]\r\ \n#Ping it real good\r\ \n/tool flood-ping \$host count=10 do={\r\ \n:if (\$sent = 10) do={\r\ \n:set avgRtt \$\"avg-rtt\"\r\ \n:set pout \$sent\r\ \n:set pin \$received\r\ \n}\r\ \n}\r\ \n:local ploss (100 - ((\$pin * 100) / \$pout))\r\ \n:local logmsg (\"Ping Average for \$host - \".[:tostr \$avgRtt].\"ms - p\ acket loss: \".[:tostr \$ploss].\"%\")\r\ \n:log info \$logmsg\r\ \n:local text \"Router Id:* \$[/system identity get name] * %0A\\\r\ \nTanggal : _\$datetime_%0A\\\r\ \nPing : _\$host_%0A\\\r\ \nHost Name : _\$hostname_%0A\\\r\\ \nMAC : _\$mac_%0A\\\r\\ \nServer : _\$server_%0A\\\r\\ \nLog : _\$logmsg_\"\r\ \n/tool fetch url=\"https://api.telegram.org/bot\$BotID/sendmessage\?chat_\ id=\$CHID&text=\$text\" keep-result=no;\r\ \n" host=$leaseActIP up-script=":local BotID \"6138687742:AAF4hF3MLu1wj2JEETJ-UZAoUlJtWthPpL8\";\r\ \n:local CHID \"241079730\";\r\ \n:local avgRtt;\r\ \n:local pin\r\ \n:local pout\r\ \n:local datetime \"\$[/system clock get date] \$[/system clock get time]\ \"\r\ \n:local hostname [[/ip dhcp-server lease get [find address=\$host] host-n\ ame]]\r\ \n:local mac [[/ip dhcp-server lease get [find address=\$host] mac-address\ ]]\r\ \n:local server [[/ip dhcp-server lease get [find address=\$host] server]]\ \r\ \n#Ping it real good\r\ \n/tool flood-ping \$host count=10 do={\r\ \n:if (\$sent = 10) do={\r\ \n:set avgRtt \$\"avg-rtt\"\r\ \n:set pout \$sent\r\ \n:set pin \$received\r\ \n}\r\ \n}\r\ \n:local ploss (100 - ((\$pin * 100) / \$pout))\r\ \n:local logmsg (\"Ping Average for \$host - \".[:tostr \$avgRtt].\"ms - p\ acket loss: \".[:tostr \$ploss].\"%\")\r\ \n:log info \$logmsg\r\ \n:local text \"Router Id:* \$[/system identity get name] * %0A\\\r\ \nTanggal : _\$datetime_%0A\\\r\ \nPing : _\$host_%0A\\\r\ \nHost Name : _\$hostname_%0A\\\r\\ \nMAC : _\$mac_%0A\\\r\\ \nServer : _\$server_%0A\\\r\\ \nLog : _\$logmsg_\"\r\ \n/tool fetch url=\"https://api.telegram.org/bot\$BotID/sendmessage\?chat_\ id=\$CHID&text=\$text\" keep-result=no;\r\ \n" } else={ /tool netwatch remove [find host=$leaseActIP] }