Community discussions

MikroTik App
 
Simmer
just joined
Topic Author
Posts: 6
Joined: Sat Feb 19, 2005 9:00 am
Location: Weatherford, Oklahoma

How do I detect platform?

Wed May 07, 2008 11:28 pm

Sorry if this should have gone in a different category (scripting perhaps...)

I would like to know how to determine what platform(??) the RouterOS is running on (for use in a script).
Example: on a RB333 in the titlebar of the window it says: WinBox v3.6 on RB333 (powerpc)
How/Where does the machine determine the powerpc platform?

thanks
simmer
 
User avatar
Letni
Member
Member
Posts: 376
Joined: Tue Dec 05, 2006 5:16 am
Location: South Carolina

Re: How do I detect platform?

Thu May 08, 2008 2:34 am

/system resource get cpu

-Louis
 
Simmer
just joined
Topic Author
Posts: 6
Joined: Sat Feb 19, 2005 9:00 am
Location: Weatherford, Oklahoma

Re: How do I detect platform?

Thu May 08, 2008 3:25 am

Thanks for the input, but unfortunately this is not what I am looking for.
In this case (RB333) the output is 'e300c2'.

Let me try to be more clear, and add some other things I have found out...

The idea behind this is for an auto-update script that will automatically detect the platform of the MikroTik (mipsbe, mipsle, powerpc... etc) and use that plus a version number to automatically download the correct update from a web server. (basically updating the one currently available in the wiki)

Apparently this will not be possible in a 2.9.xx version, AFAIK, because the ones I have looked at do not tell you what platform they are in the titlebar.

I realize that this can be done using the '/system routerboard get model' to obtain 333, 112, etc. and then match that inside of the script, but that isn't as clean as I would like, and I think that the way I am trying to do it should be possible.

I do thank you for your help though..

simmer
 
Gerard
Trainer
Trainer
Posts: 336
Joined: Wed Apr 26, 2006 4:21 am
Location: Kentucky, USA
Contact:

Re: How do I detect platform?

Thu May 08, 2008 4:30 am

Why not use the upgrade functionality built into Mikrotik already. It will determine the correct version for you and download it from a 'upgrade server' (just another Mikrotik). All you have to do is make a scheduler that runs periodically to check for updates..

Here is mine..
/ system upgrade upgrade-package-source add address=1.2.3.4 user="update"
/ system script 
add name="update_check" source="/ system upgrade refresh; :delay 00:00:05; / \
    system upgrade download-all reboot-after-download=yes download-beta=no" \
    policy=ftp,reboot,write,policy,test,winbox,password 
/ system scheduler 
add name="update_check" on-event=update_check start-date=Jan/01/1970 \
    start-time=(03:00:00 + ([:tonum (0x . ([:pick [/int ethernet get [/int ethernet find name=ether1] mac-address] 13 14] . [:pick [/int ethernet get [/int ethernet find name=ether1] mac-address] 15 17]))] . s)) interval=7d comment="" disabled=no
Create user update on router 1.2.3.4 and put all of your new packages on that router.. The script and scheduled event will run every 7 days at 3:00am + ## seconds determined from the last 4 digits of the routers "ether1" interface..

-Gerard
 
Simmer
just joined
Topic Author
Posts: 6
Joined: Sat Feb 19, 2005 9:00 am
Location: Weatherford, Oklahoma

Re: How do I detect platform?

Thu May 08, 2008 4:50 am

Actually, I have been toying with a script to implement the MT's Auto-Upgrade function, but I got sidetracked on trying this one for one reason or another, at this point I don't even remember why...

If you don't mind, could you answer a couple of questions about your script...
What happens if your update server has the same version that is already installed on your units. Will it the units running the script update themselves to the same version??
What if there is an older version still on your server, will they actually downgrade??

I'm sorry, but I didn't seem to learn much from reading about auto-upgrade in the manual...

With the little amount of testing I have done, it seemed that as long as the platform was correct, it would list all versions on the server as 'Available', whether they were older versions or not. Will it download it, no matter what version it is??

Thanks
simmer
 
Gerard
Trainer
Trainer
Posts: 336
Joined: Wed Apr 26, 2006 4:21 am
Location: Kentucky, USA
Contact:

Re: How do I detect platform?

Thu May 08, 2008 6:18 am

If the version is the correct platform and is a newer version than what is installed then it will download the file, install it, and reboot. If it is an older version, same version, or different platform it will simply ignore the file and do nothing.

-Gerard
 
Simmer
just joined
Topic Author
Posts: 6
Joined: Sat Feb 19, 2005 9:00 am
Location: Weatherford, Oklahoma

Re: How do I detect platform?

Thu May 08, 2008 6:59 am

Excellent... That is exactly what it should do, but I wasn't 100% and I haven't actually tried it yet. Thank you very much!!

One other question... How do you handle your updates? Does everyone update at the same time? Currently we only have 300'ish units in the field, but we're adding daily. That would be a lot of units to upgrade at one time! Here are my thoughts on it, any input is greatly appreciated.

Have all units upgrade from single server.
Way too many connections at one time.

Have all units upgrade from single server in segments (ex. 50 on 1st of month, 50 on 2nd, etc)
This would be a PITA to keep up with, and overall bad idea IMHO.

Have units upgrade from multiple servers. (ex. all CPE's upgrade from their AP, APs upgrade from CORE)
Problem... How do you do this with a script? Edit each setting at install time?? what happens if CPE gets moved to a different AP?
Possible solution.. Script determines upgrade server address at run time (will have to look into exactly how to do this)

I greatly appreciate the input
simmer
 
Gerard
Trainer
Trainer
Posts: 336
Joined: Wed Apr 26, 2006 4:21 am
Location: Kentucky, USA
Contact:

Re: How do I detect platform?

Thu May 08, 2008 3:52 pm

I have them all update from a central server every 7 days. Since the boot times of those devices are all different they all update different days of the week. I did the 3:00am + ## of seconds from their mac so they all don't hammer the update server at the exact same time. I have close to 600 clients and I don't have any problems with too many connections at once.

The only problem I have doing updates every 7 days is that I have some customers who power off their equipment before they get to the 7 day uptime. I normally just update those hand full of customers by hand..

-Gerard
 
hts-slim
just joined
Posts: 3
Joined: Fri May 09, 2008 4:21 am

Re: How do I detect platform?

Fri May 09, 2008 5:23 am

NOTE: I decided to register an account for myself and stop using my boss's. :wink:

I think that every 7 days of uptime is probably more often than we are going to try to upgrade. I figure bi-monthly is often enough to check (especially since we'll probably only be uploading new files once a month at most), and if a couple units miss a month, oh well...

Once again, your input is greatly appreciated..
slim

Who is online

Users browsing this forum: No registered users and 14 guests