Automate ".backup" files?

General discussion of anything Unimus
thobias
Posts: 21
Joined: Mon Aug 08, 2016 11:19 am

Thu Nov 29, 2018 11:43 am

What about when you have different interfaces or something dynamic matching a fw-rule?
Lets say I need to restore a Hex that uses a USB-LTE-modem, if I do not have the modem plugged in when doing /import it will fail with "input does not match any value of interface" because "LTE1" interface do not exist yet.
User avatar
Tomas
Posts: 1206
Joined: Sat Jun 25, 2016 12:33 pm

Thu Nov 29, 2018 12:19 pm

Few possibilities here:
1) if the new device is supposed to have the LTE modem even after restore - simply plug it in before import
2) if the new device is not supposed to have LTE, you can just search the config for "lte1" and remove the lines referencing it
3) if the new device is supposed to have LTE, but you can't plug it in now, you can search for "lte1" lines, and cut them out
after the device is put in place and LTE reconnected, just paste those remaining lines into the CLI

If you want to completely automate option 3, you can put those lines into a file.
Create a scheduled script which will run on next boot that will import that file.
After that the script should delete the file, and delete the schedule.
Of course, connect the LTE modem before the boot.
thobias
Posts: 21
Joined: Mon Aug 08, 2016 11:19 am

Thu Nov 29, 2018 3:57 pm

3 would be the option then, I just need to be more careful when restoring config. Or maybe send a feature request to Mikrotik to be able to "/import config.rsc force=yes" to accept config on things that do not exist yet.
JAz
Posts: 43
Joined: Thu Apr 26, 2018 11:06 pm

Thu Aug 29, 2019 5:20 am

Hey now,
Bit of an old thread but relevant nonetheless.

I understand all the comments and arguments laid out so far Tomas but still I'd like the ability to take a binary blob backups (.backup).

Not for the reasons given so far. I want it because I want to automate updating Mikrotik packages and firmwares.
If an update goes "sideways", I can use the .backup file to restore - with credentials, certificates, etc.
This is of course back onto the same hardware so there should be no issues or concerns.

I don't necessarily need it as part of the routine/nightly automated backups but I DO need to be able to do it from the scripts (Mass config push).
I mean I can TAKE the .backup now, I just don't know how I'd retrieve it to Unimus.

I thought about emailing the backup but that is messy. If a smtp server breaks, changes, malfunctions at the time, whatever, I have no blob. And since this is infrequently used, more chance something goes wrong and is unnoticed.

No, I need a way to have Unimus either take the .backup for me (on demand) or a way to have Unimus simply retrieve a file from the 'tik filesystem (on demand).

Thoughts?

Please. Thanks.
J.
User avatar
Tomas
Posts: 1206
Joined: Sat Jun 25, 2016 12:33 pm

Thu Aug 29, 2019 7:07 am

JAz wrote:
Thu Aug 29, 2019 5:20 am
I need a way to have Unimus either take the .backup for me (on demand) or a way to have Unimus simply retrieve a file from the 'tik filesystem (on demand).
In Unimus 2.0.0, we are adding an API endpoint for pushing backups into Unimus.
This endpoint will support binary backups (as well as text backups of course).

You will be able to use the integrated MikroTik "fetch" tool to push a .backup file into Unimus from a Mass Config Push preset using this.
JAz
Posts: 43
Joined: Thu Apr 26, 2018 11:06 pm

Thu Aug 29, 2019 7:47 pm

Tomas wrote:
Thu Aug 29, 2019 7:07 am

In Unimus 2.0.0, we are adding an API endpoint for pushing backups into Unimus.
This endpoint will support binary backups (as well as text backups of course).

You will be able to use the integrated MikroTik "fetch" tool to push a .backup file into Unimus from a Mass Config Push preset using this.
That sounds *awesome* 8-)

Do we have an ETA on 2.0.0?
Thanks Tomas.
User avatar
Tomas
Posts: 1206
Joined: Sat Jun 25, 2016 12:33 pm

Thu Aug 29, 2019 7:57 pm

JAz wrote:
Thu Aug 29, 2019 7:47 pm

That sounds *awesome* 8-)

Do we have an ETA on 2.0.0?
Thanks Tomas.
We are hoping to have a public beta available at the end of September, or early October.
Mathieu
Posts: 1
Joined: Wed Jul 22, 2020 8:20 am

Wed Jul 22, 2020 8:22 am

Tomas wrote:
Thu Aug 29, 2019 7:07 am
In Unimus 2.0.0, we are adding an API endpoint for pushing backups into Unimus.
This endpoint will support binary backups (as well as text backups of course).

You will be able to use the integrated MikroTik "fetch" tool to push a .backup file into Unimus from a Mass Config Push preset using this.
Do you have an example how to push (with fetch command) a .backup from a mikrotik device?
bkopec
Posts: 2
Joined: Thu Jan 21, 2021 1:21 pm

Thu Jan 21, 2021 1:34 pm

Hello.

Anybody successful configure Mikrotik device to send BINARY type config with api to Unimus?

I tried with:

Code: Select all

/tool fetch http-method=post http-header-field="accept:application/json,content-type:application/json,Authorization:Bearer sfjhasdbfhjasdfjhsadfgjsagsdfhjsdfhasdfghsd" http-data="{\"backup\":\"file.backup\",\"type\":\"BINARY\"}" url="http://ipadress:8085/api/v2/devices/1/backups"  
I get success in mikrotik terminal, but it doesnt send a file. I think this command send the string "file.backup" not the contents.
And in the result i get backup Binary in unimus but the file size is 16b and should be 417KB.

Additionaly mikrotik download file with name "backups"

From mikrotik forum i read that http method cant upload file, only sftp and ftp can do it.

Some can help ?
Maybe @Tomas ?
We are planning mass deployment of this software to over 300 devices.

Best Regards.
Johnny
Posts: 14
Joined: Wed Oct 05, 2016 4:12 pm

Thu Jan 21, 2021 2:07 pm

bkopec wrote:
Thu Jan 21, 2021 1:34 pm
Hello.

Anybody successful configure Mikrotik device to send BINARY type config with api to Unimus?

I tried with:

Code: Select all

/tool fetch http-method=post http-header-field="accept:application/json,content-type:application/json,Authorization:Bearer sfjhasdbfhjasdfjhsadfgjsagsdfhjsdfhasdfghsd" http-data="{\"backup\":\"file.backup\",\"type\":\"BINARY\"}" url="http://ipadress:8085/api/v2/devices/1/backups"  
I get success in mikrotik terminal, but it doesnt send a file. I think this command send the string "file.backup" not the contents.
And in the result i get backup Binary in unimus but the file size is 16b and should be 417KB.

Additionaly mikrotik download file with name "backups"

From mikrotik forum i read that http method cant upload file, only sftp and ftp can do it.

Some can help ?
Maybe @Tomas ?
We are planning mass deployment of this software to over 300 devices.

Best Regards.
You provided a valid JSON string, but you actually didn't include a file.backup's content, just sent "file.backup" as the string instead.
Can you try:

Code: Select all

http-data="{\"backup\":\""+file.backup+"\",\"type\":\"BINARY\"}"
I haven't tried it myself, it's just a wild guess :)
Post Reply