Hi,
I have a problem with creating a view for my custom inventory data.
As a new user I can only upload one image per post. So I have written in the appropriate places the number of the image and combined all screenshots at the end into one image. All three screenshots are important I think.
I’m trying to create a table showing the backup-software-versions of all hosts.
The versions are stored in the inventory (picture 1)
Using this code:
def inv_snapshot_backup(info):
#pprint.pprint(info)
node = inv_tree("software.snapshot_backup:")
for line in info:
if len(line) > 2:
line = [line[0], ":".join(line[1:])]
varname, value = line
varname = re.sub("\s+$", "", varname)
value = re.sub("^\s+", "", value)
pprint.pprint(info)
if varname == "SnapshotBackupVssVersion":
node["version"] = value
elif varname == "SnapshotExeVersion":
match = re.search(r"^(\d+\.\d+)\.(\d+)", value)
if match:
snapVersion = match.group(1)
snapBuild = match.group(2)
else:
snapVersion = value
snapBuild = "0"
if snapBuild == "18819":
snapInfo = "PATCH - LongTimeout"
elif snapBuild == "18771":
snapInfo = "BETA - ReadBuffer"
elif snapBuild == "18889":
snapInfo = "BETA - ReadBuffer"
elif snapBuild == "18967":
snapInfo = "BETA - VSS-AsyncRead"
else:
snapInfo = "RELEASE"
node["snapshot_version"] = snapVersion
node["snapshot_build"] = snapBuild
node["snapshot_version_info"] = snapInfo
elif varname == "SnapshotExeDate":
node["snapshot_date"] = value
inv_info["snapshot_backup"] = {
"inv_function": inv_snapshot_backup,
}
And using this code to create the inventory table:
from cmk.gui.plugins.views.inventory import (
declare_invtable_view,
render_inv_dicttable,
)
inventory_displayhints.update({
".software.snapshot_backup:" : { "title" : _("SnapshotBackupVSS"),
"render" : render_inv_dicttable,
"view" : "invsnap",
"keyorder": ["version","snapshot_version","snapshot_build","snapshot_date","snapshot_version_info"]
},
".software.snapshot_backup:*.version" : { "title" : _("Version") },
".software.snapshot_backup:*.snapshot_version" : { "title" : _("Snapshot Version") },
".software.snapshot_backup:*.snapshot_build" : { "title" : _("Snapshot Build") },
".software.snapshot_backup:*.snapshot_date" : { "title" : _("Snapshot Datum") },
".software.snapshot_backup:*.snapshot_version_info" : { "title" : _("Snapshot Info") },
})
declare_invtable_view("invsnap", ".software.snapshot_backup:", _("SnapshotBackupVSS"), _("SnapshotBackupVSS"))
Now this is working properly but when I’m trying to create a new view that is showing all hosts with the version number, the entry in the ‘column’ dropdown is missing (picture 2)
For exampe the ‘BIOS’ entry got it’s branches “Date”, “Vendor”, “Version”…
(picture 3)
It feels like one single line of code is missing. What am I doing wrong? Do you have any ideas?
Thank you so much for reading this!