I wanted to automatically backup the configuration of our AudioCodes devices because I always forget to save the configuration file via the web interface before or after doing changes. Searching the net did not give any suitable solutions. There was only one guy playing around with trying to do http requests to get the ini file but since AudioCodes changed the whole UI in Version 7 onwards this no longer worked.
I’ve used RANCID for several years to backup my Cisco devices and noticing that AudioCodes uses a similar CLI, I tried to use RANCID for this but it didn’t work as I could not make any modifications to the code. Searching for a successor brought me to oxidized which basically does the same but in a more open and flexible way – Grabbing the configuration on a regular basis and allowing me to view diffs between the versions.

It took me a lot of sweat (and time) to get this working but finally everything is working and you can follow this manual to get it into your environment.

 

The following steps have been tested on Ubuntu 16.04LTS, You may have to adopt some steps to your operating system.

 

Install the needed software.

In the next step we need to download the oxidized git repository in the latest version. We cannot install the gem directly, because we need to modify something to get it work properly. (Version <=0.20.0)

If you’re behind a corporate firewall and need to use a proxy server type, you need to tell git to use it first.

Now we can download the repository. This will create a folder “oxidized” in your current working directory.

 

Beause oxidized by default requires an older version of net::ssh, which is not compatible with AudioCodes devices, we need to edit the built file to change the net::ssh version to 4.1.

Search the following line

and it change to

The next command will build the gem and install net::ssh version 4.1 and not 3.0.2 .

This will build the gem to the folder pkg, from where we can install it with:

 

Configure Oxidized

Before we can use oxidized we have to configure some basic settings.

First thing is to create a user and a home directory for oxidized as it’s not recommended to run oxidized as root.

I like to keep my config in a central place, therefore I created a folder under /etc where I can put all my configuration files

We will also need a directory where the saved configuration files will be stored. ( This is wher your backups land)

Now we can create a configuration file and put some basic configuration in it.

Here’s an example configuration you can use:

You have to change at least the following lines to fit your environment.

 

Change this to the IP where the webserver should be reachable.

Change this username and password to match your user for config backup. This credentials will be used on all devices in the group “sbc”:

 

Define where oxidized will put the backed up files. In this case we’ll use git to save our configs, the will allow us to enable versioning and see differences. If you’ll use plain files it’ll always update the file with the latest version. The user will only specify a username within the git repository, same as E-Mail, it doesn’t realy matter what you enter here.

 

Now we need to define where oxidized will find the list of hostnames it should backup. In this case we use CSV and the file is /etc/oxidized/router.db. Each line in the file will be one host. For each host we have a mapping defined here – first entry is name, second model and third group. Each value will be separated by “:”.

 

On my system, reading the router.db from an other place then /home/oxidized/.config/oxidized/router.db didn’t work. I therefore needed to create a symbolic link to point to /etc/oxidized/router.db as I wanted to have the config in a more central place.

 

Here is a basic example of a router.db file

 

At the time of writing this article the audiocodes.db file is not included in repository, therefore you must create it manually. 

Enter the following commands to create the file and folders and to open an the file for editing. Put in the content you find below.

 

Here is the content of the audiocodes.rb file.

 

Basic configuration is now finished, you can now try to logon as the oxidized user and start the service to see if it is running or throwing any exceptions.

 

When the Service is running, you can reach the webinterface using http://127.0.0.1:8888

 

If everything is fine and running you can add oxidized as a service, so it’ll automatically start on reboot. To do so, we need to create a configuration file for systemd and add it the configuration.

 

Add the following content to this file.

 

The created service now has to be added to systemd configuration. Afterwards we can start and stop the Service using the Service command. This will also start the service automatically on reboot.

 

To start the Service use:

 

To stop the Service use:

 

To see the status type:

 

Links:

Official Oxidized project page

Getting git work behind a proxy-server

Oxidized Tutoral which helped me a lot