Add SNMP profile mapping and fix asset cleanup
This commit is contained in:
@@ -65,6 +65,9 @@ def _discovery_to_read(credential_profile_id: int, discovered: DiscoveredSnmpDev
|
||||
return SnmpDiscoveryRead(
|
||||
host=discovered.host,
|
||||
credential_profile_id=credential_profile_id,
|
||||
profile_key=discovered.profile_key,
|
||||
profile_name=discovered.profile_name,
|
||||
capabilities=discovered.capabilities,
|
||||
device_name=discovered.device_name,
|
||||
description=discovered.description,
|
||||
uptime_seconds=discovered.uptime_seconds,
|
||||
@@ -74,15 +77,27 @@ def _discovery_to_read(credential_profile_id: int, discovered: DiscoveredSnmpDev
|
||||
|
||||
|
||||
def _monitorable_items(discovered: DiscoveredSnmpDevice) -> list[SnmpDiscoveryItemRead]:
|
||||
items = [
|
||||
SnmpDiscoveryItemRead(
|
||||
item_id="device.uptime",
|
||||
item_type="device_uptime",
|
||||
group="Device Health",
|
||||
label="Device uptime",
|
||||
unit="seconds",
|
||||
items = []
|
||||
if discovered.uptime_seconds is not None:
|
||||
items.append(
|
||||
SnmpDiscoveryItemRead(
|
||||
item_id="device.uptime",
|
||||
item_type="device_uptime",
|
||||
group="Device Health",
|
||||
label="Device uptime",
|
||||
unit="seconds",
|
||||
)
|
||||
)
|
||||
]
|
||||
items.extend(
|
||||
SnmpDiscoveryItemRead(
|
||||
item_id=item.item_id,
|
||||
item_type=item.item_type,
|
||||
group=item.group,
|
||||
label=item.label,
|
||||
unit=item.unit,
|
||||
)
|
||||
for item in discovered.health_items
|
||||
)
|
||||
for interface in discovered.interfaces:
|
||||
group = f"Interface {interface.name}"
|
||||
item_prefix = f"interface.{interface.index}"
|
||||
|
||||
Reference in New Issue
Block a user