Hi Zusammen,
bräuchte mal einen Tip wie ich aus den Service Discovery einen automatisierten Service Comment anlegen kann … folgendes habe ich schon gefunden:
def add_service_comment(
connection,
host_name: str,
service_description: str,
comment: str,
persistent: bool = False,
user: str = "",
):
"""Add service comment
Args:
connection:
A livestatus connection object
host_name:
The host-name where the service is located
service_description:
The service description for which the comment is for
comment:
The comment which will be stored for the service
persistent:
If set, the comment will persist across program restarts until it is delete manually.
If not set, the comment will be deleted the next time the Core is restarted.
user:
Examples:
>>> from cmk.gui.livestatus_utils.testing import simple_expect
>>> cmd = "COMMAND [...] ADD_SVC_COMMENT;example.com;CPU Load;0;;test"
>>> with simple_expect(cmd, match_type="ellipsis") as live:
... add_service_comment(live, 'example.com', 'CPU Load', 'test')
"""
return send_command(
connection,
"ADD_SVC_COMMENT",
[host_name, service_description, int(persistent), user, comment],
)
def del_service_comment(connection, comment_id: int):
Quelle: [https://programtalk.com/python-more-examples/cmk.gui.livestatus_utils.commands.lowlevel.send_command/]
(https://programtalk.com/python-more-examples/cmk.gui.livestatus_utils.commands.lowlevel.send_command/)
läuft ja scheinbar über den Livestatus … nur wie bau ich das am besten in einen Check ein …
vG Bernd