serial: This field may not be null. (on disks?) #270

Open
opened 2023-04-07 11:30:30 +02:00 by rhaamo · 1 comment
rhaamo commented 2023-04-07 11:30:30 +02:00 (Migrated from github.com)

Describe the bug
Getting that error:

DEBUG:urllib3.connectionpool:https://netbox.xxx:443 "GET /api/dcim/manufacturers/?name=WDC&limit=0 HTTP/1.1" 200 372
DEBUG:urllib3.connectionpool:https://netbox.xxx:443 "POST /api/dcim/inventory-items/ HTTP/1.1" 201 883
INFO:root:Creating Disk WD3000BKHG xx-xxx-xxx
DEBUG:urllib3.connectionpool:https://netbox.xxx:443 "GET /api/dcim/manufacturers/?name=DVD-ROM+DV-28SW&limit=0 HTTP/1.1" 200 408
DEBUG:urllib3.connectionpool:https://netbox.xxx:443 "POST /api/dcim/inventory-items/ HTTP/1.1" 400 42
Traceback (most recent call last):
  File "/usr/local/bin/netbox_agent", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/dist-packages/netbox_agent/cli.py", line 50, in main
    return run(config)
  File "/usr/local/lib/python3.9/dist-packages/netbox_agent/cli.py", line 43, in run
    server.netbox_create_or_update(config)
  File "/usr/local/lib/python3.9/dist-packages/netbox_agent/server.py", line 419, in netbox_create_or_update
    self.inventory.create_or_update()
  File "/usr/local/lib/python3.9/dist-packages/netbox_agent/inventory.py", line 548, in create_or_update
    self.do_netbox_disks()
  File "/usr/local/lib/python3.9/dist-packages/netbox_agent/inventory.py", line 446, in do_netbox_disks
    self.create_netbox_disk(disk)
  File "/usr/local/lib/python3.9/dist-packages/netbox_agent/inventory.py", line 389, in create_netbox_disk
    _ = nb.dcim.inventory_items.create(**parms)
  File "/usr/local/lib/python3.9/dist-packages/pynetbox/core/endpoint.py", line 304, in create
    req = Request(
  File "/usr/local/lib/python3.9/dist-packages/pynetbox/core/query.py", line 387, in post
    return self._make_call(verb="post", data=data)
  File "/usr/local/lib/python3.9/dist-packages/pynetbox/core/query.py", line 282, in _make_call
    raise RequestError(req)
pynetbox.core.query.RequestError: The request failed with code 400 Bad Request: {'serial': ['This field may not be null.']}

Expected behavior
It should works.

Configuration file

netbox:
 url: 'https://xxx/'
 token: 'xxx'
 # uncomment to disable ssl verification
 ssl_verify: 'True'

network:
  ignore_interfaces: '(dummy.*|docker.*)'
  ignore_ips: '(127\.0\.0\..*)'
  # enable auto-cabling
  lldp: 'True'

device:
 server_role: "Server"
 tags: "dell,proxmox,10g,bonding,physical"

datacenter_location:
 driver: "cmd:echo home"
 regex: "(.*)"

inventory: "True"

Environment:

  • OS: Debian 11
  • Netbox agent: installed from git+github_url

Additional context
Launching a register with: netbox_agent -c /etc/netbox_agent.yml --register --debug --force-disk-refresh did not help

**Describe the bug** Getting that error: ``` DEBUG:urllib3.connectionpool:https://netbox.xxx:443 "GET /api/dcim/manufacturers/?name=WDC&limit=0 HTTP/1.1" 200 372 DEBUG:urllib3.connectionpool:https://netbox.xxx:443 "POST /api/dcim/inventory-items/ HTTP/1.1" 201 883 INFO:root:Creating Disk WD3000BKHG xx-xxx-xxx DEBUG:urllib3.connectionpool:https://netbox.xxx:443 "GET /api/dcim/manufacturers/?name=DVD-ROM+DV-28SW&limit=0 HTTP/1.1" 200 408 DEBUG:urllib3.connectionpool:https://netbox.xxx:443 "POST /api/dcim/inventory-items/ HTTP/1.1" 400 42 Traceback (most recent call last): File "/usr/local/bin/netbox_agent", line 8, in <module> sys.exit(main()) File "/usr/local/lib/python3.9/dist-packages/netbox_agent/cli.py", line 50, in main return run(config) File "/usr/local/lib/python3.9/dist-packages/netbox_agent/cli.py", line 43, in run server.netbox_create_or_update(config) File "/usr/local/lib/python3.9/dist-packages/netbox_agent/server.py", line 419, in netbox_create_or_update self.inventory.create_or_update() File "/usr/local/lib/python3.9/dist-packages/netbox_agent/inventory.py", line 548, in create_or_update self.do_netbox_disks() File "/usr/local/lib/python3.9/dist-packages/netbox_agent/inventory.py", line 446, in do_netbox_disks self.create_netbox_disk(disk) File "/usr/local/lib/python3.9/dist-packages/netbox_agent/inventory.py", line 389, in create_netbox_disk _ = nb.dcim.inventory_items.create(**parms) File "/usr/local/lib/python3.9/dist-packages/pynetbox/core/endpoint.py", line 304, in create req = Request( File "/usr/local/lib/python3.9/dist-packages/pynetbox/core/query.py", line 387, in post return self._make_call(verb="post", data=data) File "/usr/local/lib/python3.9/dist-packages/pynetbox/core/query.py", line 282, in _make_call raise RequestError(req) pynetbox.core.query.RequestError: The request failed with code 400 Bad Request: {'serial': ['This field may not be null.']} ``` **Expected behavior** It should works. **Configuration file** ```yaml netbox: url: 'https://xxx/' token: 'xxx' # uncomment to disable ssl verification ssl_verify: 'True' network: ignore_interfaces: '(dummy.*|docker.*)' ignore_ips: '(127\.0\.0\..*)' # enable auto-cabling lldp: 'True' device: server_role: "Server" tags: "dell,proxmox,10g,bonding,physical" datacenter_location: driver: "cmd:echo home" regex: "(.*)" inventory: "True" ``` **Environment:** - OS: Debian 11 - Netbox agent: installed from git+github_url **Additional context** Launching a register with: `netbox_agent -c /etc/netbox_agent.yml --register --debug --force-disk-refresh` did not help
Solvik commented 2023-08-28 19:02:58 +02:00 (Migrated from github.com)

Netbox doesn't allow null serial numbers

Could you paste your dmidecode output so I can understand why it's trying to create a ressource without S/N?

Netbox doesn't allow null serial numbers Could you paste your dmidecode output so I can understand why it's trying to create a ressource without S/N?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: DGNum/netbox-agent#270
No description provided.