Free NetBox Cloud has arrived. Learn more →

Using Diode and the Diode Agent to Accelerate Device Discovery With NetBox

Over the last couple months, we’ve been hard at work making it easier to get your network and infrastructure modeled in NetBox and maintain your NetBox data over time. First, we announced Diode, our new data ingestion service for NetBox. Diode is now available to the community for public preview, and will reach GA later this year. And more recently we announced our Diode Agent, a lightweight network device discovery tool that works with Diode to streamline gathering details about your devices and loading them into NetBox, massively reducing the barrier to getting up and running with NetBox in your network.

With the release of Diode for public preview, it’s now possible for anyone to try out both Diode and Diode Agent in tandem with your own NetBox instances – open source, NetBox Cloud, or NetBox Enterprise – and your network infrastructure. Diode and the Diode Agent are both hot off the presses, and as we learned during Diode’s private preview, there is a universe of functionality still to be added. However, there’s a ton of value for network teams today between these two great new tools. In this blog, we’ll do a simple walkthrough to set up Diode and the Diode Agent to discover all the devices in a small network and ingest them into a new NetBox Cloud instance.

Getting the pieces in place

Deploy Diode Server – You can follow the instructions in our Get started guide to install and configure Diode to work with your NetBox instance (note that Diode will be included with both Cloud and Enterprise editions of NetBox when it moves to GA later this year).

Install Diode Agent – You can follow the instructions to download and install it here. The agent should be deployed inside your network and configured to talk with your Diode server.

Configure discovery – Draft a simple manifest with the device inventory and credentials for Diode Agent to discover following the example provided here. Here’s a simple example to discover two devices with Diode server running locally:

diode:
  config:
    target: grpc://localhost:8081
    api_key: ${DIODE_API_KEY}
    tls_verify: false
  policies:
    discovery_1:
      config:
        netbox:
          site: Lab Testing
      data:
        - driver: eos
          hostname: 1.1.1.1
          username: admin
          password: ${EOS_PASSWORD}
          optional_args:
            enable_password: ${EOS_ENABLE_PASSWORD}
        - driver: ios
          hostname: 2.2.2.2
          username: admin
          password: ${IOS_PASSWORD}
          optional_args:
            enable_password: ${IOS_ENABLE_PASSWORD}

Discover your devices and ingest them with Diode

Run Diode Agent – simply run the agent while providing it with the network manifest (named config.yaml here):

% diode-napalm-agent -c config.yaml
INFO:diode_napalm.cli.cli:Hostname 1.1.1.1: Get driver 'eos'
INFO:diode_napalm.cli.cli:Hostname 2.2.2.2: Get driver 'ios'
INFO:diode_napalm.cli.cli:Hostname 1.1.1.1: Getting information
INFO:diode_napalm.cli.cli:Hostname 2.2.2.2: Getting information
INFO:paramiko.transport:Connected (version 1.99, client Cisco-1.25)
INFO:paramiko.transport:Authentication (password) successful!
INFO:diode_napalm.client:Hostname 1.1.1.1: Successful ingestion
INFO:diode_napalm.client:Hostname 2.2.2.2: Successful ingestion

Diode Agent is powered by NAPALM to pull device inventory data from network devices. Beyond the default included device drivers, Diode Agent can support a broader set of network devices by leveraging the extensive collection of NAPALM community drivers.

Diode Server logs – you can view the reconciler logs (docker compose logs) to see what data was sent to Diode server by the agent and what changes are being pushed to NetBox:

diode-reconciler-1  | {"time":"2024-08-02T17:49:37.254213586Z","level":"INFO","msg":"apply change set","payload":"{"change_set_id":"f4cd3961-50ce-452c-98c4-d47f2a132c2a","change_set":[{"change_id":"b17ed885-74ae-4e54-91cb-5161c2938752","change_type":"create","object_type":"dcim.manufacturer","data":{"name":"Cisco","slug":"cisco"}},{"change_id":"8ff1c195-216e-4e4a-ac39-bb8ce7bd83f5","change_type":"create","object_type":"dcim.platform","data":{"name":"ios","slug":"ios","manufacturer":{"name":"Cisco","slug":"cisco"}}},{"change_id":"736f3576-7f4e-4509-82d2-e87e3d529499","change_type":"create","object_type":"dcim.devicetype","data":{"model":"CSR1000V","slug":"csr1000v","manufacturer":{"name":"Cisco","slug":"cisco"}}},{"change_id":"0a711682-5ad5-4829-996f-aedb0f78a0cf","change_type":"create","object_type":"dcim.device","data":{"name":"CSR1","site":{"id":67},"role":{"id":24},"device_type":{"model":"CSR1000V","slug":"csr1000v","manufacturer":{"name":"Cisco","slug":"cisco"}},"platform":{"name":"ios","slug":"ios","manufacturer":{"name":"Cisco","slug":"cisco"}},"serial":"9APE8MOV8WR","status":"active"}}]}"}
diode-reconciler-1  | {"time":"2024-08-02T17:49:37.466540315Z","level":"INFO","msg":"apply change set","response":"{"change_set_id":"f4cd3961-50ce-452c-98c4-d47f2a132c2a","result":"success"}"}

View in NetBox – you can get a summary view of all the changes discovered by the Diode agent by looking at the NetBox Change Log:

Viewing the CEOS1 device (for example), we can see the populated NetBox data model, which includes sites, manufacturers, device types, platforms, interfaces, IP addresses, prefixes and more:

Try Diode and Diode Agent yourself

You can get started with Diode and the Diode Agent in your own network today. Try following the steps from this blog to ingest device data from your own network into NetBox. Please do keep in mind that these are newly released products, and Diode in particular is being furiously worked on by our team on the path to GA readiness later this year, so you’ll probably run into some rough edges. If you do, you can help us add polish and improve the experience of working with Diode and the Diode Agent: please report bugs or other issues you find in the GitHub projects (Diode, Diode Agent) and join the discussion in the NetDev Slack (join the #diode channel).

Share the Post:

Related Posts