Oxidized is a network device configuration backup tool. It's a RANCID replacement!
Go to file
Robert Chéramy ea40b512af
Merge pull request #3100 from Beanfield/onefinity
Initial implementation of the Fujistu 1Finity
2024-03-25 09:19:17 +01:00
.github Merge pull request #2930 from ytti/dependabot/github_actions/master/actions/checkout-4 2024-01-16 15:41:45 +01:00
bin Improve signal handling and graceful reload capabilities 2024-02-09 23:16:57 +00:00
docs Merge pull request #3100 from Beanfield/onefinity 2024-03-25 09:19:17 +01:00
examples/podman-compose Example how to run oxidized with podman-container 2024-03-11 14:19:00 +01:00
extra Robocop Naming/RescuedExceptionsVariableName 2023-11-27 13:39:53 +01:00
lib Merge pull request #3100 from Beanfield/onefinity 2024-03-25 09:19:17 +01:00
spec Disabling SCP for apc_aos for now 2024-02-27 15:33:41 +01:00
.codeclimate.yml bring back models to codeclimate 2018-11-03 11:10:23 +02:00
.gitignore remove .ruby-version & add many ruby-version in .travis.yml 2018-04-20 13:15:44 +03:00
.rubocop.yml Disabling SCP for apc_aos for now 2024-02-27 15:33:41 +01:00
.rubocop_todo.yml Disabling SCP for apc_aos for now 2024-02-27 15:33:41 +01:00
CHANGELOG.md Add change to changelog 2024-03-08 13:35:05 -05:00
CONTRIBUTING.md Introducing model maintainers / document how to contribute to Oxidized (#3028) 2024-01-15 10:37:32 +01:00
Dockerfile SMTP Mail sending in docker container and documentation for sending mail with msmtp (#2809) 2023-07-04 13:01:50 +02:00
Gemfile Requested changes 2017-01-24 10:45:34 +08:00
LICENSE Add license 2018-04-27 14:51:58 +03:00
README.md Example how to run oxidized with podman-container 2024-03-11 14:19:00 +01:00
Rakefile fix rubocop warnings (#2738) 2023-04-12 10:29:08 +02:00
TODO.md Lint and standardize markdown documentation 2018-03-12 09:03:07 +01:00
oxidized.gemspec Update rubocop-minitest requirement from ~> 0.34.4 to ~> 0.35.0 2024-03-11 23:10:57 +00:00

README.md

Oxidized

Build Status codecov.io Codacy Badge Code Climate Gem Version Join the chat at https://gitter.im/oxidized/Lobby

Oxidized is a network device configuration backup tool. It's a RANCID replacement!

It is light and extensible and supports over 130 operating system types.

Feature highlights:

  • Automatically adds/removes threads to meet configured retrieval interval
  • Restful API to a move node immediately to head-of-queue (GET/POST /node/next/[NODE])
  • Syslog udp+file example to catch config change events (IOS/JunOS) and trigger a config fetch
    • Will signal which IOS/JunOS user made the change, can then be used by output modules (via POST)
    • The git output module uses this info - 'git blame' will show who changed each line
  • Restful API to reload list of nodes (GET /reload)
  • Restful API to fetch configurations (/node/fetch/[NODE] or /node/fetch/group/[NODE])
  • Restful API to show list of nodes (GET /nodes)
  • Restful API to show list of version for a node (/node/version[NODE]) and diffs

Check out the Oxidized TREX 2014 presentation video on YouTube!

⚠️ Maintainer Wanted! ⚠️

Is your company using Oxidized and has Ruby developers on staff? I'd love help from an extra maintainer!

Index

  1. Supported OS Types
  2. Installation
  3. Initial Configuration
  4. Configuration
  5. Creating and Extending Models
  6. Help
  7. Help Needed
  8. Ruby API

Installation

Debian and Ubuntu

Debian "buster" or newer and Ubuntu 17.10 (artful) or newer are recommended. On Ubuntu, begin by enabling the universe repository (required for libssh2-1-dev):

add-apt-repository universe

Install the dependencies:

apt-get install ruby ruby-dev libsqlite3-dev libssl-dev pkg-config cmake libssh2-1-dev libicu-dev zlib1g-dev g++ libyaml-dev

Finally, install the gems:

gem install oxidized
gem install oxidized-script oxidized-web # If you don't install oxidized-web, ensure "rest" is removed from your Oxidized config.

CentOS, Oracle Linux, Red Hat Linux

On CentOS 6 and 7 / RHEL 6 and 7, begin by installing Ruby 2.3 or greater. This can be accomplished in one of several ways:

Install Ruby 2.3 from SCL:

yum install centos-release-scl
yum install rh-ruby30 rh-ruby30-ruby-devel
scl enable rh-ruby30 bash

The following additional packages will be required to build the dependencies:

yum install make cmake which sqlite-devel openssl-devel libssh2-devel ruby gcc ruby-devel libicu-devel gcc-c++

Alternatively, install Ruby 2.6 via RVM by following the instructions:

Make sure you dont have any leftover ruby: yum erase ruby

Then, install gpg key and rvm

sudo gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
rvm requirements run
rvm install 3.0
rvm use 3.0

Install oxidized requirements: yum install make cmake which sqlite-devel openssl-devel libssh2-devel gcc libicu-devel gcc-c++

Install the gems: gem install oxidized oxidized-web

You need to wrap the gem and reference the wrap in the systemctl service file: rvm wrapper oxidized

You can see where the wrapped gem is via rvm wrapper show oxidized Use that path in the oxidized.service file, restart the systemctl daemon, run oxidized by hand once, edit config file, start service.

FreeBSD

Use RVM to install Ruby v2.3, then install all required packages and gems:

pkg install cmake pkgconf
gem install oxidized
gem install oxidized-script oxidized-web

Oxidized is also available via FreeBSD ports:

pkg install rubygem-oxidized rubygem-oxidized-script rubygem-oxidized-web

Build from Git

git clone https://github.com/ytti/oxidized.git
cd oxidized/
gem install bundler
rake install

Running with Docker

Currently, Docker Hub automatically builds the master branch for linux/amd64 and linux/arm64 platforms as oxidized/oxidized, you can make use of this container or build your own.

To build your own, clone git repo:

git clone https://github.com/ytti/oxidized

Then, build the container locally (requires docker 17.05.0-ce or higher):

docker build -q -t oxidized/oxidized:latest oxidized/

Once you've built the container (or chosen to make use of the automatically built container in Docker Hub, which will be downloaded for you by docker on the first run command had you not built it), proceed as follows:

Create a configuration directory in the host system:

mkdir /etc/oxidized

Run the container for the first time to initialize the config:

Note: this step in only required for creating the Oxidized configuration file and can be skipped if you already have one.

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

If the RESTful API and Web Interface are enabled, on the docker host running the container edit /etc/oxidized/config and modify rest: 127.0.0.1:8888 to rest: 0.0.0.0:8888. This will bind port 8888 to all interfaces, and expose the port so that it could be accessed externally. (Issue #445)

Alternatively, you can use docker-compose to launch the oxidized container:

# docker-compose.yml
# docker-compose file example for oxidized that will start along with docker daemon
---
version: "3"
services:
  oxidized:
    restart: always
    image: oxidized/oxidized:latest
    ports:
      - 8888:8888/tcp
    environment:
      CONFIG_RELOAD_INTERVAL: 600
    volumes:
       - config:/home/oxidized/.config/oxidized/
volumes:
  config:

Create the /etc/oxidized/router.db (see CSV Source for further info):

vim /etc/oxidized/router.db

Run container again to start oxidized with your configuration:

docker run -v /etc/oxidized:/home/oxidized/.config/oxidized -p 8888:8888/tcp -t oxidized/oxidized:latest
oxidized[1]: Oxidized starting, running as pid 1
oxidized[1]: Loaded 1 nodes
Puma 2.13.4 starting...
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://0.0.0.0:8888

If you want to have the config automatically reloaded (e.g. when using a http source that changes):

docker run -v /etc/oxidized:/home/oxidized/.config/oxidized -p 8888:8888/tcp -e CONFIG_RELOAD_INTERVAL=3600 -t oxidized/oxidized:latest

If you need to use an internal CA (e.g. to connect to an private github instance):

docker run -v /etc/oxidized:/home/oxidized/.config/oxidized -v /path/to/MY-CA.crt:/usr/local/share/ca-certificates/MY-CA.crt -p 8888:8888/tcp -e UPDATE_CA_CERTIFICATES=true -t oxidized/oxidized:latest

Running with podman-compose

Under examples/podman-compose, you will find a complete example of how to integrate the container into a docker-compose.yml file.

Installing Ruby 2.3 using RVM

Install Ruby 2.3 build dependencies

yum install curl gcc-c++ patch readline readline-devel zlib zlib-devel
yum install libyaml-devel libffi-devel openssl-devel make cmake
yum install bzip2 autoconf automake libtool bison iconv-devel libssh2-devel libicu-devel

Install RVM

curl -L get.rvm.io | bash -s stable

Setup RVM environment and compile and install Ruby 2.3 and set it as default

source /etc/profile.d/rvm.sh
rvm install 2.3
rvm use --default 2.3

Configuration

Oxidized configuration is in YAML format. Configuration files are subsequently sourced from /etc/oxidized/config then ~/.config/oxidized/config. The hashes will be merged, this might be useful for storing source information in a system wide file and user specific configuration in the home directory (to only include a staff specific username and password). Eg. if many users are using oxs, see Oxidized::Script.

It is recommended practice to run Oxidized using its own username. This username can be added using standard command-line tools:

useradd -s /bin/bash -m oxidized

It is recommended not to run Oxidized as root.

To initialize a default configuration in your home directory ~/.config/oxidized/config, simply run oxidized once. If you don't further configure anything from the output and source sections, it'll extend the examples on a subsequent oxidized execution. This is useful to see what options for a specific source or output backend are available.

You can set the env variable OXIDIZED_HOME to change its home directory.

OXIDIZED_HOME=/etc/oxidized

$ tree -L 1 /etc/oxidized
/etc/oxidized/
├── config
├── log-router-ssh
├── log-router-telnet
├── pid
├── router.db
└── repository.git

Source

Oxidized supports CSV, SQLite, MySQL and HTTP as source backends. The CSV backend reads nodes from a rancid compatible router.db file. The SQLite and MySQL backends will fire queries against a database and map certain fields to model items. The HTTP backend will fire queries against a http/https url. Take a look at the Configuration for more details.

Outputs

Possible outputs are either File, GIT, GIT-Crypt and HTTP. The file backend takes a destination directory as argument and will keep a file per device, with most recent running version of a device. The GIT backend (recommended) will initialize an empty GIT repository in the specified path and create a new commit on every configuration change. The GIT-Crypt backend will also initialize a GIT repository but every configuration push to it will be encrypted on the fly by using git-crypt tool. Take a look at the Configuration for more details.

Maps define how to map a model's fields to model model fields. Most of the settings should be self explanatory, log is ignored if use_syslog is set to true.

First create the directory where the CSV output is going to store device configs and start Oxidized once.

mkdir -p ~/.config/oxidized/configs
oxidized

Now tell Oxidized where it finds a list of network devices to backup configuration from. You can either use CSV or SQLite as source. To create a CSV source add the following snippet:

source:
  default: csv
  csv:
    file: ~/.config/oxidized/router.db
    delimiter: !ruby/regexp /:/
    map:
      name: 0
      model: 1

Now lets create a file based device database (you might want to switch to SQLite later on). Put your routers in ~/.config/oxidized/router.db (file format is compatible with rancid). Simply add an item per line:

router01.example.com:ios
switch01.example.com:procurve
router02.example.com:ios

Run oxidized again to take the first backups.

Extra

Ubuntu init setup

The systemd service assumes that you have a user named 'oxidized' and that oxidized is in one of the following paths:

/sbin
/bin
/usr/sbin
/usr/bin
/usr/local/bin
  1. Copy systemd service file from extra/ folder to /etc/systemd/system
sudo cp extra/oxidized.service /etc/systemd/system
  1. Setup /var/run/
mkdir /run/oxidized
chown oxidized:oxidized /run/oxidized
  1. Make oxidized start on boot
sudo systemctl enable oxidized.service

Help

If you need help with Oxidized then we have a few methods you can use to get in touch.

  • Gitter - You can join the Lobby on gitter to chat to other Oxidized users.
  • GitHub - For help and requests for code changes / updates.
  • Forum - A user forum run by LibreNMS where you can ask for help and support.

Help Needed

As things stand right now, oxidized is maintained by very few people. We would appreciate more individuals and companies getting involved in Oxidized.

Beyond software development, documentation or maintenance of Oxidized, you could become a model maintainer, which can be done with little burden and would be a big help to the community.

Interested? Have a look at CONTRIBUTING.md.

      Copyright
      2013-2015 Saku Ytti <saku@ytti.fi>
      2013-2015 Samer Abdel-Hafez <sam@arahant.net>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.