Skip to content

Commit

Permalink
adds config option disable collection of ESXi serial #428
Browse files Browse the repository at this point in the history
  • Loading branch information
bb-Ricardo committed Dec 12, 2024
1 parent 9d11567 commit 26a2281
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions module/sources/vmware/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ def __init__(self):
bool,
description="Attempt to collect asset tags from vCenter hosts",
default_value=True),
ConfigOption("collect_hardware_serial",
bool,
description="Attempt to collect serials from vCenter hosts",
default_value=True),
ConfigOption("dns_name_lookup",
bool,
description="""Perform a reverse lookup for all collected IP addresses.
Expand Down
2 changes: 1 addition & 1 deletion module/sources/vmware/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@ def add_host(self, obj):
serial = None

for serial_num_key in ["SerialNumberTag", "ServiceTag", "EnclosureSerialNumberTag"]:
if serial_num_key in identifier_dict.keys():
if serial_num_key in identifier_dict.keys() and self.settings.collect_hardware_serial is True:
log.debug2(f"Found {serial_num_key}: {get_string_or_none(identifier_dict.get(serial_num_key))}")
if serial is None:
serial = get_string_or_none(identifier_dict.get(serial_num_key))
Expand Down
3 changes: 3 additions & 0 deletions settings-example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ password = super-secret
; Attempt to collect asset tags from vCenter hosts
;collect_hardware_asset_tag = True

; Attempt to collect serials from vCenter hosts
;collect_hardware_serial = True

; Perform a reverse lookup for all collected IP addresses. If a dns name was found it will
; be added to the IP address object in NetBox
;dns_name_lookup = True
Expand Down

0 comments on commit 26a2281

Please sign in to comment.