Code: Select all
add ... up-script=NetwatchLog
Code: Select all
add ... up-script=/system script run NetwatchLog
Code: Select all
:local name "netwatch update: $host, comment=$comment status=$status"
:local email [/system logging action get [/system logging action find name=email] email-to]
:local done [$"done-tests"]
:local failed [$"failed-tests"]
:local sent [$"sent-count"]
:local responses [$"response-count"]
:local loss [$"loss-count"]
:local lossPercent [$"loss-percent"]
:local rttAvg [$"rtt-avg"]
:local rttMin [$"rtt-min"]
:local rttMax [$"rtt-max"]
:local rttJitter [$"rtt-jitter"]
:local rttStdev [$"rtt-stdev"]
:local lossPercent ($lossPercent / 10)
:local rttAvg ($rttAvg / 1000)
:local rttMin ($rttMin / 1000)
:local rttMax ($rttMax / 1000)
:local rttJitter ($rttJitter / 1000)
:local rttStdev ($rttStdev / 1000)
:local details "name = $name\n\ndone = $done\nfailed = $failed\nsent = $sent\nresponses = $responses\nloss = $loss\nloss% = $lossPercent\nrttAvg = $rttAvg\nrttMin = $rttMin\nrttMax = $rttMax\nrttJit = $rttJitter\nrttStdev = $rttStdev";
/tool e-mail send to=$email subject="$name" body="$details"
:log info $details