Community discussions

MikroTik App
 
User avatar
cmdorexe
just joined
Topic Author
Posts: 12
Joined: Sun Sep 11, 2016 1:12 pm
Location: Nizhny Novgorod, Russia

Bug in compare!?

Wed Jul 04, 2018 10:03 pm

As example:
global debug 0
global cpuload [/system resource get cpu-load]

global th [tonum [pick [/system clock get time] 0 2]]
global months {"jan"=1;"feb"=2;"mar"=3;"apr"=4;"may"=5;"jun"=6;"jul"=7;"aug"=8;"sep"=9;"oct"=10;"nov"=11;"dec"=12}
global date [/system clock get date]
global dd [tonum [pick $date 4 6]]
global yy [tonum [pick $date 7 11]]
global month [pick $date 0 3]
global mm [tonum ($months->$month)]

global screrr [/log find topics=script,error message~"err_cpu_load"]
global scrc [len $screrr]
if ( $scrc<=1 ) do={
global eh ($th - 1)
} else={
set screrr ($screrr -> ($scrc -1))
global eyy [tonum [pick [/log get $screrr message ] 0 4]]
global emm [tonum [pick [/log get $screrr message ] 4 6]]
global edd [tonum [pick [/log get $screrr message ] 6 8]] 
global eh [tonum [pick [/log get $screrr time] 0 2]]
}
if ($cpuload > 0 ) do={
#Try catch bug!?
global aa [tonum ($eyy.$emm.$edd.$eh)]
global bb [tonum ($yy.$mm.$dd.$th)]
if  ($aa<$bb ) do={
set debug 5
      if ($dd<10) do={ set dd ("0" . $dd) }
      if ($mm<10) do={ set mm ("0" . $mm) }
log error ($yy . $mm . $dd . "-" .  $eyy . $emm . $edd . " err_cpu_load " . $cpuload  . "%")
}
#!!! Try catch bug!?
}
So many times I try get compare but it's not working =(

Who is online

Users browsing this forum: No registered users and 54 guests