Blame
76c74d | Steven Anderson | 2024-12-30 11:07:22 | 1 | # netbox |
2 | ||||
3 | #### search for devices in shell |
|||
4 | ```py |
|||
5 | import pynetbox |
|||
6 | ||||
7 | nb = pynetbox.api('https://netboxurl>', token="<token>") |
|||
8 | ||||
9 | devices = nb.dcim.devices.filter(site="<site>", tenant=["<tenant>"], status=["offline", "active"]) |
|||
10 | ||||
11 | len(devices) |
|||
12 | ||||
13 | for device in devices: |
|||
14 | print(f"{device.id},{device.name}") |
|||
15 | ``` |