Oxidized - how to backup git

I would like to ensure that I have a backup copy of the Oxidized config GIT repo.

I added a cronjob to do so from within the container. Here is the crontab entry from the container (running under root)…
@daily cp -rp /var/lib/oxidized/devices.git /root/.config/oxidized/git-bak/

Not sure if this is the best way to do it.
Is there a better way?

That’s ok but why not use the githubrepo hook and push all your configs to a central hosted git install. Doesn’t have to be github, we use GitLab at work and I use Gogs.io at home.

However, copying the dir like you did is fine.

That’s a much better way to do it. I’d prefer to have something like that instead.
I’ll setup a private GitLab repo for it.
I don’t have any experience in anything like this yet - but i’ll take a stab at it.


I may have to bug you in the future for help… but i’ll see what I can get working.

If it’s not a lot of devices, maybe try gogs.io first. GitLab is a bit OTT (imho) for a small install.

Ok, so I have Gogs installed as a docker container on the same server as librenms/docker/oxidized

I added the following to the bottom of the oxidized config…
type: githubrepo
events: [post_store]
remote_repo: http://localhost:10080/administrator/oxidized.git
username: administrator
password: *********

How can I tell if it’s successfully communicating with the Gogs container?
Do I have to restart the oxidized service or oxidized container?

After changing config you will need to restart oxidized yes. Just look in your repo in gogs to see if it contains your files. If not, enable debug in oxidized and check the debug log.

Thank you! I will keep testing this out when I can.

I had an “a ha!” moment today. I copied devices.git to /root/.config/oxidized/ and changed the path of the git to the new location.

/root/.config/oxidized is already set to mount in /etc/oxidized on the docker host.
This way, if the docker container is rebooted, the configs and versions survive the reboot.

I have /etc/oxidized already backing up automatically to another server via rsync with a cronjob.

The main reason I wanted to backup git is because I was losing my configs and versions upon rebooting the docker host (also the librenms server in this case) or even the container itself. I wanted to ensure I had a copy.

I only made one change to the docker deployment command…

docker run --rm -v /etc/oxidized:/root/.config/oxidized -p 8888:8888/tcp -t oxidized/oxidized:latest oxidized

docker run --restart always -v /etc/oxidized:/root/.config/oxidized -p 8888:8888/tcp -t oxidized/oxidized:latest oxidized

So I removed the cleanup (–rm) option and added --restart always so that if the librenms server restarts, the container comes back up automatically.

Also, this is the same account as jeff89179 - just my work account. Forgot which Chrome profile I was using.

I had this working with a private online gitlab repo today… but when I installed gogs and tried to get it to push new configs, i get this in the logs…

Hook push_to_remote (#GithubRepo:0x0000000001886098) failed (#<Rugged::ReferenceError: cannot push non-fastforwardable reference>) for event :post_store

…this is when the origin is set to http or ssh. It doesn’t seem to make a difference.