Skip to content
Open
Changes from all commits
Commits
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
11 changes: 7 additions & 4 deletions cmk/plugins/collection/agent_based/inventory_lnx_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

@dataclass
class GraphicsCard:
slot: str
name: str
subsystem: str | None = None
driver: str | None = None
Expand All @@ -46,14 +47,15 @@ def parse_lnx_video(string_table: StringTable) -> Section:
continue

if "VGA compatible controller" in line[-2]:
current_slot = ":".join(line).split()[0]
current_name = line[-1].strip()
if current_name:
parsed_section.setdefault(current_name, GraphicsCard(name=current_name))
parsed_section.setdefault(current_slot, GraphicsCard(slot=current_slot, name=current_name))
elif current_name:
if line[0] == "Subsystem":
parsed_section[current_name].subsystem = line[1].strip()
parsed_section[current_slot].subsystem = line[1].strip()
elif line[0] == "Kernel driver in use":
parsed_section[current_name].driver = line[1].strip()
parsed_section[current_slot].driver = line[1].strip()

return parsed_section

Expand All @@ -70,9 +72,10 @@ def inventory_lnx_video(section: Section) -> InventoryResult:
yield TableRow(
path=["hardware", "video"],
key_columns={
"name": graphics_card.name,
"slot": graphics_card.slot,
},
inventory_columns={
"name": graphics_card.name,
"subsystem": graphics_card.subsystem,
"driver": graphics_card.driver,
},
Expand Down
Loading