Simple backups RouterOS

Very very simple backup utility, you don't need to know linux etc .., various programming languages and so on. One executable and one small file json for each device.

Pupirka (Пупырка)

Cross Platform utility for backups RouterOS over SSH.

Install

Copy binary one file. In your computer, and running once

Pupirka automated Created required directories and Config file pupirka.config.json.

Nothing else to do.

Add Routers

In directory Device create file and set name as router name in extension .json example (mymikrotik.json)

Format must be observed json, minimum 3 fields, address, username and password.

Example:

{
  "address": "172.20.17.1",
  "username": "pupirka",
  "password": "pupirkad9wh3doijwfkj"
}

address - IP or domain or fqdn router.

username - username for auth ssh

Password - password for username for auth ssh (if you need used public keys, remove this filed)

Other Keys

portssh - change if you no need used not 22 port.

timeout - change if device slow responds.

every - back up if old is older than (seconds).

rotate - delete old backups if their date is older than (days).

/export - if you no need? Export full backup, change exampl (/ip firewall export)

You no need add all fields, required only address,username,password. Others fields set default value.

{
  "address": "172.20.17.1",
  "username": "pupirka",
  "password": "pupirkad9wh3doijwfkj",
  "portssh":22,
  "timeout":10,
  "every":3600,
  "rotate":730,
  "command":"/export"
}

Saved Backups

In backup folder created sub folder from name, json name file device.

File backup used extension .rsc and name used this format YYMMDDТHHmm.rsc

Example (20200902T1212.rsc)

Rotate old backup only if count backup more than 5.

Runinng

Execute binary file manually, or added in cron for *nix OS, if you used Windows added scheduler.

pupirka.config.json

If you need change default value, need change value in pupirka.config.json

{
  "devicedefault": {
    "command": "/export",
    "every": 3600,
    "portshh": 22,
    "rotate": 730,
    "timeout": 10,
    "key": "global"
  },
  "log": {
    "format": "text",
    "maxday": 1
  },
  "path": {
    "backup": "./backup",
    "devices": "./device",
    "log": "./log",
    "keys": "./keys"
  },
  "process": {
    "max": 10
  }
}

devicedefault - default values for devices

path - list path

SSH key auth

Required delete filed password from file device json. and added filed key or used global variable devicedefault > key

Auth for uniq key example:

{
  "address": "172.20.17.1",
  "username": "pupirkauniq",
  "key":"uniq" //key finding in ./keys/uniq
}

Auth for global key Example:

{
  "address": "172.20.17.1",
  "username": "pupirkaglobal"
}

Parralism processes

Number of simultaneously running processes, preferably by the number of yards * 2.

Change process > max

If you want to request functionality or offer a solution, you can doubtfully link in a telegram. https://t.me/vasilevkirill or https://t.me/mikrotikme or use gihub.

Download latest version https://github.com/vasilevkirill/pupirka/releases


V.0.4

Added SSH Local Port Forward, set key parent in device josn file.

{
  "address": "172.30.10.10",
  "username": "admin",
  "parent": "router-10"
}

Parent should exist in other device list.

In Parent need enabled ssh local forward, if this RouterOS need run command /ip ssh set forwarding-enabled=local

Рассказать друзьям

Чатик телеграм

@mikrotikme