iv. Posted February 18, 2022 Report Share Posted February 18, 2022 Здравейте, Скрипра е за да се сложи в DHCP сървъра и да създава хостове в НетУоча , който от своя страна при UP and DOWN да праща съобщение в TELEGRAM Цитат :if ($leaseBound = "1") do={/tool netwatch add down-script=":local BotID \"1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXs\ \";\r\ \n:local CHID \"XXXXXXXXXXXXx\";\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 \"1XXXXXXXXXXXXXXXXXXXXXXXXXXs\ SRcxARu_BbSCx5OTf7Z4\";\r\ \n:local CHID \"4XXXXXXXXX\";\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] } Ако при някой работи , моля за съвет Благодаря Link to comment Share on other sites More sharing options...
iv. Posted July 18, 2022 Author Report Share Posted July 18, 2022 Архив Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now