Post

Mikrotik - Update Firmware

First of all setup eamil alerts to be sent regarding the new available updates:

1
2
3
4
5
6
7
8
9
10
11
12
13
/tool e-mail set address=mail.harryvasanth.com from=harry@harryvasanth.com
/system script add dont-require-permissions=no name=UpdateAlert owner=admin policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="/system package update\r\
   \ncheck-for-updates once\r\
   \n\r\
   \n:delay 3s;\r\
   \n\r\
   \n:if ( [get status] = \"New version is available\") do={ \r\
   \n\r\
   \n:local newVer [get latest-version]\r\
   \n/tool e-mail send to=\"[email protected]\" subject=\"New RouterOS firmware available for router \$[/system identity get name]\" body=\"Upgrading RouterOS on router \$[/system identity get name] from \$[/system package update get installed-version] to \$[/system package update get latest-version] (channel:\$[/system package update get channel])\"\r\
   \n  \r\
   \n}\r\
   \n"

Reference: Link

Now lets setup automated update:

1
2
3
4
5
6
 /system scheduler add name=UpgradeFirmware on-event="if ([/system routerboard get current-firmware] != [/system routerboard get upgrade-firmware]) do={\r\
   \n/system routerboard upgrade\r\
   \n:delay 1\r\
   \n/system reboot\r\
   \n}\r\
   \n" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive start-time=startup

Reference: Link

Additionally, enable SNMP to be monitored by network monitoring software:

1
/snmp set enabled=yes
This post is licensed under CC BY 4.0 by the author.