reboot @cpu load 100% for 3 minutes

this script does it avery 20s


/ system script 
add name="Average CPU Load" source=":if \(\[ /system resource get cpu-load \] \
    >= 80 \) do={ /system reboot; }" 
    policy=ftp,reboot,read,write,policy,test,winbox,password,sniff 

/ system scheduler 
add name="Average CPU Load" on-event="Average CPU Load" start-date=jan/01/1970 
    start-time=00:00:00 interval=20s comment="" disabled=yes

but i wanna do it only if the cpu load gets 100% for 3 minutes not every specified amount of time

any help ?

add variable that saves previous x states, if you check every 20 seconds, then for 3 minutes you have to increase counter if load is above your mark and set to 0 if it is not above your mark. if mark is 9 then reboot.

also, i would suggest to solve that problem different way - beeing pegged to max does not mean anything good

thanks janisk you are right

i did solve the problem without the need for the script and everything is stable now :slight_smile: