Check_MK bietet auch die Möglichkeit die Host Variablen zu erweitern um z.B. ein Host Description Feld hinzuzufügen.
Die Erweiterung muss in ~/local/share/check_mk/web/plugins/wato/ abgelegt werden. Die Dateiendung ist zwingend .py.
OMD[dev1]:~/local/share/check_mk/web/plugins/wato$ cat host_custom_vars.py
#!/usr/bin/env python
declare_host_attribute(
NagiosTextAttribute(
# Sektion / Gruppe
"MY_HOST_CUSTOM_VARIABLES",
# Variable mit beginnenden Unterstrich
"_HOST_MAGIC",
# Feldbeschreibung
_("Host Magic"),
# Hilfe
_("Hilfe"),
),
show_in_table=True,
show_in_folder=True,
)
Nach dem Anlegen eines eigenen Attributs muss der Apache neu gestartet werden mit z.B. „omd restart apache“.
Die Host custom variables sind auch per Livestatus abrufbar:
OMD[dev1]:~/local/share/check_mk/web/plugins/wato$ lq "GET hosts\nColumns: host_name host_address\nFilter: host_custom_variables ~ HOST_MAGIC (^|[ ])magic($|[ ])" localhost;127.0.0.1


Is it possible to restrict when this extra attribute is displayed?
For example, I have a host folder for „external open http relays“ (which I use to test access to services on my own network). These relays have differing TCP port numbers for their relay services. So I would like to add something like „TCP port number of http relay“. But I would only like this „question“ to appear for hosts that are in the „external open http relays“ folder.
Perhaps it’s possible to replace:
show_in_folder=True
with:
if …..
show_in_folder=True
else
show_in_folder=False
Where did you find out about the contents of these .py files? I did plenty of goofgling, but didn’t manage to find anything.
Many thanks!
PS Alternatively, if the visibility of the „question“ depended on a host tag, that would also be fine.
Hi,
wenn ich in einer Nagvis Karte (non-interactive) Hosts via GPS Koordinaten darstellen will, kann ich das mit Hilfe der folgenden Konfiguration machen:
~/local/share/check_mk/web/plugins/wato/geolocation.py
declare_host_attribute(
NagiosTextAttribute(
(„latitude“),
(„_LAT“),
(„Längengrad“),
(„Längengrad des Devices“)),
show_in_table = True,
show_in_folder = True,
show_in_form = True)
declare_host_attribute(
NagiosTextAttribute(
(„longitude“),
(„_LONG“),
(„Breitengrad“),
(„Breitengrad des Devices“)),
show_in_table = True,
show_in_folder = True,
show_in_form = True)
Wenn ich die Felder aber über WATO konfigurieren möchte, bekomme ich aber in Nagvis nur den Fehler „Got empty map after filtering. Terminate rendering geomap.“
Irgendeine Idee?
Viele Grüße
Christian