|
| 1 | +# Getting Started with Diode |
| 2 | + |
| 3 | +This guide will help you set up and start using Diode to ingest data into NetBox. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +Before you begin, ensure you have: |
| 8 | + |
| 9 | +- NetBox version 4.2.3 or later |
| 10 | +- Docker version 27.0.3 or newer |
| 11 | +- bash 4.x or newer |
| 12 | +- jq |
| 13 | + |
| 14 | +## Installation Steps |
| 15 | + |
| 16 | +### Deploy Diode server |
| 17 | + |
| 18 | +> **Host**: These steps should be performed on the host where you want to run the Diode server. |
| 19 | +
|
| 20 | +> **Note**: For the complete installation instructions, please refer to the [official Diode Server documentation](https://github.com/netboxlabs/diode/tree/develop/diode-server). |
| 21 | +
|
| 22 | +We provide a `quickstart.sh` script to automate the setup process. The script will download and configure all necessary files: |
| 23 | + |
| 24 | +- `docker-compose.yaml` — Defines Diode server containers |
| 25 | +- `.env` — Environment settings for customization |
| 26 | +- `nginx.conf` — Nginx configuration for routing Diode endpoints |
| 27 | +- `client-credentials.json` — Defines OAuth2 clients for secure communication |
| 28 | + |
| 29 | +1. Create a working directory: |
| 30 | + ```bash |
| 31 | + mkdir /opt/diode |
| 32 | + cd /opt/diode |
| 33 | + ``` |
| 34 | + |
| 35 | +2. Download and prepare the quickstart script: |
| 36 | + ```bash |
| 37 | + curl -sSfLo quickstart.sh https://raw.githubusercontent.com/netboxlabs/diode/release/diode-server/docker/scripts/quickstart.sh |
| 38 | + chmod +x quickstart.sh |
| 39 | + ``` |
| 40 | + |
| 41 | +3. Run the script with your NetBox server address: |
| 42 | + ```bash |
| 43 | + ./quickstart.sh https://<netbox-server> |
| 44 | + ``` |
| 45 | + This should have created an `.env` file for your environment. |
| 46 | + |
| 47 | +4. Start the Diode server: |
| 48 | + ```bash |
| 49 | + docker compose up -d |
| 50 | + ``` |
| 51 | +5. Extract the `netbox-to-diode` client secret. This will be needed for the Diode NetBox plugin installation: |
| 52 | + ```bash |
| 53 | + echo $(jq -r '.[] | select(.client_id == "netbox-to-diode") | .client_secret' /opt/diode/oauth2/client/client-credentials.json) |
| 54 | + ``` |
| 55 | + > **Note**: This will return a credential that will be used by the Diode NetBox plugin to connect to the Diode server. Store it safely. |
| 56 | +
|
| 57 | +### Install Diode NetBox Plugin |
| 58 | + |
| 59 | +> **Host**: These steps should be performed on the host where NetBox is installed. |
| 60 | +
|
| 61 | +> **Note**: For the complete installation instructions, please refer to the [official Diode NetBox Plugin documentation](https://github.com/netboxlabs/diode-netbox-plugin/blob/develop/README.md). |
| 62 | +
|
| 63 | +1. **Source the NetBox Python Virtual Environment** |
| 64 | + ```bash |
| 65 | + cd /opt/netbox |
| 66 | + source venv/bin/activate |
| 67 | + ``` |
| 68 | + |
| 69 | +2. **Install the Plugin Package** |
| 70 | + ```bash |
| 71 | + pip install netboxlabs-diode-netbox-plugin |
| 72 | + ``` |
| 73 | + |
| 74 | +3. **Configure NetBox Settings** |
| 75 | + Add the following to your `configuration.py`: |
| 76 | + ```python |
| 77 | + PLUGINS = [ |
| 78 | + "netbox_diode_plugin", |
| 79 | + ] |
| 80 | + |
| 81 | + PLUGINS_CONFIG = { |
| 82 | + "netbox_diode_plugin": { |
| 83 | + # Diode gRPC target for communication with Diode server |
| 84 | + "diode_target_override": "grpc://<diode-server:port>/diode", |
| 85 | + # NetBox username associated with changes applied via plugin |
| 86 | + "diode_username": "diode", |
| 87 | + # netbox-to-diode client secret from earlier step |
| 88 | + "netbox_to_diode_client_secret": "<netbox-to-diode-secret>" |
| 89 | + }, |
| 90 | + } |
| 91 | + ``` |
| 92 | + |
| 93 | +4. **Apply Database Migrations** |
| 94 | + ```bash |
| 95 | + cd /opt/netbox/netbox |
| 96 | + ./manage.py migrate netbox_diode_plugin |
| 97 | + ``` |
| 98 | + |
| 99 | +5. **Restart NetBox Services** |
| 100 | + ```bash |
| 101 | + sudo systemctl restart netbox netbox-rq |
| 102 | + ``` |
| 103 | + |
| 104 | +6. **Generate Diode Client Credentials** |
| 105 | + > **Note**: These credentials will be used by the Orb agent to send discovery results to NetBox via Diode. |
| 106 | +
|
| 107 | + 1. Go to your NetBox instance (https://<netbox-server>) |
| 108 | + 2. In the left-hand pane, navigate to **Diode -> Client Credentials** |
| 109 | + 3. Click on **+ Add a Credential** |
| 110 | + 4. For Client Name, enter any name and click **Create** |
| 111 | + 5. **IMPORTANT**: Copy the _Client ID_ and _Client Secret_ and save them securely |
| 112 | + 6. Click **Return to List** |
| 113 | + |
| 114 | + You have now created your Diode client credentials. These will be used as environment variables when running the Orb agent. |
| 115 | + |
| 116 | +### Ingest Data with Orb Agent |
| 117 | + |
| 118 | +> **Host**: These steps should be performed on the host where you want to run the Orb agent for network discovery. |
| 119 | +
|
| 120 | +> **Note**: For the complete installation instructions, please refer to the [official Orb Agent documentation](https://github.com/netboxlabs/orb-agent). |
| 121 | +
|
| 122 | +1. **Export Client Credentials** |
| 123 | + ```bash |
| 124 | + # Export the client credentials you generated in NetBox |
| 125 | + export DIODE_CLIENT_ID="<your-client-id>" |
| 126 | + export DIODE_CLIENT_SECRET="<your-client-secret>" |
| 127 | + ``` |
| 128 | + |
| 129 | +2. **Create Agent Configuration File** |
| 130 | + Create an `agent.yaml` file with the following content: |
| 131 | + ```yaml |
| 132 | + orb: |
| 133 | + config_manager: |
| 134 | + active: local |
| 135 | + backends: |
| 136 | + network_discovery: # Enable network discovery backend |
| 137 | + common: |
| 138 | + diode: |
| 139 | + target: grpc://<diode-server:port>/diode |
| 140 | + client_id: ${DIODE_CLIENT_ID} |
| 141 | + client_secret: ${DIODE_CLIENT_SECRET} |
| 142 | + agent_name: my_agent |
| 143 | + policies: |
| 144 | + network_discovery: |
| 145 | + loopback_policy: |
| 146 | + config: |
| 147 | + scope: |
| 148 | + targets: |
| 149 | + - 127.0.0.1 |
| 150 | + ``` |
| 151 | +
|
| 152 | +3. **Run the Agent** |
| 153 | + |
| 154 | + Using host network mode (recommended): |
| 155 | + ```bash |
| 156 | + docker run --net=host \ |
| 157 | + -v $(pwd):/opt/orb/ \ |
| 158 | + -e DIODE_CLIENT_ID \ |
| 159 | + -e DIODE_CLIENT_SECRET \ |
| 160 | + netboxlabs/orb-agent:latest run -c /opt/orb/agent.yaml |
| 161 | + ``` |
| 162 | + |
| 163 | + Alternative using root user: |
| 164 | + ```bash |
| 165 | + docker run -u root \ |
| 166 | + -v $(pwd):/opt/orb/ \ |
| 167 | + -e DIODE_CLIENT_ID \ |
| 168 | + -e DIODE_CLIENT_SECRET \ |
| 169 | + netboxlabs/orb-agent:latest run -c /opt/orb/agent.yaml |
| 170 | + ``` |
| 171 | + |
| 172 | + > **Note**: The container needs sufficient permissions to send ICMP and TCP packets. This can be achieved either by: |
| 173 | + > - Setting the network mode to `host` (recommended) |
| 174 | + > - Running the container as root user |
| 175 | +
|
| 176 | +4. **Verify Agent Operation** |
| 177 | + - Check the agent logs for successful startup |
| 178 | + - Verify data appears in NetBox |
| 179 | + |
| 180 | +## Troubleshooting |
| 181 | + |
| 182 | +### Common Issues |
| 183 | + |
| 184 | +1. **Connection Issues** |
| 185 | + - Verify network connectivity between Diode and NetBox |
| 186 | + - Check firewall rules |
| 187 | + - Validate URLs and ports |
| 188 | + |
| 189 | +### Getting Help |
| 190 | + |
| 191 | +If you encounter issues: |
| 192 | + |
| 193 | +1. Search GitHub: [Issues](https://github.com/netboxlabs/diode/issues) |
| 194 | +2. Find us in Slack: [NetDev Community #orb](https://https://netdev-community.slack.com/) |
0 commit comments