Community discussions

MikroTik App
 
wispwest
Member
Member
Topic Author
Posts: 479
Joined: Tue May 19, 2009 3:48 am

Configurable solution to automatically backup Mikrotik's routinely?

Tue Aug 25, 2015 10:56 pm

We had a previous tech that worked for our WISP leave us a few years ago, he had his computer setup with an auto-task manager that would start something up, and somehow or another, we have successful backups of ALL our 50+ Mikrotiks dumped to a google drive online, once or twice per week so there was always a 'fresh' backup file in place in case we needed to replace a routerboard.

Some of these RB1100's out there have 400+ simple queues, 50+ firewall rules (users that are deliquent or inactive), 10+ IP address routes, etc.

Since then the computer has been replaced, I haven't had time, and none of our other techs are "script savy" enough to get it going again.

Is there anything out there that can do this? Someone recommended "The Dude", and we've tried that, and didn't have 20+ hrs to try and understand how the heck it works let alone how to add all our devices and automatically fetch backup files.

The UBNT AirControl server is awesome so far, and it pulls and stores all backup config files for all devices. However, most of these are simple AP/CPE configs which don't need much to configure. I was a little disappointed how The Dude ended up turning out, I'm sure it'd be a VERY powerful tool, but its VERY complicated and not easily explainable how to set it up and do simple things, or should I say very time-consuming on learning it all. We just want something simple to setup and get going!

Appreciate any suggestions!
 
coylh
Member Candidate
Member Candidate
Posts: 159
Joined: Tue Jul 12, 2011 12:11 am

Re: Configurable solution to automatically backup Mikrotik's routinely?

Wed Aug 26, 2015 1:32 am

If you're willing to load each routerboard with a ssh key, you can use a simple batch script and puTTY on a Windows machine. Load the key into pagent and then run the script on occasion.
@echo off

SET PLINK=..\plink.exe
SET PSCP=..\pscp.exe
SET USER=admin
SET CONFIGDIRECTORY="C:\mikrotik"


FOR /f "delims=" %%H IN (device-list-mikrotik.txt) DO (
	echo.
	echo %%H 
	%PLINK% -ssh -agent %USER%@%%H export compact file=backup; system backup save name=backup
	if not exist %CONFIGDIRECTORY%\%%H (
		mkdir %CONFIGDIRECTORY%\%%H
	)
	if exist %CONFIGDIRECTORY%\%%H (
		%PSCP% -agent -q %USER%@%%H:backup.backup %CONFIGDIRECTORY%\%%H\%%H_%DATE%.backup
		%PSCP% -agent -q %USER%@%%H:backup.rsc %CONFIGDIRECTORY%\%%H\%%H_%DATE%.rsc
	) 
)
Make a list of your devices like so:
router1.example.com
router2.example.com
router3.example.com
This is quite flexible, and you can do more than just backups.
 
User avatar
BartoszP
Forum Guru
Forum Guru
Posts: 2880
Joined: Mon Jun 16, 2014 1:13 pm
Location: Poland

Re: Configurable solution to automatically backup Mikrotik's routinely?

Wed Aug 26, 2015 9:01 am

Schedule this script in each router:
:local sysname
:local time
:local date

:set sysname [/system identity get name]
:set time [/system clock get time]
:set date [/system clock get date]
/export file="$sysname"
:delay 5
/tool e-mail send to=BartoszP@internet subject="CONFIG: $sysname z $date  $time" body=""  file="$sysname.rsc"
:log warning "CONFIG: $sysname.rsc ."
You need of course configure e-mail server settings etc.

Who is online

Users browsing this forum: Bing [Bot], GoogleOther [Bot], noyo, plastilin and 184 guests