Skip to main content

Network Documentation Platform - Collector

Project description

NetDoc Collector

NetDoc Collector is the network discovery and collector component used by NetDoc. It runs probes against network devices (via SSH/telnet/HTTPS) and creates per-device raw payloads that the NetDoc backend can ingest.

This repository uses mkdocs with the root README.md as the homepage and mkdocstrings to generate API reference content from src/netdoc_collector.

Installation

Recommended install for development:

poetry install

Install the package in editable mode if you want the CLI available immediately:

poetry run pip install -e .

Run the command-line tool:

poetry run netdoc-collector --help

Modes

  • Stand-alone mode: read a local Ansible-style JSON inventory and collect data locally.
  • Managed mode: claim jobs from the NetDoc backend, run collection, and push results back.

Configuration example: config.yaml

inventory: inventory.json
output: ./output
workers: 5
cmd_timeout: 240
retention: 5

backend:
  url: https://netdoc.example.com/api/v1
  timeout: 120
  token: null
  verify: true

Secrets example: secrets.yaml

This file stores credentials used by the collector's scanner and collection logic. Keep it out of version control and protect it with restrictive file permissions.

credentials:
  - label: default
    username: admin
    password: Passw0rd!
    secret: enable_secret
  - label: readonly
    username: readonly
    password: read0nly

Inventory example: inventory.json

The collector accepts Ansible-style JSON inventory with _meta.hostvars and host-specific connection details.

{
  "_meta": {
    "hostvars": {
      "switch1.example.com": {
        "ansible_host": "192.0.2.10",
        "ansible_user": "admin",
        "ansible_password": "Passw0rd!",
        "netmiko_device_type": "cisco_ios"
      },
      "linux-host.example.com": {
        "ansible_host": "192.0.2.20",
        "ansible_user": "ubuntu",
        "ansible_password": "secret",
        "netmiko_device_type": "linux"
      }
    }
  },
  "all": {
    "hosts": [
      "switch1.example.com",
      "linux-host.example.com"
    ]
  }
}

Usage examples

Stand-alone mode

netdoc-collector -i inventory.json -c config.yaml
netdoc-collector -i inventory.json -o ./output -w 10

Scanner mode

netdoc-collector -s -n 172.25.82.2/32

Managed mode

export NETDOC_TOKEN="<your-api-token>"
netdoc-collector --url https://netdoc.example.com --token "$NETDOC_TOKEN"

Or pass credentials directly:

netdoc-collector --url https://netdoc.example.com --token mytoken --workers 8

Output

Discovery snapshots are written into the configured output directory in timestamped folders. Each host gets a subdirectory with JSON payloads and raw command output files.

Developer quickstart

git clone https://github.com/NetDocLab/netdoc-collector.git
cd netdoc-collector
poetry install
pre-commit install
pre-commit install --hook-type commit-msg

Run tests

poetry run pytest

Build documentation locally

poetry run mkdocs build --strict
poetry run mkdocs serve -a 127.0.0.1:8000

Formatting and linting

poetry run ruff check .
poetry run ruff format .

Documentation

This project publishes docs from the root README.md and reference pages generated from source code using mkdocstrings.

Contributing

See CONTRIBUTING.md for contribution guidelines, branch conventions, and CI requirements.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netdoc_collector-0.5.0.tar.gz (140.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

netdoc_collector-0.5.0-py3-none-any.whl (40.3 kB view details)

Uploaded Python 3

File details

Details for the file netdoc_collector-0.5.0.tar.gz.

File metadata

  • Download URL: netdoc_collector-0.5.0.tar.gz
  • Upload date:
  • Size: 140.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for netdoc_collector-0.5.0.tar.gz
Algorithm Hash digest
SHA256 630bab2ec09165fb31633a6da9279b9469d7e23f882e337101f0bf7c78702baa
MD5 ca75c4f0f517f630d1814a9655c9f17f
BLAKE2b-256 9df2032351cff3d8e972676e5334e254c267ba185fe03cf1f6e3eadc99f6477f

See more details on using hashes here.

File details

Details for the file netdoc_collector-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for netdoc_collector-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a75c9e13d08b900f004d43edbd2c12adf5fe8bf488f08ff1410664e1b4f407a9
MD5 39d7c3719a509ee1caded72782c098fe
BLAKE2b-256 4bd200640ba126520f3632fdeaf120684788122f5be5ddf674cfc1d0bd840e9e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page