Skip to content

Commit

Permalink
Integrate oxidized integration into the documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kircheneer committed Apr 16, 2021
1 parent 1462d1e commit 3f62d7c
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 43 deletions.
File renamed without changes.
File renamed without changes.
43 changes: 0 additions & 43 deletions docs/oxidized-hook

This file was deleted.

1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Table of Contents
nos/index
contributing
check
integrations/index

Indices and tables
------------------
Expand Down
9 changes: 9 additions & 0 deletions docs/source/integrations/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Integrations
============

This section describes integrations with other software.

.. toctree::
:maxdepth: 1

oxidized
41 changes: 41 additions & 0 deletions docs/source/integrations/oxidized.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Oxidized hooks
==============

This document describes how to integrate `Oxidized <https://github.com/ytti/oxidized>`_ with ``netlint``.

.. NOTE::
This tutorial assumes that you are using oxidized with git-based storage rather than file-based storage.

Installation
------------

#. Create a folder to keep the hooks in. For the purposes of this example that shall be ``/opt/nettools/``.
#. Copy ``contrib/oxidized/cfgchanged.sh`` and ``contrib/oxidized/validate_config.sh`` to said folder and make sure they
are executable.

Configuration
-------------

#. In the oxidized config file ``.config/oxidized/config`` add the following to fire ``/opt/nettools/cfgchanged.sh`` on
every config change oxidized finds in it's targets::

hooks:
conf_changed:
type: exec
events: [post_store]
cmd: '/opt/nettools/cfgchanged.sh $OX_EVENT $OX_NODE_NAME $OX_NODE_IP $OX_NODE_FROM $OX_NODE_MSG $OX_NODE_GROUP $OX_NODE_MODEL $OX_JOB_STATUS $OX_JOB_TIME $OX_REPO_COMMITREF $OX_REPO_NAME'
#. Change the output folder in ``validate_config.sh`` to the folder want the linting reports in.

.. DANGER::
Any old reports will be overwritten.

Now whenever oxidized detects a config change, the ``/opt/nettools/cfgchanged.sh`` script is executed.
It also calls the ``validate_config.sh`` script in that same folder, with two parameters:

- The full name of the device config.
- The device type as defined in oxidized.

This leaves you with (assuming you did not alter paths):

- Most recent configuration files in ``/opt/nettools/data/`` (the tree structure below depends upon the oxidized config).
- Lint reports in ``$HOME/lint-reports``.

0 comments on commit 3f62d7c

Please sign in to comment.