ytti / oxidized

Oxidized is a network device configuration backup tool. It's a RANCID replacement!
Apache License 2.0
2.79k stars 922 forks source link

[low priority issue] OpenWRT backing up whole system not config #1695

Closed berilslv closed 5 years ago

berilslv commented 5 years ago

Hi Team,

I added router "teltonika" which is based on OpenWRT. It' backing up perfectly, but problem is that this backup is way too big, as it's grabbing whole system not settings/config of router like from IOS/ARUBA/COMWARE etc.

config output which is provided by oxidized: https://pastebin.com/J4J7V2ci

But it would be cool to get only info like this (example from comware): https://pastebin.com/Kic9B74g

wk commented 5 years ago

Hi!

It seems that the author of the OpenWRT model, @z00nx has foreseen some functionality into the model to choose which partitions and data get backed up under the openwrt_partitions_to_backup, openwrt_binary_files, and openwrt_non_sensitive_files configuration knobs.

By default, the openwrt_partitions_to_backup knob appears to be set to art devinfo u_env config caldata, but perhaps in your case just config would suffice.

You can try adding something along the lines of this to your global config:

vars:
  openwrt_partitions_to_backup: [ "config" ]

This should change the default for all OpenWRT devices in your oxidized instance; you could also set this using e.g. vars_map for a specific device. Try tweaking the contents of these knobs until you reach a configuration that backs up the exact data you need.

@z00nx, @berilslv, other users could find it helpful if you would consider documenting the various knobs of the OpenWRT model in the form of model notes and submitting that as a PR with some examples!

berilslv commented 5 years ago

Hi!

It seems that the author of the OpenWRT model, @z00nx has foreseen some functionality into the model to choose which partitions and data get backed up under the openwrt_partitions_to_backup, openwrt_binary_files, and openwrt_non_sensitive_files configuration knobs.

By default, the openwrt_partitions_to_backup knob appears to be set to art devinfo u_env config caldata, but perhaps in your case just config would suffice.

You can try adding something along the lines of this to your global config:

vars:
  openwrt_partitions_to_backup: [ "config" ]

This should change the default for all OpenWRT devices in your oxidized instance; you could also set this using e.g. vars_map for a specific device. Try tweaking the contents of these knobs until you reach a configuration that backs up the exact data you need.

@z00nx, @berilslv, other users could find it helpful if you would consider documenting the various knobs of the OpenWRT model in the form of model notes and submitting that as a PR with some examples!

Hi wk,

Thanks for fast reply!Awesome! I tried your suggested solution, still oxidized is pulling whole WRT system backup not just things with config prefix. So my /config looks like this: https://pastebin.com/NhLAUTGE

if you have any ideas , please let me know! :)

sincerly, Berils.

berilslv commented 5 years ago

Ohhh, ahh.... didn't checked if versioning was working for openwrt (GIT)... and it's not. For other devices like - HP, ubnt everything seems to be fine, but only this one... ERROR img: https://imgur.com/a/mPR43rb ERROR terminal: https://pastebin.com/fCx1LSxG It may be related to UTF-8 encoding? As this openwrt.rb is fetching even SQL DB. @wk i tried both your ideals vars_map: and just vars: - config size(extra HUGE) didnt changed at all.

z00nx commented 5 years ago

Hi @berilslv,

The oxidized plugin currently is using openwrt's sysupgrade to generate a list of potential files to backup. According to https://pastebin.com/J4J7V2ci you are backing up /var/mdcollectd.db. If it's not required, one solution could be to remove that file from sysupgrade backing it up(edit /etc/sysupgrade.conf). Another solution is to add /var/mdcollectd.db and any other binary files to openwrt_binary_files I should add a backup exclusion list. @wk I'll submit a pull request for the documention.