host devices in cluster api #2918

Closed
opened 2025-12-29 18:23:25 +01:00 by adam · 1 comment
Owner

Originally created by @soofff on GitHub (Oct 1, 2019).

Environment

  • Python version: 3
  • NetBox version: 2.6.5

Proposed Functionality

Host devices are listed under /virtualization/clusters/123 but not in api.
That would make cluster api much more useful.

I think that’s the opposite of https://github.com/netbox-community/netbox/issues/1540.

Use Case

If you want to get the host devices to a cluster but you only know the cluster name.

Database Changes

(I suspect) None

External Dependencies

None

Originally created by @soofff on GitHub (Oct 1, 2019). ### Environment * Python version: 3 * NetBox version: 2.6.5 ### Proposed Functionality Host devices are listed under `/virtualization/clusters/123` but not in api. That would make cluster api much more useful. I think that’s the opposite of https://github.com/netbox-community/netbox/issues/1540. ### Use Case If you want to get the host devices to a cluster but you only know the cluster name. ### Database Changes (I suspect) None ### External Dependencies None
adam closed this issue 2025-12-29 18:23:25 +01:00
Author
Owner

@jeremystretch commented on GitHub (Oct 1, 2019):

If you want to get the host devices to a cluster but you only know the cluster name.

Devices are accessed via the /api/dcim/devices/ endpoint. The following will filter devices by cluster ID:

GET /api/dcim/devices/?cluster_id=123

Note that virtual machines are retrieved in the same manner, at /api/virtualization/virtual-machines/.

I will note that NetBox does not have a filter for matching either type of object by cluster name; seems like this was overlooked back when clusters were introduced. We could add one, but this would need to be a separate FR.

@jeremystretch commented on GitHub (Oct 1, 2019): > If you want to get the host devices to a cluster but you only know the cluster name. Devices are accessed via the `/api/dcim/devices/` endpoint. The following will filter devices by cluster ID: ```GET /api/dcim/devices/?cluster_id=123``` Note that virtual machines are retrieved in the same manner, at `/api/virtualization/virtual-machines/`. I will note that NetBox does not have a filter for matching either type of object by cluster _name_; seems like this was overlooked back when clusters were introduced. We could add one, but this would need to be a separate FR.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2918