Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
294619f
Handle missing pvid in LLDP VLAN data
TiagoTT Nov 18, 2024
1918e28
Handle missing driver in storage device configuration data
TiagoTT Dec 10, 2024
4373810
workflows tests, use pyproject
CllaudiaB Dec 11, 2024
55f3296
Merge pull request #16 from CllaudiaB/CI
CllaudiaB Dec 11, 2024
dea317e
resolve docker-compose command not found
CllaudiaB Dec 11, 2024
dda19bb
Merge pull request #18 from CllaudiaB/docker-compose-issue
CllaudiaB Dec 11, 2024
a4c9fb7
resolve docker-compose command not found
CllaudiaB Dec 11, 2024
b947902
Merge pull request #19 from CllaudiaB/docker-compose-issue
CllaudiaB Dec 11, 2024
ac7ce07
ignore the test that indicates if the device hosts an expension card
CllaudiaB Dec 11, 2024
da9ff0d
Merge pull request #20 from CllaudiaB/ignore_test
CllaudiaB Dec 11, 2024
2dd54e3
Merge pull request #337 from CllaudiaB/master
CllaudiaB Dec 11, 2024
bfe34bf
temporarily skip Codecov integration
CllaudiaB Dec 11, 2024
3a02fb0
Merge pull request #341 from CllaudiaB/CI
CllaudiaB Dec 11, 2024
c8e5915
Merge pull request #333 from brandwatch/fix-storage-no-driver
CllaudiaB Dec 11, 2024
0e9598b
Merge pull request #326 from brandwatch/fix-lldp-no-pvid
CllaudiaB Dec 11, 2024
0e37e6a
Add missing prtint debug
obeone Aug 21, 2023
e7fb233
Check if it's a VM before running lldp related actions
obeone Aug 21, 2023
ed6946e
Return 0 if everything ok as excepted in a shell
obeone Aug 21, 2023
3315211
add conditional exit code
CllaudiaB Dec 11, 2024
be9fcf9
Merge pull request #279 from obeone/virtualmachine_corrections
CllaudiaB Dec 12, 2024
a16d632
Fix KeyError: 'pvid' in lldp.py
illes Apr 26, 2022
fbfbc46
fixup! Fix KeyError: 'pvid' in lldp.py
illes Apr 29, 2022
0c56097
Merge pull request #223 from illes/patch-1
CllaudiaB Dec 12, 2024
f2d64e4
Update dependency packaging to v24
renovate[bot] Dec 11, 2024
d34d144
Merge pull request #290 from Solvik/renovate/packaging-24.x
CllaudiaB Dec 12, 2024
6736136
pynetbox 7.3.4 depends on packaging<24.0
CllaudiaB Dec 12, 2024
558f141
Merge pull request #342 from CllaudiaB/packaging-24.x
CllaudiaB Dec 12, 2024
872a0e5
generate only one Codecov report
CllaudiaB Dec 16, 2024
dd2e8c4
Merge pull request #344 from CllaudiaB/improve_CI
CllaudiaB Dec 16, 2024
83d41ae
Update dependency ruff to ~=0.8.3
renovate[bot] Dec 16, 2024
540b54b
Merge pull request #338 from Solvik/renovate/ruff-0.x
CllaudiaB Dec 16, 2024
c9f2bd3
Update dependency jsonargparse to v4.35.0
renovate[bot] Dec 16, 2024
30dfa0e
Merge pull request #203 from Solvik/renovate/jsonargparse-4.x
CllaudiaB Dec 16, 2024
bc2802c
Update dependency pyyaml to v6.0.2
renovate[bot] Dec 16, 2024
6ef180d
Merge pull request #302 from Solvik/renovate/pyyaml-6.x
CllaudiaB Dec 16, 2024
117e9b2
Update dependency pynetbox to v7.4.1
renovate[bot] Dec 11, 2024
fe500e4
Merge pull request #308 from Solvik/renovate/pynetbox-7.x
CllaudiaB Dec 16, 2024
d4546b4
Associate devices to clusters and virtual machines to devices
TiagoTT Nov 29, 2024
0e42da3
use check_output to enable better error detection
CllaudiaB Dec 19, 2024
33cf48e
Remove duplicated and unused get_netbox_cluster() definition
TiagoTT Dec 22, 2024
4e79380
update README.md
CllaudiaB Dec 23, 2024
6b02df2
update README
CllaudiaB Dec 23, 2024
48efb4f
remove unused logging and return a list of VM names
CllaudiaB Dec 23, 2024
c6b5483
fix: typo
CllaudiaB Dec 23, 2024
8141979
Fix import order
TiagoTT Jan 3, 2025
991a171
Fix package selection in pyproject.toml
TiagoTT Jan 3, 2025
36018c4
Merge pull request #347 from brandwatch/fix_pyproject.toml_2
CllaudiaB Jan 7, 2025
c74b3b7
Merge pull request #327 from brandwatch/virtualization_cluster_devices
CllaudiaB Jan 7, 2025
a9d7fc4
improve CI
CllaudiaB Jan 6, 2025
750283a
install tests dependencies
CllaudiaB Jan 6, 2025
65a1562
use dependency-groups instead of project.optional-dependencies
CllaudiaB Jan 6, 2025
282eb72
install dependency-groups
CllaudiaB Jan 6, 2025
6332e58
install dependencies
CllaudiaB Jan 6, 2025
234883c
install dependencies
CllaudiaB Jan 6, 2025
8de112a
check that the installed package contains the required modules
CllaudiaB Jan 7, 2025
6c793f7
improve ci
CllaudiaB Jan 7, 2025
4bd0204
Merge pull request #349 from CllaudiaB/improve_ci
CllaudiaB Jan 7, 2025
348d2a3
fix(deps): update dependency packaging to v24
renovate[bot] Jan 7, 2025
41fa236
Merge pull request #343 from Solvik/renovate/packaging-24.x
CllaudiaB Jan 7, 2025
27b208f
fix virtual guests command
CllaudiaB Jan 7, 2025
cc20d42
Merge pull request #350 from CllaudiaB/fix-virtual-guests-command
CllaudiaB Jan 8, 2025
ff766c7
apply Ruff for linting and formatting
CllaudiaB Dec 11, 2024
edd19d8
fix: style
CllaudiaB Jan 8, 2025
3518a5f
the dependencies are compatible with Python 3.13.1 as well
CllaudiaB Jan 8, 2025
11a4204
update the python version
CllaudiaB Jan 8, 2025
795217f
fix: typo
CllaudiaB Jan 8, 2025
f2e1cfc
update README
CllaudiaB Jan 8, 2025
f1cc9b5
Merge pull request #340 from CllaudiaB/style
CllaudiaB Jan 8, 2025
4268534
add new version
CllaudiaB Jan 8, 2025
b2ad6b1
Merge pull request #351 from CllaudiaB/new_version
CllaudiaB Jan 8, 2025
98b8ea5
Fix netboxk interface delete
TiagoTT Jan 10, 2025
c47db1b
Get ruff version from pyproject for CI
ribetm Jan 14, 2025
78308c5
Merge pull request #356 from ribetm/fix_ruff_version
ribetm Jan 14, 2025
3833e38
Merge pull request #353 from brandwatch/fix_network_interface_delete
ribetm Jan 14, 2025
59eccdb
Set total disk space on VMs
ribetm Jan 14, 2025
62c7502
Fix exit code
ribetm Jan 14, 2025
74e0908
Merge pull request #358 from ribetm/fix_exitcode
ribetm Jan 14, 2025
1cfce8d
Update virtualisation cluster on existing VMs
ribetm Jan 14, 2025
8c2b2ba
Merge pull request #359 from ribetm/update_vm_cluster
ribetm Jan 14, 2025
47e7291
fix(deps): update dependency jsonargparse to v4.36.0
renovate[bot] Jan 17, 2025
28f8edd
Merge pull request #357 from ribetm/vm_disks
ribetm Jan 20, 2025
b3a8ba8
check if hypervisor
CllaudiaB Jan 21, 2025
ce3c64d
fix: style
CllaudiaB Jan 21, 2025
e7b98f4
Merge pull request #364 from CllaudiaB/check_if_hypervisor
CllaudiaB Jan 21, 2025
616eff5
fix(deps): update dependency ruff to ~=0.9.2
renovate[bot] Jan 21, 2025
c20107a
Merge pull request #360 from Solvik/renovate/jsonargparse-4.x
CllaudiaB Jan 21, 2025
54e6110
Merge pull request #362 from Solvik/renovate/ruff-0.x
CllaudiaB Jan 21, 2025
e7c6e8e
Use either permanent or temporary MAC address
ribetm Jan 20, 2025
0b07252
Mark all virtual NICs as Virtual, except for LAGs
ribetm Jan 20, 2025
3281ad6
Enable/disable NICs depending on their link status
ribetm Jan 20, 2025
d3afbca
Allow using MAC addresses as the network identifier
ribetm Jan 20, 2025
85fd3ff
Update MACs. Only applies if NIC identifier is not `mac`
ribetm Jan 20, 2025
b5c3921
Fix MAC comparison
ribetm Jan 21, 2025
a7e6ae0
Fix some changes to NIC being lost before save()
ribetm Jan 21, 2025
099c352
Fix IP being always re-assigned
ribetm Jan 21, 2025
d53e650
NB 4.2 MAC objects compatibility
ribetm Jan 21, 2025
777100b
Add warning if no MAC was found but requested as identifier
ribetm Jan 21, 2025
c721817
Format code
ribetm Jan 21, 2025
e035509
Set duplex and effective speed on NICs
ribetm Jan 22, 2025
e7029af
Fix multiline ethtool parsing
ribetm Jan 22, 2025
4bade86
Use max speed for ethernet type, even for disconnected nics
ribetm Jan 20, 2025
eeaa17f
Add NIC name to missing MAC warning
ribetm Jan 24, 2025
4661a7c
Fix IPMI MAC comparison
ribetm Jan 29, 2025
d5e491c
Check for ethtool key
ribetm Jan 29, 2025
aadb490
Merge pull request #363 from ribetm/nic_improvements
ribetm Jan 29, 2025
11917d3
check if ethtool exists
CllaudiaB Feb 5, 2025
299d141
don't set duplex mode if virtual machine
CllaudiaB Feb 5, 2025
8e2b9d0
Merge pull request #366 from CllaudiaB/network_interfaces
CllaudiaB Feb 5, 2025
918ab91
Handle os-release without version or codename
ribetm Feb 18, 2025
ad59c10
Add support for 2.5GBASE-T and 5GBASE-T interface types
gs-adn Mar 12, 2025
5fdda58
Merge pull request #374 from gs-adn/for-upstream/multigig
ribetm Mar 24, 2025
47dfb46
Merge pull request #370 from ribetm/best_effort_osrelease
ribetm Mar 25, 2025
fe0ea00
Update README.md (#383)
shystrui1199 Jun 19, 2025
abd502f
conflicts
Charlie-Root Jul 30, 2025
0d06878
fix
Charlie-Root Jul 30, 2025
6692b61
fix
Charlie-Root Jul 30, 2025
5feed7b
fix
Charlie-Root Jul 30, 2025
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
58 changes: 58 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Tests

on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install build dependencies
run: pip install build
- name: Build the package
run: python3 -m build
- name: Install the built package from tar.gz
run: pip install "$(echo dist/*.tar.gz)"[dev]
- name: Run netbox_agent to check that the installed package contains the required modules
run: netbox_agent --help
- name: Run tests
run: ./tests.sh
#- name: Upload coverage to Codecov
# if: matrix.python-version == '3.13.0'
# uses: codecov/codecov-action@v3
# continue-on-error: true
# with:
# files: ./coverage.xml
# token: ${{ secrets.CODECOV_TOKEN }}
# fail_ci_if_error: true
ruff_linter:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install Ruff
run: pip install $(grep -Po '(?<=")ruff[^"]+' pyproject.toml)
- name: Ruff linter
run: ruff check
ruff_formatter:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install Ruff
run: pip install $(grep -Po '(?<=")ruff[^"]+' pyproject.toml)
- name: Ruff formatter
run: ruff format --diff
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ The goal is to generate an existing infrastructure on Netbox and have the abilit
* Automatic cabling (server's interface to switch's interface) using lldp
* Local inventory using `Inventory Item` for CPU, GPU, RAM, RAID cards, physical disks (behind raid cards)
* PSUs creation and power consumption reporting (based on vendor's tools)
* Associate hypervisor devices to the virtualization cluster
* Associate virtual machines to the hypervisor device

# Requirements

- Netbox >= 3.7
- Python >= 3.8
- [pynetbox](https://github.com/digitalocean/pynetbox/)
- [python3-netaddr](https://github.com/drkjam/netaddr)
- [python3-netaddr](https://github.com/netaddr/netaddr)
- [python3-netifaces](https://github.com/al45tair/netifaces)
- [jsonargparse](https://github.com/omni-us/jsonargparse/)

Expand Down Expand Up @@ -128,6 +130,13 @@ network:
# # see https://netbox.company.com/virtualization/clusters/
# cluster_name: my_vm_cluster

## Enable hypervisor support
# virtual:
# enabled: false
# hypervisor: true
# cluster_name: my_cluster
# list_guests_cmd: command that lists VMs names

# Enable datacenter location feature in Netbox
datacenter_location:
driver: "cmd:cat /etc/qualification | tr [A-Z] [a-z]"
Expand Down Expand Up @@ -290,3 +299,9 @@ On a personal note, I use the docker image from [netbox-community/netbox-docker]
# docker-compose pull
# docker-compose up
```

For the linter and code formatting, you need to run:
```
ruff check
ruff format
```
34 changes: 23 additions & 11 deletions netbox_agent/cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from packaging import version
import netbox_agent.dmidecode as dmidecode
from netbox_agent.config import config
Expand Down Expand Up @@ -29,32 +30,43 @@ def run(config):
dmi = dmidecode.parse()

if config.virtual.enabled or is_vm(dmi):
if config.virtual.hypervisor:
raise Exception("This host can't be a hypervisor because it's a VM")
if not config.virtual.cluster_name:
raise Exception('virtual.cluster_name parameter is mandatory because it\'s a VM')
raise Exception("virtual.cluster_name parameter is mandatory because it's a VM")
server = VirtualMachine(dmi=dmi)
else:
manufacturer = dmidecode.get_by_type(dmi, 'Chassis')[0].get('Manufacturer')
logging.info("Found manufacturer: %s" % manufacturer)
if config.virtual.hypervisor and not config.virtual.cluster_name:
raise Exception(
"virtual.cluster_name parameter is mandatory because it's a hypervisor"
)
manufacturer = dmidecode.get_by_type(dmi, "Chassis")[0].get("Manufacturer")
try:
server = MANUFACTURERS[manufacturer](dmi=dmi)
except KeyError:
server = GenericHost(dmi=dmi)

if version.parse(nb.version) < version.parse('3.7'):
print('netbox-agent is not compatible with Netbox prior to version 3.7')
return False
if version.parse(nb.version) < version.parse("3.7"):
print("netbox-agent is not compatible with Netbox prior to version 3.7")
return 1

if config.register or config.update_all or config.update_network or \
config.update_location or config.update_inventory or config.update_psu:
if (
config.register
or config.update_all
or config.update_network
or config.update_location
or config.update_inventory
or config.update_psu
):
server.netbox_create_or_update(config)
if config.debug:
server.print_debug()
return True
return 0


def main():
return run(config)


if __name__ == '__main__':
main()
if __name__ == "__main__":
sys.exit(main())
209 changes: 132 additions & 77 deletions netbox_agent/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,87 +10,142 @@
def get_config():
p = jsonargparse.ArgumentParser(
default_config_files=[
'/etc/netbox_agent.yaml',
'~/.config/netbox_agent.yaml',
'~/.netbox_agent.yaml',
"/etc/netbox_agent.yaml",
"~/.config/netbox_agent.yaml",
"~/.netbox_agent.yaml",
],
prog='netbox_agent',
prog="netbox_agent",
description="Netbox agent to run on your infrastructure's servers",
env_prefix='NETBOX_AGENT_',
default_env=True
env_prefix="NETBOX_AGENT_",
default_env=True,
)
p.add_argument('-c', '--config', action=jsonargparse.ActionConfigFile)
p.add_argument("-c", "--config", action=jsonargparse.ActionConfigFile)

p.add_argument('-r', '--register', action='store_true', help='Register server to Netbox')
p.add_argument('-u', '--update-all', action='store_true', help='Update all infos in Netbox')
p.add_argument('-d', '--debug', action='store_true', help='Print debug infos')
p.add_argument('--update-network', action='store_true', help='Update network')
p.add_argument('--update-inventory', action='store_true', help='Update inventory')
p.add_argument('--update-location', action='store_true', help='Update location')
p.add_argument('--update-psu', action='store_true', help='Update PSU')
p.add_argument('--update-old-devices', action='store_true',
help='Update serial number of existing (old ?) devices having same name but different serial')
p.add_argument('--purge-old-devices', action='store_true',
help='Purge existing (old ?) devices having same name but different serial')
p.add_argument('--expansion-as-device', action='store_true',
help='Manage blade expansions as external devices')
p.add_argument("-r", "--register", action="store_true", help="Register server to Netbox")
p.add_argument("-u", "--update-all", action="store_true", help="Update all infos in Netbox")
p.add_argument("-d", "--debug", action="store_true", help="Print debug infos")
p.add_argument("--update-network", action="store_true", help="Update network")
p.add_argument("--update-inventory", action="store_true", help="Update inventory")
p.add_argument("--update-location", action="store_true", help="Update location")
p.add_argument("--update-psu", action="store_true", help="Update PSU")
p.add_argument(
"--update-hypervisor",
action="store_true",
help="Update virtualization cluster and virtual machines",
)
p.add_argument(
"--update-old-devices",
action="store_true",
help="Update serial number of existing (old ?) devices having same name but different serial",
)
p.add_argument(
"--purge-old-devices",
action="store_true",
help="Purge existing (old ?) devices having same name but different serial",
)
p.add_argument(
"--expansion-as-device",
action="store_true",
help="Manage blade expansions as external devices",
)

p.add_argument('--log_level', default='debug')
p.add_argument('--netbox.ssl_ca_certs_file', help='SSL CA certificates file')
p.add_argument('--netbox.url', help='Netbox URL')
p.add_argument('--netbox.token', help='Netbox API Token')
p.add_argument('--netbox.ssl_verify', default=True, action='store_true',
help='Disable SSL verification')
p.add_argument('--virtual.enabled', action='store_true', help='Is a virtual machine or not')
p.add_argument('--virtual.cluster_name', help='Cluster name of VM')
p.add_argument('--hostname_cmd', default=None,
help="Command to output hostname, used as Device's name in netbox")
p.add_argument('--device.platform', default=None,
help='Override device platform. Here we use OS distribution.')
p.add_argument('--device.tags', default=r'',
help='tags to use for a host')
p.add_argument('--preserve-tags', action='store_true', help='Append new unique tags, preserve those already present')
p.add_argument('--device.custom_fields', default=r'',
help='custom_fields to use for a host, eg: field1=v1,field2=v2')
p.add_argument('--device.blade_role', default=r'Blade',
help='role to use for a blade server')
p.add_argument('--device.chassis_role', default=r'Server Chassis',
help='role to use for a chassis')
p.add_argument('--device.server_role', default=r'Server',
help='role to use for a server')
p.add_argument('--tenant.driver',
help='tenant driver, ie cmd, file')
p.add_argument('--tenant.driver_file',
help='tenant driver custom driver file path')
p.add_argument('--tenant.regex',
help='tenant regex to extract Netbox tenant slug')
p.add_argument('--datacenter_location.driver',
help='Datacenter location driver, ie: cmd, file')
p.add_argument('--datacenter_location.driver_file',
help='Datacenter location custom driver file path')
p.add_argument('--datacenter_location.regex',
help='Datacenter location regex to extract Netbox DC slug')
p.add_argument('--rack_location.driver', help='Rack location driver, ie: cmd, file')
p.add_argument('--rack_location.driver_file', help='Rack location custom driver file path')
p.add_argument('--rack_location.regex', help='Rack location regex to extract Rack name')
p.add_argument('--slot_location.driver', help='Slot location driver, ie: cmd, file')
p.add_argument('--slot_location.driver_file', help='Slot location custom driver file path')
p.add_argument('--slot_location.regex', help='Slot location regex to extract slot name')
p.add_argument('--network.ignore_interfaces', default=r'(dummy.*|docker.*)',
help='Regex to ignore interfaces')
p.add_argument('--network.ignore_ips', default=r'^(127\.0\.0\..*|fe80.*|::1.*)',
help='Regex to ignore IPs')
p.add_argument('--network.ipmi', default=True, help='Enable gathering IPMI information')
p.add_argument('--network.lldp', help='Enable auto-cabling feature through LLDP infos')
p.add_argument('--inventory', action='store_true',
help='Enable HW inventory (CPU, Memory, RAID Cards, Disks) feature')
p.add_argument('--process-virtual-drives', action='store_true',
help='Process virtual drives information from RAID '
'controllers to fill disk custom_fields')
p.add_argument('--force-disk-refresh', action='store_true',
help='Forces disks detection reprocessing')
p.add_argument('--dump-disks-map',
help='File path to dump physical/virtual disks map')
p.add_argument("--log_level", default="debug")
p.add_argument("--netbox.ssl_ca_certs_file", help="SSL CA certificates file")
p.add_argument("--netbox.url", help="Netbox URL")
p.add_argument("--netbox.token", help="Netbox API Token")
p.add_argument(
"--netbox.ssl_verify", default=True, action="store_true", help="Disable SSL verification"
)
p.add_argument("--virtual.enabled", action="store_true", help="Is a virtual machine or not")
p.add_argument("--virtual.cluster_name", help="Cluster name of VM")
p.add_argument("--virtual.hypervisor", action="store_true", help="Is a hypervisor or not")
p.add_argument(
"--virtual.list_guests_cmd",
default=None,
help="Command to output the list of vrtualization guests in the hypervisor separated by whitespace",
)
p.add_argument(
"--hostname_cmd",
default=None,
help="Command to output hostname, used as Device's name in netbox",
)
p.add_argument(
"--device.platform",
default=None,
help="Override device platform. Here we use OS distribution.",
)
p.add_argument("--device.tags", default=r"", help="tags to use for a host")
p.add_argument(
"--preserve-tags",
action="store_true",
help="Append new unique tags, preserve those already present",
)
p.add_argument(
"--device.custom_fields",
default=r"",
help="custom_fields to use for a host, eg: field1=v1,field2=v2",
)
p.add_argument("--device.blade_role", default=r"Blade", help="role to use for a blade server")
p.add_argument(
"--device.chassis_role", default=r"Server Chassis", help="role to use for a chassis"
)
p.add_argument("--device.server_role", default=r"Server", help="role to use for a server")
p.add_argument("--tenant.driver", help="tenant driver, ie cmd, file")
p.add_argument("--tenant.driver_file", help="tenant driver custom driver file path")
p.add_argument("--tenant.regex", help="tenant regex to extract Netbox tenant slug")
p.add_argument(
"--datacenter_location.driver", help="Datacenter location driver, ie: cmd, file"
)
p.add_argument(
"--datacenter_location.driver_file", help="Datacenter location custom driver file path"
)
p.add_argument(
"--datacenter_location.regex", help="Datacenter location regex to extract Netbox DC slug"
)
p.add_argument("--rack_location.driver", help="Rack location driver, ie: cmd, file")
p.add_argument("--rack_location.driver_file", help="Rack location custom driver file path")
p.add_argument("--rack_location.regex", help="Rack location regex to extract Rack name")
p.add_argument("--slot_location.driver", help="Slot location driver, ie: cmd, file")
p.add_argument("--slot_location.driver_file", help="Slot location custom driver file path")
p.add_argument("--slot_location.regex", help="Slot location regex to extract slot name")
p.add_argument(
"--network.ignore_interfaces",
default=r"(dummy.*|docker.*)",
help="Regex to ignore interfaces",
)
p.add_argument(
"--network.ignore_ips",
default=r"^(127\.0\.0\..*|fe80.*|::1.*)",
help="Regex to ignore IPs",
)
p.add_argument("--network.ipmi", default=True, help="Enable gathering IPMI information")
p.add_argument("--network.lldp", help="Enable auto-cabling feature through LLDP infos")
p.add_argument(
"--network.nic_id",
choices=("name", "mac"),
default="name",
help="What property to use as NIC identifier",
)
p.add_argument(
"--network.primary_mac",
choices=("permanent", "temp"),
default="temp",
help="Which MAC address to use as primary. Permanent requires ethtool and fallbacks to temporary",
)
p.add_argument(
"--inventory",
action="store_true",
help="Enable HW inventory (CPU, Memory, RAID Cards, Disks) feature",
)
p.add_argument(
"--process-virtual-drives",
action="store_true",
help="Process virtual drives information from RAID controllers to fill disk custom_fields",
)
p.add_argument(
"--force-disk-refresh", action="store_true", help="Forces disks detection reprocessing"
)
p.add_argument("--dump-disks-map", help="File path to dump physical/virtual disks map")

options = p.parse_args()
return options
Expand All @@ -101,7 +156,7 @@ def get_config():

def get_netbox_instance():
if config.netbox.url is None or config.netbox.token is None:
logging.error('Netbox URL and token are mandatory')
logging.error("Netbox URL and token are mandatory")
sys.exit(1)

nb = pynetbox.api(
Expand Down
Loading
Loading