0.01
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Backup MikroTik configuration using SSH and SFTP.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.7
~> 10.0

Runtime

~> 2.1
~> 2.9
 Project Readme

Gem Version

Mikrotik Backup

Backup MikroTik configuration using SSH and SFTP.

Installation

Add this line to your application's Gemfile:

gem 'mikrotik-backup'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mikrotik-backup

Usage

Backup only

require 'mikrotik-backup'

#Time format
time = Time.now.strftime("%d-%m-%Y")

#Config
# name - associate host name (and name backup file)
# host - host address
# port - port to connect to. If not specified defaults to 22
# user - user name
# password - user password
# path - local folder for save backup file. "/var/backup/"
# format - backup file format, 'binary' or 'script'
config = [
    {name:"Router1-#{time}", host: '10.10.10.1', user:'admin', password:'admin', path:'./', format:'binary'},
    {name:"Router2-#{time}", host: '10.10.10.2', port:'2222', user:'admin', password:'admin', path:'./', format:'script'}
]


backup = MTik_backup.new(config)
# Start backup
backup.backup

Only Download backup (previously created)

backup.download

Create backup and download

backup.backup_and_download

Logging

# Logging only Error, out to console
backup.logger(Logger::ERROR) #<- Default

# Full log out to console
backup.logger(Logger::DEBUG)

# Full log out to file
backup.logger(Logger::DEBUG,'backup.log')

Work log (Logger::DEBUG)

[2015-02-11 13:01:32] INFO: SSH connect to host 192.168.1.1
[2015-02-11 13:01:36] INFO: Backup MikroTik configuration
[2015-02-11 13:01:37] INFO: SFTP connect to host 192.168.1.1
[2015-02-11 13:01:38] INFO: Download file Router1-11-02-2015.backup to ./Router1-11-02-2015.backup
[2015-02-11 13:01:38] INFO: SSH connect to host 176.xxx.xxx.28
[2015-02-11 13:01:38] INFO: Backup MikroTik configuration
[2015-02-11 13:01:39] INFO: SFTP connect to host 176.xxx.xxx.28
[2015-02-11 13:01:39] INFO: Download file Router2-11-02-2015.backup to ./Router2-11-02-2015.backup
[2015-02-11 13:01:39] INFO: SSH connect to host 188.xxx.xxx.56
[2015-02-11 13:01:40] INFO: Backup MikroTik configuration
[2015-02-11 13:01:41] INFO: SFTP connect to host 188.xxx.xxx.56
[2015-02-11 13:01:41] INFO: Download file Router3-11-02-2015.backup to ./Router3-11-02-2015.backup
[2015-02-11 13:01:41] INFO: SSH connect to host 188.xxx.xxx.74
[2015-02-11 13:01:42] INFO: Backup MikroTik configuration
[2015-02-11 13:01:42] INFO: SFTP connect to host 188.xxx.xxx.74
[2015-02-11 13:01:43] INFO: Download file Router4-11-02-2015.backup to ./Router4-11-02-2015.backup

Problem

ERROR: Creation of file mapping failed with error: 998

Close Pageant PuTTY

Contributing

  1. Fork it ( https://github.com/POStroi/ruby_mikrotik_backup/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request