Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,29 @@ INFO:root:Create new IP 42.42.42.43/24 on enp1s0f1
INFO:root:Creating Disk Samsung SSD 850 S2RBNX0K101698D
```

## Debug Mode

The `--debug` flag prints detailed information about the device before attempting to create or update it in Netbox. This is useful for troubleshooting issues or verifying what data will be sent to Netbox.

```
# netbox_agent -c /etc/netbox_agent.yaml --debug --register
Datacenter: dc-1
Netbox Datacenter: dc-1
Rack: rack-01
Netbox Rack: rack-01
Is blade: False
Got expansion: False
Product Name: ProLiant DL380 Gen10
Platform: x86-64
Chassis: Default string
Chassis service tag: 2M25XX0020
Service tag: 2M25XX0020
NIC:
[{'name': 'eno1', 'mac': 'a8:1e:84:f2:9e:69', ...}, ...]
INFO:root:Creating chassis blade (serial: QTFCQ574502EF)
...
```

# Configuration

```
Expand Down
5 changes: 5 additions & 0 deletions netbox_agent.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@ rack_location:
# regex: '.*-(\d+)'

inventory: true

# Enable debug mode to print detailed device information
# This is useful for troubleshooting before registration or updates
# Same as using the --debug or -d command line flag
# debug: true
4 changes: 2 additions & 2 deletions netbox_agent/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def run(config):
print("netbox-agent is not compatible with Netbox prior to version 3.7")
return 1

if config.debug:
server.print_debug()
if (
config.register
or config.update_all
Expand All @@ -54,8 +56,6 @@ def run(config):
or config.update_psu
):
server.netbox_create_or_update(config)
if config.debug:
server.print_debug()
return 0


Expand Down