Thanks Martin,
the force was with me and I figured out where to place the Node()-definitions. I have seen the file you mentioned, but didn’t get the idea how it will be loaded.
Then “~/local/lib/python3/cmk_addons/plugins/{family}/inventory_ui/columns.py” was a good guess from me and I now can extend and define own column names for our inventories.
Side note:
In server_side_calls-API-doc it is explicitly written where to place the file and the Quick Guide is what I’m missing in the other plugin docs:
~/lib/python3.13/site-packages/cmk/server_side_calls/init.py: * The file with the plug-in has to be placed in the server_side_calls folder
In plugin API doc:
(Advanced) Example (for the docs, please use it if you want it):
#!/usr/bin/env python3
# The file with the plug-in has to be placed in the `inventory_ui` folder (e.g. "~/local/lib/python3/cmk_addons/plugins/{family}/inventory_ui/columns.py")
import re
import time
from cmk.inventory_ui.v1_unstable import (
Label,
Node,
NumberField,
SINotation,
Table,
TextField,
Title,
Unit,
View,
)
UNIT_BYTES = Unit(SINotation("B"))
def _render_date(value: int | float) -> Label | str:
return str(time.strftime("%Y-%m-%d", time.localtime(value)))
def _sort_key_version(value: str) -> tuple[int | str, ...]:
parts: list[int | str] = []
for value_part in value.split("."):
for part in re.split(r"(\d+)", value_part):
try:
parts.append(int(part))
except ValueError:
parts.append(part)
return tuple(parts)
node_software_packages = Node(
name="software_packages",
path=["software", "packages"],
title=Title("Software packages"),
table=Table(
view=View(name="invswpac", title=Title("Software packages")),
columns={
"name": TextField(Title("Name")),
"arch": TextField(Title("Architecture")),
"package_type": TextField(Title("Type")),
"summary": TextField(Title("Description")),
# sort_key enables from-to filtering
"version": TextField(Title("Version"), sort_key=_sort_key_version),
"vendor": TextField(Title("Vendor/Publisher")),
# sort_key enables from-to filtering
"package_version": TextField(Title("Package version"), sort_key=_sort_key_version),
"install_date": NumberField(Title("Install date"), render=_render_date),
"size": NumberField(Title("Size"), render=UNIT_BYTES),
"path": TextField(Title("Path")),
"language": TextField(Title("Language")),
"product_name": TextField(Title("Product")),
"classification": TextField(Title("Classification")),
"approval_state": TextField(Title("Approval state")),
"release_date": TextField(Title("Release date")),
"provided_by": TextField(Title("Provided by")),
"product_name": TextField(Title("Product name")),
},
),
)
Greetings
Stefan